/* gnotravex.c generated by valac 0.15.2.11-7b14d, the Vala compiler
 * generated from gnotravex.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <games-clock.h>
#include <games-scores.h>
#include <games-fullscreen-action.h>
#include <games-pause-action.h>
#include <stdlib.h>
#include <string.h>
#include <games-stock.h>
#include <glib/gi18n-lib.h>
#include <games-score.h>
#include <games-settings.h>
#include <gdk/gdk.h>
#include <time.h>
#include <games-scores-dialog.h>
#include <locale.h>


#define TYPE_GNOTRAVEX (gnotravex_get_type ())
#define GNOTRAVEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GNOTRAVEX, Gnotravex))
#define GNOTRAVEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GNOTRAVEX, GnotravexClass))
#define IS_GNOTRAVEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GNOTRAVEX))
#define IS_GNOTRAVEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GNOTRAVEX))
#define GNOTRAVEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GNOTRAVEX, GnotravexClass))

typedef struct _Gnotravex Gnotravex;
typedef struct _GnotravexClass GnotravexClass;
typedef struct _GnotravexPrivate GnotravexPrivate;

#define TYPE_PUZZLE (puzzle_get_type ())
#define PUZZLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUZZLE, Puzzle))
#define PUZZLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PUZZLE, PuzzleClass))
#define IS_PUZZLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PUZZLE))
#define IS_PUZZLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PUZZLE))
#define PUZZLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PUZZLE, PuzzleClass))

typedef struct _Puzzle Puzzle;
typedef struct _PuzzleClass PuzzleClass;

#define TYPE_PUZZLE_VIEW (puzzle_view_get_type ())
#define PUZZLE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUZZLE_VIEW, PuzzleView))
#define PUZZLE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PUZZLE_VIEW, PuzzleViewClass))
#define IS_PUZZLE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PUZZLE_VIEW))
#define IS_PUZZLE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PUZZLE_VIEW))
#define PUZZLE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PUZZLE_VIEW, PuzzleViewClass))

typedef struct _PuzzleView PuzzleView;
typedef struct _PuzzleViewClass PuzzleViewClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _puzzle_unref0(var) ((var == NULL) ? NULL : (var = (puzzle_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _Gnotravex {
	GtkApplication parent_instance;
	GnotravexPrivate * priv;
};

struct _GnotravexClass {
	GtkApplicationClass parent_class;
};

struct _GnotravexPrivate {
	GSettings* settings;
	Puzzle* puzzle;
	GamesClock* clock;
	GamesScores* highscores;
	PuzzleView* view;
	GtkWindow* window;
	GSimpleAction* pause;
	GSimpleAction* solve;
	GamesFullscreenAction* fullscreen_action;
	GamesPauseAction* pause_action;
};


static gpointer gnotravex_parent_class = NULL;

GType gnotravex_get_type (void) G_GNUC_CONST;
gpointer puzzle_ref (gpointer instance);
void puzzle_unref (gpointer instance);
GParamSpec* param_spec_puzzle (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_puzzle (GValue* value, gpointer v_object);
void value_take_puzzle (GValue* value, gpointer v_object);
gpointer value_get_puzzle (const GValue* value);
GType puzzle_get_type (void) G_GNUC_CONST;
GType puzzle_view_get_type (void) G_GNUC_CONST;
#define GNOTRAVEX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_GNOTRAVEX, GnotravexPrivate))
enum  {
	GNOTRAVEX_DUMMY_PROPERTY
};
#define GNOTRAVEX_KEY_GRID_SIZE "grid-size"
static void gnotravex_new_game_cb (Gnotravex* self);
static void _gnotravex_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_toggle_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter);
static void _gnotravex_toggle_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_pause_changed (Gnotravex* self, GSimpleAction* action, GVariant* state);
static void _gnotravex_pause_changed_gsimple_action_change_state_callback (GSimpleAction* action, GVariant* value, gpointer self);
static void gnotravex_solve_cb (Gnotravex* self);
static void _gnotravex_solve_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_scores_cb (Gnotravex* self);
static void _gnotravex_scores_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_quit_cb (Gnotravex* self);
static void _gnotravex_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_move_up_cb (Gnotravex* self);
static void _gnotravex_move_up_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_move_down_cb (Gnotravex* self);
static void _gnotravex_move_down_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_move_left_cb (Gnotravex* self);
static void _gnotravex_move_left_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_move_right_cb (Gnotravex* self);
static void _gnotravex_move_right_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_radio_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter);
static void _gnotravex_radio_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_size_changed (Gnotravex* self, GSimpleAction* action, GVariant* value);
static void _gnotravex_size_changed_gsimple_action_change_state_callback (GSimpleAction* action, GVariant* value, gpointer self);
static void gnotravex_help_cb (Gnotravex* self);
static void _gnotravex_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_about_cb (Gnotravex* self);
static void _gnotravex_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void _gnotravex_new_game_cb_gtk_action_callback (GtkAction* action, gpointer self);
static void _gnotravex_solve_cb_gtk_action_callback (GtkAction* action, gpointer self);
#define GNOTRAVEX_ui_description "<ui>" "    <toolbar name='Toolbar'>" "        <toolitem action='NewGame'/>" "        <toolitem action='Solve'/>" "        <toolitem action='PauseGame'/>" "        <toolitem action='Fullscreen'/>" "    </toolbar>" "</ui>"
Gnotravex* gnotravex_new (void);
Gnotravex* gnotravex_construct (GType object_type);
static void gnotravex_real_startup (GApplication* base);
static GVariant* _variant_new1 (gchar* value);
static void gnotravex_pause_cb (Gnotravex* self);
static void _gnotravex_pause_cb_games_pause_action_state_changed (GamesPauseAction* _sender, gpointer self);
PuzzleView* puzzle_view_new (void);
PuzzleView* puzzle_view_construct (GType object_type);
static gboolean gnotravex_view_button_press_event (Gnotravex* self, GtkWidget* widget, GdkEventButton* event);
static gboolean _gnotravex_view_button_press_event_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self);
static void gnotravex_new_game (Gnotravex* self);
static void gnotravex_real_shutdown (GApplication* base);
static void gnotravex_real_activate (GApplication* base);
Puzzle* puzzle_new (guint size);
Puzzle* puzzle_construct (GType object_type, guint size);
static void gnotravex_solved_cb (Gnotravex* self, Puzzle* puzzle);
static void _gnotravex_solved_cb_puzzle_solved (Puzzle* _sender, gpointer self);
void puzzle_view_set_puzzle (PuzzleView* self, Puzzle* value);
static GVariant* _variant_new2 (gboolean value);
static gboolean _variant_get3 (GVariant* value);
static GVariant* _variant_new4 (gboolean value);
static gboolean _variant_get5 (GVariant* value);
void puzzle_solve (Puzzle* self);
void puzzle_view_set_is_paused (PuzzleView* self, gboolean value);
static GVariant* _variant_new6 (gboolean value);
static const gchar* _variant_get7 (GVariant* value);
void puzzle_move_up (Puzzle* self);
void puzzle_move_left (Puzzle* self);
void puzzle_move_right (Puzzle* self);
void puzzle_move_down (Puzzle* self);
static gboolean _variant_get8 (GVariant* value);
static GVariant* _variant_new9 (gboolean value);
gint gnotravex_main (gchar** args, int args_length1);
static void gnotravex_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 GamesScoresCategory GNOTRAVEX_scorecats[5] = {{"2x2", "2×2"}, {"3x3", "3×3"}, {"4x4", "4×4"}, {"5x5", "5×5"}, {"6x6", "6×6"}};
static const GActionEntry GNOTRAVEX_action_entries[12] = {{"new-game", _gnotravex_new_game_cb_gsimple_action_activate_callback}, {"pause", _gnotravex_toggle_cb_gsimple_action_activate_callback, NULL, "false", _gnotravex_pause_changed_gsimple_action_change_state_callback}, {"solve", _gnotravex_solve_cb_gsimple_action_activate_callback}, {"scores", _gnotravex_scores_cb_gsimple_action_activate_callback}, {"quit", _gnotravex_quit_cb_gsimple_action_activate_callback}, {"move-up", _gnotravex_move_up_cb_gsimple_action_activate_callback}, {"move-down", _gnotravex_move_down_cb_gsimple_action_activate_callback}, {"move-left", _gnotravex_move_left_cb_gsimple_action_activate_callback}, {"move-right", _gnotravex_move_right_cb_gsimple_action_activate_callback}, {"size", _gnotravex_radio_cb_gsimple_action_activate_callback, "s", "'2'", _gnotravex_size_changed_gsimple_action_change_state_callback}, {"help", _gnotravex_help_cb_gsimple_action_activate_callback}, {"about", _gnotravex_about_cb_gsimple_action_activate_callback}};
static const GtkActionEntry GNOTRAVEX_actions[2] = {{"NewGame", GAMES_STOCK_NEW_GAME, NULL, NULL, "Start a new game", (GCallback) _gnotravex_new_game_cb_gtk_action_callback}, {"Solve", NULL, "Solve", NULL, "Solve the game", (GCallback) _gnotravex_solve_cb_gtk_action_callback}};

static void _gnotravex_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_new_game_cb (self);
}


static void _gnotravex_toggle_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_toggle_cb (self, action, parameter);
}


static void _gnotravex_pause_changed_gsimple_action_change_state_callback (GSimpleAction* action, GVariant* value, gpointer self) {
	gnotravex_pause_changed (self, action, value);
}


static void _gnotravex_solve_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_solve_cb (self);
}


static void _gnotravex_scores_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_scores_cb (self);
}


static void _gnotravex_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_quit_cb (self);
}


static void _gnotravex_move_up_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_move_up_cb (self);
}


static void _gnotravex_move_down_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_move_down_cb (self);
}


static void _gnotravex_move_left_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_move_left_cb (self);
}


static void _gnotravex_move_right_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_move_right_cb (self);
}


static void _gnotravex_radio_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_radio_cb (self, action, parameter);
}


static void _gnotravex_size_changed_gsimple_action_change_state_callback (GSimpleAction* action, GVariant* value, gpointer self) {
	gnotravex_size_changed (self, action, value);
}


static void _gnotravex_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_help_cb (self);
}


static void _gnotravex_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_about_cb (self);
}


static void _gnotravex_new_game_cb_gtk_action_callback (GtkAction* action, gpointer self) {
	gnotravex_new_game_cb (self);
}


static void _gnotravex_solve_cb_gtk_action_callback (GtkAction* action, gpointer self) {
	gnotravex_solve_cb (self);
}


Gnotravex* gnotravex_construct (GType object_type) {
	Gnotravex * self = NULL;
	self = (Gnotravex*) g_object_new (object_type, "application-id", "org.gnome.gnotravex", "flags", G_APPLICATION_FLAGS_NONE, NULL);
	return self;
}


Gnotravex* gnotravex_new (void) {
	return gnotravex_construct (TYPE_GNOTRAVEX);
}


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


static GVariant* _variant_new1 (gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static void _gnotravex_pause_cb_games_pause_action_state_changed (GamesPauseAction* _sender, gpointer self) {
	gnotravex_pause_cb (self);
}


static gboolean _gnotravex_view_button_press_event_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) {
	gboolean result;
	result = gnotravex_view_button_press_event (self, _sender, event);
	return result;
}


static void gnotravex_real_startup (GApplication* base) {
	Gnotravex * self;
	const gchar* _tmp0_ = NULL;
	GAction* _tmp1_ = NULL;
	GSimpleAction* _tmp2_;
	GAction* _tmp3_ = NULL;
	GSimpleAction* _tmp4_;
	GtkBuilder* _tmp5_;
	GtkBuilder* builder;
	GObject* _tmp9_ = NULL;
	GSettings* _tmp10_;
	GamesScores* _tmp11_;
	GtkApplicationWindow* _tmp12_;
	GtkWindow* _tmp13_;
	GtkWindow* _tmp14_;
	const gchar* _tmp15_ = NULL;
	GtkWindow* _tmp16_;
	GAction* _tmp17_ = NULL;
	GSettings* _tmp18_;
	gint _tmp19_ = 0;
	gchar* _tmp20_ = NULL;
	gchar* _tmp21_;
	GVariant* _tmp22_;
	GtkGrid* _tmp23_;
	GtkGrid* _tmp24_;
	GtkGrid* grid;
	GtkWindow* _tmp25_;
	GtkActionGroup* _tmp26_;
	GtkActionGroup* action_group;
	GtkUIManager* _tmp27_;
	GtkUIManager* ui_manager;
	GtkAction* _tmp30_ = NULL;
	GtkAction* _tmp31_ = NULL;
	GtkWindow* _tmp32_;
	GamesFullscreenAction* _tmp33_;
	GamesFullscreenAction* _tmp34_;
	GamesPauseAction* _tmp35_;
	GamesPauseAction* _tmp36_;
	GamesPauseAction* _tmp37_;
	GtkWidget* _tmp38_ = NULL;
	GtkToolbar* _tmp39_;
	GtkToolbar* toolbar;
	GtkStyleContext* _tmp40_ = NULL;
	PuzzleView* _tmp41_;
	PuzzleView* _tmp42_;
	PuzzleView* _tmp43_;
	PuzzleView* _tmp44_;
	PuzzleView* _tmp45_;
	PuzzleView* _tmp46_;
	PuzzleView* _tmp47_;
	GtkToolItem* _tmp48_;
	GtkToolItem* _tmp49_;
	GtkToolItem* time_item;
	GtkAlignment* _tmp50_;
	GtkAlignment* _tmp51_;
	GtkAlignment* time_align;
	GtkBox* _tmp52_;
	GtkBox* _tmp53_;
	GtkBox* time_box;
	const gchar* _tmp54_ = NULL;
	GtkLabel* _tmp55_;
	GtkLabel* _tmp56_;
	GtkLabel* time_label;
	GtkLabel* _tmp57_;
	GtkLabel* _tmp58_;
	GtkLabel* label;
	GamesClock* _tmp59_;
	GamesClock* _tmp60_;
	GamesClock* _tmp61_;
	GamesClock* _tmp62_;
	GError * _inner_error_ = NULL;
	self = (Gnotravex*) base;
	G_APPLICATION_CLASS (gnotravex_parent_class)->startup ((GApplication*) GTK_APPLICATION (self));
	_tmp0_ = _ ("Tetravex");
	g_set_application_name (_tmp0_);
	games_stock_init ();
	gtk_window_set_default_icon_name ("gnotravex");
	g_action_map_add_action_entries ((GActionMap*) self, GNOTRAVEX_action_entries, G_N_ELEMENTS (GNOTRAVEX_action_entries), self);
	_tmp1_ = g_action_map_lookup_action ((GActionMap*) self, "pause");
	_tmp2_ = _g_object_ref0 (G_IS_SIMPLE_ACTION (_tmp1_) ? ((GSimpleAction*) _tmp1_) : NULL);
	_g_object_unref0 (self->priv->pause);
	self->priv->pause = _tmp2_;
	_tmp3_ = g_action_map_lookup_action ((GActionMap*) self, "solve");
	_tmp4_ = _g_object_ref0 (G_IS_SIMPLE_ACTION (_tmp3_) ? ((GSimpleAction*) _tmp3_) : NULL);
	_g_object_unref0 (self->priv->solve);
	self->priv->solve = _tmp4_;
	_tmp5_ = gtk_builder_new ();
	builder = _tmp5_;
	{
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_;
		_tmp6_ = g_build_filename (DATA_DIRECTORY, "gnotravex.ui", NULL);
		_tmp7_ = _tmp6_;
		gtk_builder_add_from_file (builder, _tmp7_, &_inner_error_);
		_g_free0 (_tmp7_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp8_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp8_ = e->message;
		g_error ("gnotravex.vala:83: Unable to build menus: %s", _tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	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;
	}
	_tmp9_ = gtk_builder_get_object (builder, "gnotravex-menu");
	gtk_application_set_app_menu ((GtkApplication*) self, G_IS_MENU_MODEL (_tmp9_) ? ((GMenuModel*) _tmp9_) : NULL);
	_tmp10_ = g_settings_new ("org.gnome.gnotravex");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp10_;
	_tmp11_ = games_scores_new ("gnotravex", GNOTRAVEX_scorecats, G_N_ELEMENTS (GNOTRAVEX_scorecats), NULL, NULL, 0, GAMES_SCORES_STYLE_TIME_ASCENDING);
	_g_object_unref0 (self->priv->highscores);
	self->priv->highscores = _tmp11_;
	_tmp12_ = (GtkApplicationWindow*) gtk_application_window_new ((GtkApplication*) self);
	_tmp13_ = (GtkWindow*) g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp13_;
	_tmp14_ = self->priv->window;
	_tmp15_ = _ ("Tetravex");
	gtk_window_set_title (_tmp14_, _tmp15_);
	_tmp16_ = self->priv->window;
	games_settings_bind_window_state ("/org/gnome/gnotravex/", _tmp16_);
	_tmp17_ = g_action_map_lookup_action ((GActionMap*) self, "size");
	_tmp18_ = self->priv->settings;
	_tmp19_ = g_settings_get_int (_tmp18_, GNOTRAVEX_KEY_GRID_SIZE);
	_tmp20_ = g_strdup_printf ("%d", _tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _variant_new1 (_tmp21_);
	g_simple_action_set_state (G_IS_SIMPLE_ACTION (_tmp17_) ? ((GSimpleAction*) _tmp17_) : NULL, _tmp22_);
	_g_free0 (_tmp21_);
	_tmp23_ = (GtkGrid*) gtk_grid_new ();
	_tmp24_ = g_object_ref_sink (_tmp23_);
	grid = _tmp24_;
	gtk_widget_show ((GtkWidget*) grid);
	_tmp25_ = self->priv->window;
	gtk_container_add ((GtkContainer*) _tmp25_, (GtkWidget*) grid);
	_tmp26_ = gtk_action_group_new ("group");
	action_group = _tmp26_;
	gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
	gtk_action_group_add_actions (action_group, GNOTRAVEX_actions, G_N_ELEMENTS (GNOTRAVEX_actions), self);
	_tmp27_ = gtk_ui_manager_new ();
	ui_manager = _tmp27_;
	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
	{
		gtk_ui_manager_add_ui_from_string (ui_manager, GNOTRAVEX_ui_description, (gssize) (-1), &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp28_;
		const gchar* _tmp29_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp28_ = e;
		_tmp29_ = _tmp28_->message;
		g_warning ("gnotravex.vala:113: Failed to load UI: %s", _tmp29_);
		_g_error_free0 (e);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (ui_manager);
		_g_object_unref0 (action_group);
		_g_object_unref0 (grid);
		_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;
	}
	_tmp30_ = gtk_action_group_get_action (action_group, "NewGame");
	gtk_action_set_is_important (_tmp30_, TRUE);
	_tmp31_ = gtk_action_group_get_action (action_group, "Solve");
	gtk_action_set_is_important (_tmp31_, TRUE);
	_tmp32_ = self->priv->window;
	_tmp33_ = games_fullscreen_action_new ("Fullscreen", _tmp32_);
	_g_object_unref0 (self->priv->fullscreen_action);
	self->priv->fullscreen_action = _tmp33_;
	_tmp34_ = self->priv->fullscreen_action;
	gtk_action_group_add_action_with_accel (action_group, (GtkAction*) _tmp34_, NULL);
	_tmp35_ = games_pause_action_new ("PauseGame");
	_g_object_unref0 (self->priv->pause_action);
	self->priv->pause_action = _tmp35_;
	_tmp36_ = self->priv->pause_action;
	g_signal_connect_object (_tmp36_, "state-changed", (GCallback) _gnotravex_pause_cb_games_pause_action_state_changed, self, 0);
	_tmp37_ = self->priv->pause_action;
	gtk_action_group_add_action_with_accel (action_group, (GtkAction*) _tmp37_, NULL);
	_tmp38_ = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
	_tmp39_ = _g_object_ref0 (GTK_TOOLBAR (_tmp38_));
	toolbar = _tmp39_;
	gtk_toolbar_set_show_arrow (toolbar, FALSE);
	_tmp40_ = gtk_widget_get_style_context ((GtkWidget*) toolbar);
	gtk_style_context_add_class (_tmp40_, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
	gtk_widget_show ((GtkWidget*) toolbar);
	gtk_grid_attach (grid, (GtkWidget*) toolbar, 0, 0, 1, 1);
	_tmp41_ = puzzle_view_new ();
	_tmp42_ = g_object_ref_sink (_tmp41_);
	_g_object_unref0 (self->priv->view);
	self->priv->view = _tmp42_;
	_tmp43_ = self->priv->view;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp43_, TRUE);
	_tmp44_ = self->priv->view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp44_, TRUE);
	_tmp45_ = self->priv->view;
	g_signal_connect_object ((GtkWidget*) _tmp45_, "button-press-event", (GCallback) _gnotravex_view_button_press_event_gtk_widget_button_press_event, self, 0);
	_tmp46_ = self->priv->view;
	gtk_widget_show ((GtkWidget*) _tmp46_);
	_tmp47_ = self->priv->view;
	gtk_grid_attach (grid, (GtkWidget*) _tmp47_, 0, 1, 1, 1);
	_tmp48_ = gtk_tool_item_new ();
	_tmp49_ = g_object_ref_sink (_tmp48_);
	time_item = _tmp49_;
	gtk_tool_item_set_expand (time_item, TRUE);
	gtk_widget_show ((GtkWidget*) time_item);
	gtk_toolbar_insert (toolbar, time_item, -1);
	_tmp50_ = (GtkAlignment*) gtk_alignment_new (1.0f, 0.5f, 0.0f, 0.0f);
	_tmp51_ = g_object_ref_sink (_tmp50_);
	time_align = _tmp51_;
	gtk_widget_show ((GtkWidget*) time_align);
	gtk_container_add ((GtkContainer*) time_item, (GtkWidget*) time_align);
	_tmp52_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	_tmp53_ = g_object_ref_sink (_tmp52_);
	time_box = _tmp53_;
	gtk_widget_show ((GtkWidget*) time_box);
	gtk_container_add ((GtkContainer*) time_align, (GtkWidget*) time_box);
	_tmp54_ = _ ("Time:");
	_tmp55_ = (GtkLabel*) gtk_label_new (_tmp54_);
	_tmp56_ = g_object_ref_sink (_tmp55_);
	time_label = _tmp56_;
	gtk_widget_show ((GtkWidget*) time_label);
	gtk_box_pack_start (time_box, (GtkWidget*) time_label, FALSE, FALSE, (guint) 0);
	_tmp57_ = (GtkLabel*) gtk_label_new (" ");
	_tmp58_ = g_object_ref_sink (_tmp57_);
	label = _tmp58_;
	gtk_widget_show ((GtkWidget*) label);
	gtk_box_pack_start (time_box, (GtkWidget*) label, FALSE, FALSE, (guint) 0);
	_tmp59_ = games_clock_new ();
	_tmp60_ = g_object_ref_sink (_tmp59_);
	_g_object_unref0 (self->priv->clock);
	self->priv->clock = _tmp60_;
	_tmp61_ = self->priv->clock;
	gtk_widget_show ((GtkWidget*) _tmp61_);
	_tmp62_ = self->priv->clock;
	gtk_box_pack_start (time_box, (GtkWidget*) _tmp62_, FALSE, FALSE, (guint) 0);
	gnotravex_new_game (self);
	_g_object_unref0 (label);
	_g_object_unref0 (time_label);
	_g_object_unref0 (time_box);
	_g_object_unref0 (time_align);
	_g_object_unref0 (time_item);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (ui_manager);
	_g_object_unref0 (action_group);
	_g_object_unref0 (grid);
	_g_object_unref0 (builder);
}


static void gnotravex_real_shutdown (GApplication* base) {
	Gnotravex * self;
	self = (Gnotravex*) base;
	G_APPLICATION_CLASS (gnotravex_parent_class)->shutdown ((GApplication*) GTK_APPLICATION (self));
}


static void gnotravex_real_activate (GApplication* base) {
	Gnotravex * self;
	GtkWindow* _tmp0_;
	self = (Gnotravex*) base;
	_tmp0_ = self->priv->window;
	gtk_window_present (_tmp0_);
}


static void _gnotravex_solved_cb_puzzle_solved (Puzzle* _sender, gpointer self) {
	gnotravex_solved_cb (self, _sender);
}


static GVariant* _variant_new2 (gboolean value) {
	return g_variant_ref_sink (g_variant_new_boolean (value));
}


static void gnotravex_new_game (Gnotravex* self) {
	Puzzle* _tmp0_;
	GSettings* _tmp2_;
	gint _tmp3_ = 0;
	gint size;
	GamesScores* _tmp4_;
	GamesScoresCategory _tmp5_;
	const gchar* _tmp6_;
	Puzzle* _tmp7_;
	Puzzle* _tmp8_;
	PuzzleView* _tmp9_;
	Puzzle* _tmp10_;
	GSimpleAction* _tmp11_;
	GVariant* _tmp12_;
	GamesClock* _tmp13_;
	GamesClock* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	if (_tmp0_ != NULL) {
		Puzzle* _tmp1_;
		_tmp1_ = self->priv->puzzle;
		g_signal_handlers_disconnect_by_func (_tmp1_, NULL, self);
	}
	_tmp2_ = self->priv->settings;
	_tmp3_ = g_settings_get_int (_tmp2_, GNOTRAVEX_KEY_GRID_SIZE);
	size = _tmp3_;
	_tmp4_ = self->priv->highscores;
	_tmp5_ = GNOTRAVEX_scorecats[size - 2];
	_tmp6_ = _tmp5_.key;
	games_scores_set_category (_tmp4_, _tmp6_);
	_tmp7_ = puzzle_new ((guint) size);
	_puzzle_unref0 (self->priv->puzzle);
	self->priv->puzzle = _tmp7_;
	_tmp8_ = self->priv->puzzle;
	g_signal_connect_object (_tmp8_, "solved", (GCallback) _gnotravex_solved_cb_puzzle_solved, self, 0);
	_tmp9_ = self->priv->view;
	_tmp10_ = self->priv->puzzle;
	puzzle_view_set_puzzle (_tmp9_, _tmp10_);
	_tmp11_ = self->priv->pause;
	_tmp12_ = _variant_new2 (FALSE);
	g_signal_emit_by_name (_tmp11_, "change-state", _tmp12_);
	_tmp13_ = self->priv->clock;
	games_clock_reset (_tmp13_);
	_tmp14_ = self->priv->clock;
	games_clock_start (_tmp14_);
}


static void gnotravex_solved_cb (Gnotravex* self, Puzzle* puzzle) {
	GamesClock* _tmp0_;
	GamesClock* _tmp1_;
	time_t _tmp2_ = 0;
	time_t seconds;
	GamesScores* _tmp3_;
	time_t _tmp4_;
	time_t _tmp5_;
	gint _tmp6_ = 0;
	gint pos;
	GtkWindow* _tmp7_;
	GamesScores* _tmp8_;
	const gchar* _tmp9_ = NULL;
	GamesScoresDialog* _tmp10_;
	GamesScoresDialog* _tmp11_;
	GamesScoresDialog* scores_dialog;
	GamesScoresDialog* _tmp12_;
	const gchar* _tmp13_ = NULL;
	GamesScoresDialog* _tmp14_;
	gint _tmp15_;
	const gchar* _tmp16_ = NULL;
	gint _tmp17_;
	GamesScoresDialog* _tmp20_;
	const gchar* _tmp21_ = NULL;
	const gchar* _tmp22_;
	gchar* _tmp23_ = NULL;
	gchar* _tmp24_;
	GamesScoresDialog* _tmp25_;
	GamesScoresDialog* _tmp26_;
	gint _tmp27_ = 0;
	GamesScoresDialog* _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (puzzle != NULL);
	_tmp0_ = self->priv->clock;
	games_clock_stop (_tmp0_);
	_tmp1_ = self->priv->clock;
	_tmp2_ = games_clock_get_seconds (_tmp1_);
	seconds = _tmp2_;
	_tmp3_ = self->priv->highscores;
	_tmp4_ = seconds;
	_tmp5_ = seconds;
	_tmp6_ = games_scores_add_time_score (_tmp3_, ((_tmp4_ / 60) * 1.0) + ((_tmp5_ % 60) / 100.0));
	pos = _tmp6_;
	_tmp7_ = self->priv->window;
	_tmp8_ = self->priv->highscores;
	_tmp9_ = _ ("Tetravex Scores");
	_tmp10_ = games_scores_dialog_new (_tmp7_, _tmp8_, _tmp9_);
	_tmp11_ = g_object_ref_sink (_tmp10_);
	scores_dialog = _tmp11_;
	_tmp12_ = scores_dialog;
	_tmp13_ = _ ("Size:");
	games_scores_dialog_set_category_description (_tmp12_, _tmp13_);
	_tmp14_ = scores_dialog;
	_tmp15_ = pos;
	games_scores_dialog_set_hilight (_tmp14_, (guint) _tmp15_);
	_tmp17_ = pos;
	if (_tmp17_ == 1) {
		const gchar* _tmp18_ = NULL;
		_tmp18_ = _ ("Your score is the best!");
		_tmp16_ = _tmp18_;
	} else {
		const gchar* _tmp19_ = NULL;
		_tmp19_ = _ ("Your score has made the top ten.");
		_tmp16_ = _tmp19_;
	}
	_tmp20_ = scores_dialog;
	_tmp21_ = _ ("Congratulations!");
	_tmp22_ = _tmp16_;
	_tmp23_ = g_strdup_printf ("<b>%s</b>\n\n%s", _tmp21_, _tmp22_);
	_tmp24_ = _tmp23_;
	games_scores_dialog_set_message (_tmp20_, _tmp24_);
	_g_free0 (_tmp24_);
	_tmp25_ = scores_dialog;
	games_scores_dialog_set_buttons (_tmp25_, (guint) (GAMES_SCORES_QUIT_BUTTON | GAMES_SCORES_NEW_GAME_BUTTON));
	_tmp26_ = scores_dialog;
	_tmp27_ = gtk_dialog_run ((GtkDialog*) _tmp26_);
	if (_tmp27_ == ((gint) GTK_RESPONSE_REJECT)) {
		GtkWindow* _tmp28_;
		_tmp28_ = self->priv->window;
		gtk_widget_destroy ((GtkWidget*) _tmp28_);
	} else {
		gnotravex_new_game (self);
	}
	_tmp29_ = scores_dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp29_);
	_g_object_unref0 (scores_dialog);
}


static void gnotravex_new_game_cb (Gnotravex* self) {
	g_return_if_fail (self != NULL);
	gnotravex_new_game (self);
}


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


static void gnotravex_scores_cb (Gnotravex* self) {
	GtkWindow* _tmp0_;
	GamesScores* _tmp1_;
	const gchar* _tmp2_ = NULL;
	GamesScoresDialog* _tmp3_;
	GamesScoresDialog* _tmp4_;
	GamesScoresDialog* scores_dialog;
	const gchar* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	_tmp1_ = self->priv->highscores;
	_tmp2_ = _ ("Tetravex Scores");
	_tmp3_ = games_scores_dialog_new (_tmp0_, _tmp1_, _tmp2_);
	_tmp4_ = g_object_ref_sink (_tmp3_);
	scores_dialog = _tmp4_;
	_tmp5_ = _ ("Size:");
	games_scores_dialog_set_category_description (scores_dialog, _tmp5_);
	gtk_dialog_run ((GtkDialog*) scores_dialog);
	gtk_widget_destroy ((GtkWidget*) scores_dialog);
	_g_object_unref0 (scores_dialog);
}


static gboolean _variant_get3 (GVariant* value) {
	return g_variant_get_boolean (value);
}


static GVariant* _variant_new4 (gboolean value) {
	return g_variant_ref_sink (g_variant_new_boolean (value));
}


static gboolean gnotravex_view_button_press_event (Gnotravex* self, GtkWidget* widget, GdkEventButton* event) {
	gboolean result = FALSE;
	GSimpleAction* _tmp0_;
	GVariant* _tmp1_ = NULL;
	GVariant* _tmp2_;
	gboolean _tmp3_;
	gboolean _tmp4_;
	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_ = self->priv->pause;
	_tmp1_ = g_action_get_state ((GAction*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _variant_get3 (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_variant_unref0 (_tmp2_);
	if (_tmp4_) {
		GSimpleAction* _tmp5_;
		GVariant* _tmp6_;
		_tmp5_ = self->priv->pause;
		_tmp6_ = _variant_new4 (FALSE);
		g_signal_emit_by_name (_tmp5_, "change-state", _tmp6_);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static gboolean _variant_get5 (GVariant* value) {
	return g_variant_get_boolean (value);
}


static void gnotravex_pause_changed (Gnotravex* self, GSimpleAction* action, GVariant* state) {
	GamesPauseAction* _tmp0_;
	GVariant* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (state != NULL);
	_tmp0_ = self->priv->pause_action;
	_tmp1_ = state;
	_tmp2_ = _variant_get5 (_tmp1_);
	games_pause_action_set_is_paused (_tmp0_, _tmp2_);
}


static void gnotravex_solve_cb (Gnotravex* self) {
	Puzzle* _tmp0_;
	GamesClock* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	puzzle_solve (_tmp0_);
	_tmp1_ = self->priv->clock;
	games_clock_stop (_tmp1_);
}


static GVariant* _variant_new6 (gboolean value) {
	return g_variant_ref_sink (g_variant_new_boolean (value));
}


static void gnotravex_pause_cb (Gnotravex* self) {
	GSimpleAction* _tmp0_;
	GamesPauseAction* _tmp1_;
	gboolean _tmp2_ = FALSE;
	PuzzleView* _tmp3_;
	GamesPauseAction* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GamesPauseAction* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GSimpleAction* _tmp10_;
	GamesPauseAction* _tmp11_;
	gboolean _tmp12_ = FALSE;
	GVariant* _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->solve;
	_tmp1_ = self->priv->pause_action;
	_tmp2_ = games_pause_action_get_is_paused (_tmp1_);
	g_simple_action_set_enabled (_tmp0_, !_tmp2_);
	_tmp3_ = self->priv->view;
	_tmp4_ = self->priv->pause_action;
	_tmp5_ = games_pause_action_get_is_paused (_tmp4_);
	puzzle_view_set_is_paused (_tmp3_, _tmp5_);
	_tmp6_ = self->priv->pause_action;
	_tmp7_ = games_pause_action_get_is_paused (_tmp6_);
	if (_tmp7_) {
		GamesClock* _tmp8_;
		_tmp8_ = self->priv->clock;
		games_clock_stop (_tmp8_);
	} else {
		GamesClock* _tmp9_;
		_tmp9_ = self->priv->clock;
		games_clock_start (_tmp9_);
	}
	_tmp10_ = self->priv->pause;
	_tmp11_ = self->priv->pause_action;
	_tmp12_ = games_pause_action_get_is_paused (_tmp11_);
	_tmp13_ = _variant_new6 (_tmp12_);
	g_simple_action_set_state (_tmp10_, _tmp13_);
}


static void gnotravex_help_cb (Gnotravex* 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:gnotravex", _tmp2_, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("gnotravex.vala:272: Failed to show help: %s", _tmp4_);
		_g_error_free0 (e);
	}
	__finally2:
	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 void gnotravex_about_cb (Gnotravex* 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_;
	const gchar* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	gchar* license;
	GtkWindow* _tmp7_;
	const gchar* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("Lars Rydlinge");
	_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 ("Rob Bradford");
	_tmp4_ = g_new0 (gchar*, 2 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp4_[1] = NULL;
	documenters = _tmp4_;
	documenters_length1 = 2;
	_documenters_size_ = documenters_length1;
	_tmp5_ = _ ("Tetravex");
	_tmp6_ = games_get_license (_tmp5_);
	license = _tmp6_;
	_tmp7_ = self->priv->window;
	_tmp8_ = _ ("Tetravex");
	_tmp9_ = _ ("GNOME Tetravex is a simple puzzle where pieces must be positioned so t" \
"hat the same numbers are touching each other.\n" \
"\n" \
"Tetravex is a part of GNOME Games.");
	_tmp10_ = _ ("translator-credits");
	_tmp11_ = _ ("GNOME Games web site");
	gtk_show_about_dialog (_tmp7_, "program-name", _tmp8_, "version", VERSION, "comments", _tmp9_, "copyright", "Copyright \xc2\xa9 1999-2008 Lars Rydlinge", "license", license, "wrap-license", TRUE, "authors", authors, "documenters", documenters, "translator-credits", _tmp10_, "logo-icon-name", "gnotravex", "website", "http://www.gnome.org/projects/gnome-games", "website-label", _tmp11_, 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 const gchar* _variant_get7 (GVariant* value) {
	return g_variant_dup_string (value, NULL);
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static void gnotravex_size_changed (Gnotravex* self, GSimpleAction* action, GVariant* value) {
	GVariant* _tmp0_;
	const gchar* _tmp1_;
	gchar _tmp2_ = '\0';
	gchar size;
	gchar _tmp3_;
	GSettings* _tmp4_;
	gint _tmp5_ = 0;
	GSettings* _tmp6_;
	gchar _tmp7_;
	GSimpleAction* _tmp8_;
	GVariant* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = value;
	_tmp1_ = _variant_get7 (_tmp0_);
	_tmp2_ = string_get (_tmp1_, (glong) 0);
	size = _tmp2_ - '0';
	_tmp3_ = size;
	_tmp4_ = self->priv->settings;
	_tmp5_ = g_settings_get_int (_tmp4_, GNOTRAVEX_KEY_GRID_SIZE);
	if (((gint) _tmp3_) == _tmp5_) {
		return;
	}
	_tmp6_ = self->priv->settings;
	_tmp7_ = size;
	g_settings_set_int (_tmp6_, GNOTRAVEX_KEY_GRID_SIZE, (gint) _tmp7_);
	_tmp8_ = action;
	_tmp9_ = value;
	g_simple_action_set_state (_tmp8_, _tmp9_);
	gnotravex_new_game (self);
}


static void gnotravex_move_up_cb (Gnotravex* self) {
	Puzzle* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	puzzle_move_up (_tmp0_);
}


static void gnotravex_move_left_cb (Gnotravex* self) {
	Puzzle* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	puzzle_move_left (_tmp0_);
}


static void gnotravex_move_right_cb (Gnotravex* self) {
	Puzzle* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	puzzle_move_right (_tmp0_);
}


static void gnotravex_move_down_cb (Gnotravex* self) {
	Puzzle* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->puzzle;
	puzzle_move_down (_tmp0_);
}


static gboolean _variant_get8 (GVariant* value) {
	return g_variant_get_boolean (value);
}


static GVariant* _variant_new9 (gboolean value) {
	return g_variant_ref_sink (g_variant_new_boolean (value));
}


static void gnotravex_toggle_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter) {
	GSimpleAction* _tmp0_;
	GSimpleAction* _tmp1_;
	GVariant* _tmp2_ = NULL;
	GVariant* _tmp3_;
	gboolean _tmp4_;
	GVariant* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = action;
	_tmp1_ = action;
	_tmp2_ = g_action_get_state ((GAction*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _variant_get8 (_tmp3_);
	_tmp5_ = _variant_new9 (!_tmp4_);
	g_signal_emit_by_name (_tmp0_, "change-state", _tmp5_);
	_g_variant_unref0 (_tmp3_);
}


static void gnotravex_radio_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter) {
	GSimpleAction* _tmp0_;
	GVariant* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = action;
	_tmp1_ = parameter;
	g_signal_emit_by_name (_tmp0_, "change-state", _tmp1_);
}


gint gnotravex_main (gchar** args, int args_length1) {
	gint result = 0;
	Gnotravex* _tmp0_;
	Gnotravex* app;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_ = 0;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	games_scores_startup ();
	_tmp0_ = gnotravex_new ();
	app = _tmp0_;
	_tmp1_ = args;
	_tmp1__length1 = args_length1;
	_tmp2_ = g_application_run ((GApplication*) app, _tmp1__length1, _tmp1_);
	result = _tmp2_;
	_g_object_unref0 (app);
	return result;
}


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


static void gnotravex_class_init (GnotravexClass * klass) {
	gnotravex_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GnotravexPrivate));
	G_APPLICATION_CLASS (klass)->startup = gnotravex_real_startup;
	G_APPLICATION_CLASS (klass)->shutdown = gnotravex_real_shutdown;
	G_APPLICATION_CLASS (klass)->activate = gnotravex_real_activate;
	G_OBJECT_CLASS (klass)->finalize = gnotravex_finalize;
}


static void gnotravex_instance_init (Gnotravex * self) {
	self->priv = GNOTRAVEX_GET_PRIVATE (self);
}


static void gnotravex_finalize (GObject* obj) {
	Gnotravex * self;
	self = GNOTRAVEX (obj);
	_g_object_unref0 (self->priv->settings);
	_puzzle_unref0 (self->priv->puzzle);
	_g_object_unref0 (self->priv->clock);
	_g_object_unref0 (self->priv->highscores);
	_g_object_unref0 (self->priv->view);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->pause);
	_g_object_unref0 (self->priv->solve);
	_g_object_unref0 (self->priv->fullscreen_action);
	_g_object_unref0 (self->priv->pause_action);
	G_OBJECT_CLASS (gnotravex_parent_class)->finalize (obj);
}


GType gnotravex_get_type (void) {
	static volatile gsize gnotravex_type_id__volatile = 0;
	if (g_once_init_enter (&gnotravex_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GnotravexClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gnotravex_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Gnotravex), 0, (GInstanceInitFunc) gnotravex_instance_init, NULL };
		GType gnotravex_type_id;
		gnotravex_type_id = g_type_register_static (GTK_TYPE_APPLICATION, "Gnotravex", &g_define_type_info, 0);
		g_once_init_leave (&gnotravex_type_id__volatile, gnotravex_type_id);
	}
	return gnotravex_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);
}



