/* gnotravex.c generated by valac 0.17.7.1-fedb1, 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-scores.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <games-score.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.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)))

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

struct _GnotravexClass {
	GtkApplicationClass parent_class;
};

struct _GnotravexPrivate {
	GSettings* settings;
	Puzzle* puzzle;
	GtkLabel* clock_label;
	GamesScores* highscores;
	PuzzleView* view;
	GtkWindow* window;
	gint window_width;
	gint window_height;
	gboolean is_fullscreen;
	gboolean is_maximized;
	GtkToolButton* pause_button;
	GtkToolButton* fullscreen_button;
};


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_pause_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter);
static void _gnotravex_pause_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void gnotravex_fullscreen_cb (Gnotravex* self);
static void _gnotravex_fullscreen_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, 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);
Gnotravex* gnotravex_new (void);
Gnotravex* gnotravex_construct (GType object_type);
static void gnotravex_real_startup (GApplication* base);
static gboolean gnotravex_window_configure_event_cb (Gnotravex* self, GdkEventConfigure* event);
static gboolean _gnotravex_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self);
static gboolean gnotravex_window_state_event_cb (Gnotravex* self, GdkEventWindowState* event);
static gboolean _gnotravex_window_state_event_cb_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self);
static GVariant* _variant_new1 (gchar* value);
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_tick_cb (Gnotravex* 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_tick_cb_puzzle_tick (Puzzle* _sender, gpointer self);
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);
gdouble puzzle_get_elapsed (Puzzle* self);
gboolean puzzle_get_paused (Puzzle* self);
void puzzle_set_paused (Puzzle* self, gboolean value);
void puzzle_solve (Puzzle* self);
static gchar* _variant_get3 (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);
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[13] = {{"new-game", _gnotravex_new_game_cb_gsimple_action_activate_callback}, {"pause", _gnotravex_pause_cb_gsimple_action_activate_callback}, {"fullscreen", _gnotravex_fullscreen_cb_gsimple_action_activate_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 void _gnotravex_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_new_game_cb (self);
}


static void _gnotravex_pause_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_pause_cb (self, action, parameter);
}


static void _gnotravex_fullscreen_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	gnotravex_fullscreen_cb (self);
}


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);
}


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 gboolean _gnotravex_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self) {
	gboolean result;
	result = gnotravex_window_configure_event_cb (self, event);
	return result;
}


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


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


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;
	GtkBuilder* _tmp1_;
	GtkBuilder* builder;
	GObject* _tmp5_ = NULL;
	GSettings* _tmp6_;
	GamesScores* _tmp7_;
	GtkApplicationWindow* _tmp8_;
	GtkWindow* _tmp9_;
	const gchar* _tmp10_ = NULL;
	GtkWindow* _tmp11_;
	GtkWindow* _tmp12_;
	GtkWindow* _tmp13_;
	GSettings* _tmp14_;
	gint _tmp15_ = 0;
	GSettings* _tmp16_;
	gint _tmp17_ = 0;
	GSettings* _tmp18_;
	gboolean _tmp19_ = FALSE;
	GAction* _tmp24_ = NULL;
	GSettings* _tmp25_;
	gint _tmp26_ = 0;
	gchar* _tmp27_ = NULL;
	gchar* _tmp28_;
	GVariant* _tmp29_;
	GtkGrid* _tmp30_;
	GtkGrid* grid;
	GtkWindow* _tmp31_;
	GtkToolbar* _tmp32_;
	GtkToolbar* toolbar;
	GtkStyleContext* _tmp33_ = NULL;
	const gchar* _tmp34_ = NULL;
	GtkToolButton* _tmp35_;
	GtkToolButton* new_game_button;
	const gchar* _tmp36_ = NULL;
	GtkToolButton* _tmp37_;
	GtkToolButton* solve_button;
	const gchar* _tmp38_ = NULL;
	GtkToolButton* _tmp39_;
	GtkToolButton* _tmp40_;
	GtkToolButton* _tmp41_;
	GtkToolButton* _tmp42_;
	GtkToolButton* _tmp43_;
	GtkToolButton* _tmp44_;
	const gchar* _tmp45_ = NULL;
	GtkToolButton* _tmp46_;
	GtkToolButton* _tmp47_;
	GtkToolButton* _tmp48_;
	GtkToolButton* _tmp49_;
	GtkToolButton* _tmp50_;
	GtkToolButton* _tmp51_;
	PuzzleView* _tmp52_;
	PuzzleView* _tmp53_;
	PuzzleView* _tmp54_;
	PuzzleView* _tmp55_;
	PuzzleView* _tmp56_;
	PuzzleView* _tmp57_;
	GtkToolItem* _tmp58_;
	GtkToolItem* time_item;
	GtkAlignment* _tmp59_;
	GtkAlignment* time_align;
	GtkBox* _tmp60_;
	GtkBox* time_box;
	GtkLabel* _tmp61_;
	GtkLabel* _tmp62_;
	GtkLabel* _tmp63_;
	GError * _inner_error_ = NULL;
	self = (Gnotravex*) base;
	G_APPLICATION_CLASS (gnotravex_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_APPLICATION, GtkApplication));
	_tmp0_ = _ ("Tetravex");
	g_set_application_name (_tmp0_);
	gtk_window_set_default_icon_name ("gnotravex");
	g_action_map_add_action_entries ((GActionMap*) self, (const GActionEntry*) GNOTRAVEX_action_entries, G_N_ELEMENTS (GNOTRAVEX_action_entries), self);
	gtk_application_add_accelerator ((GtkApplication*) self, "<Primary>n", "app.new-game", NULL);
	gtk_application_add_accelerator ((GtkApplication*) self, "Pause", "app.pause", NULL);
	gtk_application_add_accelerator ((GtkApplication*) self, "F11", "app.fullscreen", NULL);
	gtk_application_add_accelerator ((GtkApplication*) self, "F1", "app.help", NULL);
	gtk_application_add_accelerator ((GtkApplication*) self, "<Primary>q", "app.quit", NULL);
	_tmp1_ = gtk_builder_new ();
	builder = _tmp1_;
	{
		gchar* _tmp2_ = NULL;
		gchar* _tmp3_;
		_tmp2_ = g_build_filename (DATA_DIRECTORY, "gnotravex.ui", NULL);
		_tmp3_ = _tmp2_;
		gtk_builder_add_from_file (builder, _tmp3_, &_inner_error_);
		_g_free0 (_tmp3_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp4_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = e->message;
		g_error ("gnotravex.vala:73: Unable to build menus: %s", _tmp4_);
		_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;
	}
	_tmp5_ = gtk_builder_get_object (builder, "gnotravex-menu");
	gtk_application_set_app_menu ((GtkApplication*) self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, g_menu_model_get_type ()) ? ((GMenuModel*) _tmp5_) : NULL);
	_tmp6_ = g_settings_new ("org.gnome.gnotravex");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp6_;
	_tmp7_ = 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 = _tmp7_;
	_tmp8_ = (GtkApplicationWindow*) gtk_application_window_new ((GtkApplication*) self);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->window);
	self->priv->window = (GtkWindow*) _tmp8_;
	_tmp9_ = self->priv->window;
	_tmp10_ = _ ("Tetravex");
	gtk_window_set_title (_tmp9_, _tmp10_);
	_tmp11_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp11_, "configure-event", (GCallback) _gnotravex_window_configure_event_cb_gtk_widget_configure_event, self, 0);
	_tmp12_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp12_, "window-state-event", (GCallback) _gnotravex_window_state_event_cb_gtk_widget_window_state_event, self, 0);
	_tmp13_ = self->priv->window;
	_tmp14_ = self->priv->settings;
	_tmp15_ = g_settings_get_int (_tmp14_, "window-width");
	_tmp16_ = self->priv->settings;
	_tmp17_ = g_settings_get_int (_tmp16_, "window-height");
	gtk_window_set_default_size (_tmp13_, _tmp15_, _tmp17_);
	_tmp18_ = self->priv->settings;
	_tmp19_ = g_settings_get_boolean (_tmp18_, "window-is-fullscreen");
	if (_tmp19_) {
		GtkWindow* _tmp20_;
		_tmp20_ = self->priv->window;
		gtk_window_fullscreen (_tmp20_);
	} else {
		GSettings* _tmp21_;
		gboolean _tmp22_ = FALSE;
		_tmp21_ = self->priv->settings;
		_tmp22_ = g_settings_get_boolean (_tmp21_, "window-is-maximized");
		if (_tmp22_) {
			GtkWindow* _tmp23_;
			_tmp23_ = self->priv->window;
			gtk_window_maximize (_tmp23_);
		}
	}
	_tmp24_ = g_action_map_lookup_action ((GActionMap*) self, "size");
	_tmp25_ = self->priv->settings;
	_tmp26_ = g_settings_get_int (_tmp25_, GNOTRAVEX_KEY_GRID_SIZE);
	_tmp27_ = g_strdup_printf ("%d", _tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = _variant_new1 (_tmp28_);
	g_simple_action_set_state (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp24_) : NULL, _tmp29_);
	_g_free0 (_tmp28_);
	_tmp30_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp30_);
	grid = _tmp30_;
	gtk_widget_show ((GtkWidget*) grid);
	_tmp31_ = self->priv->window;
	gtk_container_add ((GtkContainer*) _tmp31_, (GtkWidget*) grid);
	_tmp32_ = (GtkToolbar*) gtk_toolbar_new ();
	g_object_ref_sink (_tmp32_);
	toolbar = _tmp32_;
	gtk_toolbar_set_show_arrow (toolbar, FALSE);
	_tmp33_ = gtk_widget_get_style_context ((GtkWidget*) toolbar);
	gtk_style_context_add_class (_tmp33_, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
	gtk_widget_show ((GtkWidget*) toolbar);
	gtk_grid_attach (grid, (GtkWidget*) toolbar, 0, 0, 1, 1);
	_tmp34_ = _ ("_New");
	_tmp35_ = (GtkToolButton*) gtk_tool_button_new (NULL, _tmp34_);
	g_object_ref_sink (_tmp35_);
	new_game_button = _tmp35_;
	gtk_tool_button_set_use_underline (new_game_button, TRUE);
	gtk_tool_button_set_icon_name (new_game_button, "document-new");
	gtk_actionable_set_action_name ((GtkActionable*) new_game_button, "app.new-game");
	gtk_tool_item_set_is_important ((GtkToolItem*) new_game_button, TRUE);
	gtk_widget_show ((GtkWidget*) new_game_button);
	gtk_toolbar_insert (toolbar, (GtkToolItem*) new_game_button, -1);
	_tmp36_ = _ ("Solve");
	_tmp37_ = (GtkToolButton*) gtk_tool_button_new (NULL, _tmp36_);
	g_object_ref_sink (_tmp37_);
	solve_button = _tmp37_;
	gtk_actionable_set_action_name ((GtkActionable*) solve_button, "app.solve");
	gtk_tool_item_set_is_important ((GtkToolItem*) solve_button, TRUE);
	gtk_widget_show ((GtkWidget*) solve_button);
	gtk_toolbar_insert (toolbar, (GtkToolItem*) solve_button, -1);
	_tmp38_ = _ ("_Pause");
	_tmp39_ = (GtkToolButton*) gtk_tool_button_new (NULL, _tmp38_);
	g_object_ref_sink (_tmp39_);
	_g_object_unref0 (self->priv->pause_button);
	self->priv->pause_button = _tmp39_;
	_tmp40_ = self->priv->pause_button;
	gtk_tool_button_set_icon_name (_tmp40_, "media-playback-pause");
	_tmp41_ = self->priv->pause_button;
	gtk_tool_button_set_use_underline (_tmp41_, TRUE);
	_tmp42_ = self->priv->pause_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp42_, "app.pause");
	_tmp43_ = self->priv->pause_button;
	gtk_widget_show ((GtkWidget*) _tmp43_);
	_tmp44_ = self->priv->pause_button;
	gtk_toolbar_insert (toolbar, (GtkToolItem*) _tmp44_, -1);
	_tmp45_ = _ ("_Fullscreen");
	_tmp46_ = (GtkToolButton*) gtk_tool_button_new (NULL, _tmp45_);
	g_object_ref_sink (_tmp46_);
	_g_object_unref0 (self->priv->fullscreen_button);
	self->priv->fullscreen_button = _tmp46_;
	_tmp47_ = self->priv->fullscreen_button;
	gtk_tool_button_set_icon_name (_tmp47_, "view-fullscreen");
	_tmp48_ = self->priv->fullscreen_button;
	gtk_tool_button_set_use_underline (_tmp48_, TRUE);
	_tmp49_ = self->priv->fullscreen_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp49_, "app.fullscreen");
	_tmp50_ = self->priv->fullscreen_button;
	gtk_widget_show ((GtkWidget*) _tmp50_);
	_tmp51_ = self->priv->fullscreen_button;
	gtk_toolbar_insert (toolbar, (GtkToolItem*) _tmp51_, -1);
	_tmp52_ = puzzle_view_new ();
	g_object_ref_sink (_tmp52_);
	_g_object_unref0 (self->priv->view);
	self->priv->view = _tmp52_;
	_tmp53_ = self->priv->view;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp53_, TRUE);
	_tmp54_ = self->priv->view;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp54_, TRUE);
	_tmp55_ = self->priv->view;
	g_signal_connect_object ((GtkWidget*) _tmp55_, "button-press-event", (GCallback) _gnotravex_view_button_press_event_gtk_widget_button_press_event, self, 0);
	_tmp56_ = self->priv->view;
	gtk_widget_show ((GtkWidget*) _tmp56_);
	_tmp57_ = self->priv->view;
	gtk_grid_attach (grid, (GtkWidget*) _tmp57_, 0, 1, 1, 1);
	_tmp58_ = gtk_tool_item_new ();
	g_object_ref_sink (_tmp58_);
	time_item = _tmp58_;
	gtk_tool_item_set_expand (time_item, TRUE);
	gtk_widget_show ((GtkWidget*) time_item);
	gtk_toolbar_insert (toolbar, time_item, -1);
	_tmp59_ = (GtkAlignment*) gtk_alignment_new (1.0f, 0.5f, 0.0f, 0.0f);
	g_object_ref_sink (_tmp59_);
	time_align = _tmp59_;
	gtk_widget_show ((GtkWidget*) time_align);
	gtk_container_add ((GtkContainer*) time_item, (GtkWidget*) time_align);
	_tmp60_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp60_);
	time_box = _tmp60_;
	gtk_widget_show ((GtkWidget*) time_box);
	gtk_container_add ((GtkContainer*) time_align, (GtkWidget*) time_box);
	_tmp61_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp61_);
	_g_object_unref0 (self->priv->clock_label);
	self->priv->clock_label = _tmp61_;
	_tmp62_ = self->priv->clock_label;
	gtk_widget_show ((GtkWidget*) _tmp62_);
	_tmp63_ = self->priv->clock_label;
	gtk_box_pack_start (time_box, (GtkWidget*) _tmp63_, FALSE, FALSE, (guint) 0);
	gnotravex_tick_cb (self);
	gnotravex_new_game (self);
	_g_object_unref0 (time_box);
	_g_object_unref0 (time_align);
	_g_object_unref0 (time_item);
	_g_object_unref0 (solve_button);
	_g_object_unref0 (new_game_button);
	_g_object_unref0 (toolbar);
	_g_object_unref0 (grid);
	_g_object_unref0 (builder);
}


static gboolean gnotravex_window_configure_event_cb (Gnotravex* 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 gnotravex_window_state_event_cb (Gnotravex* 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_;
		gboolean _tmp8_;
		_tmp6_ = *event;
		_tmp7_ = _tmp6_.new_window_state;
		self->priv->is_fullscreen = (_tmp7_ & GDK_WINDOW_STATE_FULLSCREEN) != 0;
		_tmp8_ = self->priv->is_fullscreen;
		if (_tmp8_) {
			GtkToolButton* _tmp9_;
			const gchar* _tmp10_ = NULL;
			GtkToolButton* _tmp11_;
			_tmp9_ = self->priv->fullscreen_button;
			_tmp10_ = _ ("_Leave Fullscreen");
			gtk_tool_button_set_label (_tmp9_, _tmp10_);
			_tmp11_ = self->priv->fullscreen_button;
			gtk_tool_button_set_icon_name (_tmp11_, "view-restore");
		} else {
			GtkToolButton* _tmp12_;
			const gchar* _tmp13_ = NULL;
			GtkToolButton* _tmp14_;
			_tmp12_ = self->priv->fullscreen_button;
			_tmp13_ = _ ("_Fullscreen");
			gtk_tool_button_set_label (_tmp12_, _tmp13_);
			_tmp14_ = self->priv->fullscreen_button;
			gtk_tool_button_set_icon_name (_tmp14_, "view-fullscreen");
		}
	}
	result = FALSE;
	return result;
}


static void gnotravex_real_shutdown (GApplication* base) {
	Gnotravex * self;
	GSettings* _tmp0_;
	gint _tmp1_;
	GSettings* _tmp2_;
	gint _tmp3_;
	GSettings* _tmp4_;
	gboolean _tmp5_;
	GSettings* _tmp6_;
	gboolean _tmp7_;
	self = (Gnotravex*) base;
	G_APPLICATION_CLASS (gnotravex_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 void gnotravex_real_activate (GApplication* base) {
	Gnotravex * self;
	GtkWindow* _tmp0_;
	self = (Gnotravex*) base;
	_tmp0_ = self->priv->window;
	gtk_window_present (_tmp0_);
}


static void _gnotravex_tick_cb_puzzle_tick (Puzzle* _sender, gpointer self) {
	gnotravex_tick_cb (self);
}


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


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


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_;
	Puzzle* _tmp9_;
	PuzzleView* _tmp10_;
	Puzzle* _tmp11_;
	GAction* _tmp12_ = NULL;
	GSimpleAction* _tmp13_;
	GSimpleAction* pause;
	GVariant* _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_, "tick", (GCallback) _gnotravex_tick_cb_puzzle_tick, self, 0);
	_tmp9_ = self->priv->puzzle;
	g_signal_connect_object (_tmp9_, "solved", (GCallback) _gnotravex_solved_cb_puzzle_solved, self, 0);
	_tmp10_ = self->priv->view;
	_tmp11_ = self->priv->puzzle;
	puzzle_view_set_puzzle (_tmp10_, _tmp11_);
	gnotravex_tick_cb (self);
	_tmp12_ = g_action_map_lookup_action ((GActionMap*) self, "pause");
	_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp12_) : NULL);
	pause = _tmp13_;
	_tmp14_ = _variant_new2 (FALSE);
	g_signal_emit_by_name (pause, "change-state", _tmp14_);
	_g_object_unref0 (pause);
}


static void gnotravex_tick_cb (Gnotravex* self) {
	gint elapsed;
	Puzzle* _tmp0_;
	gint _tmp4_;
	gint hours;
	gint _tmp5_;
	gint minutes;
	gint _tmp6_;
	gint seconds;
	GtkLabel* _tmp7_;
	const gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	g_return_if_fail (self != NULL);
	elapsed = 0;
	_tmp0_ = self->priv->puzzle;
	if (_tmp0_ != NULL) {
		Puzzle* _tmp1_;
		gdouble _tmp2_;
		gdouble _tmp3_;
		_tmp1_ = self->priv->puzzle;
		_tmp2_ = puzzle_get_elapsed (_tmp1_);
		_tmp3_ = _tmp2_;
		elapsed = (gint) (_tmp3_ + 0.5);
	}
	_tmp4_ = elapsed;
	hours = _tmp4_ / 3600;
	_tmp5_ = elapsed;
	minutes = (_tmp5_ - (hours * 3600)) / 60;
	_tmp6_ = elapsed;
	seconds = (_tmp6_ - (hours * 3600)) - (minutes * 60);
	_tmp7_ = self->priv->clock_label;
	_tmp8_ = _ ("Time");
	_tmp9_ = g_strdup_printf ("%s: %02d:%02d:%02d", _tmp8_, hours, minutes, seconds);
	_tmp10_ = _tmp9_;
	gtk_label_set_text (_tmp7_, _tmp10_);
	_g_free0 (_tmp10_);
}


static void gnotravex_solved_cb (Gnotravex* self, Puzzle* puzzle) {
	Puzzle* _tmp0_;
	gdouble _tmp1_;
	gdouble _tmp2_;
	gint seconds;
	GamesScores* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_ = 0;
	gint pos;
	GtkWindow* _tmp7_;
	GamesScores* _tmp8_;
	const gchar* _tmp9_ = NULL;
	GamesScoresDialog* _tmp10_;
	GamesScoresDialog* scores_dialog;
	GamesScoresDialog* _tmp11_;
	const gchar* _tmp12_ = NULL;
	GamesScoresDialog* _tmp13_;
	gint _tmp14_;
	gint _tmp15_;
	GamesScoresDialog* _tmp25_;
	GamesScoresDialog* _tmp26_;
	gint _tmp27_ = 0;
	GamesScoresDialog* _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (puzzle != NULL);
	_tmp0_ = puzzle;
	_tmp1_ = puzzle_get_elapsed (_tmp0_);
	_tmp2_ = _tmp1_;
	seconds = (gint) (_tmp2_ + 0.5);
	_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_);
	g_object_ref_sink (_tmp10_);
	scores_dialog = _tmp10_;
	_tmp11_ = scores_dialog;
	_tmp12_ = _ ("Size:");
	games_scores_dialog_set_category_description (_tmp11_, _tmp12_);
	_tmp13_ = scores_dialog;
	_tmp14_ = pos;
	games_scores_dialog_set_hilight (_tmp13_, (guint) _tmp14_);
	_tmp15_ = pos;
	if (_tmp15_ > 0) {
		const gchar* _tmp16_ = NULL;
		gint _tmp17_;
		GamesScoresDialog* _tmp20_;
		const gchar* _tmp21_ = NULL;
		const gchar* _tmp22_;
		gchar* _tmp23_ = NULL;
		gchar* _tmp24_;
		_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* scores_dialog;
	const gchar* _tmp4_ = 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_);
	g_object_ref_sink (_tmp3_);
	scores_dialog = _tmp3_;
	_tmp4_ = _ ("Size:");
	games_scores_dialog_set_category_description (scores_dialog, _tmp4_);
	gtk_dialog_run ((GtkDialog*) scores_dialog);
	gtk_widget_destroy ((GtkWidget*) scores_dialog);
	_g_object_unref0 (scores_dialog);
}


static gboolean gnotravex_view_button_press_event (Gnotravex* self, GtkWidget* widget, GdkEventButton* event) {
	gboolean result = FALSE;
	Puzzle* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	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->puzzle;
	_tmp1_ = puzzle_get_paused (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		Puzzle* _tmp3_;
		_tmp3_ = self->priv->puzzle;
		puzzle_set_paused (_tmp3_, FALSE);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


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


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 __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_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:296: Failed to show help: %s", _tmp4_);
		_g_error_free0 (e);
	}
	__finally1:
	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_;
	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 ("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_ = g_strdup ("Tetravex is free software; you can redistribute it and/or modify it un" \
"der the terms of the GNU General Public License as published by the Fr" \
"ee Software Foundation; either version 2 of the License, or (at your o" \
"ption) any later version.\n" \
"\n" \
"Tetravex is distributed in the hope that it will be useful, but WITHOU" \
"T ANY WARRANTY; without even the implied warranty of MERCHANTABILITY o" \
"r FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License" \
" for more details.\n" \
"\n" \
"You should have received a copy of the GNU General Public License alon" \
"g with Tetravex; 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_ = _ ("Tetravex");
	_tmp8_ = _ ("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.");
	_tmp9_ = _ ("translator-credits");
	_tmp10_ = _ ("GNOME Games web site");
	gtk_show_about_dialog (_tmp6_, "program-name", _tmp7_, "version", VERSION, "comments", _tmp8_, "copyright", "Copyright \xc2\xa9 1999-2008 Lars Rydlinge", "license", license, "wrap-license", TRUE, "authors", authors, "documenters", documenters, "translator-credits", _tmp9_, "logo-icon-name", "gnotravex", "website", "http://www.gnome.org/projects/gnome-games", "website-label", _tmp10_, 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 gchar* _variant_get3 (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_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar _tmp3_ = '\0';
	gchar _tmp4_;
	gchar size;
	gchar _tmp5_;
	GSettings* _tmp6_;
	gint _tmp7_ = 0;
	GSettings* _tmp8_;
	gchar _tmp9_;
	GSimpleAction* _tmp10_;
	GVariant* _tmp11_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = value;
	_tmp1_ = _variant_get3 (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = string_get (_tmp2_, (glong) 0);
	_tmp4_ = _tmp3_ - '0';
	_g_free0 (_tmp2_);
	size = _tmp4_;
	_tmp5_ = size;
	_tmp6_ = self->priv->settings;
	_tmp7_ = g_settings_get_int (_tmp6_, GNOTRAVEX_KEY_GRID_SIZE);
	if (((gint) _tmp5_) == _tmp7_) {
		return;
	}
	_tmp8_ = self->priv->settings;
	_tmp9_ = size;
	g_settings_set_int (_tmp8_, GNOTRAVEX_KEY_GRID_SIZE, (gint) _tmp9_);
	_tmp10_ = action;
	_tmp11_ = value;
	g_simple_action_set_state (_tmp10_, _tmp11_);
	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 void gnotravex_pause_cb (Gnotravex* self, GSimpleAction* action, GVariant* parameter) {
	Puzzle* _tmp0_;
	Puzzle* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	GAction* _tmp4_ = NULL;
	GSimpleAction* _tmp5_;
	GSimpleAction* solve;
	GSimpleAction* _tmp6_;
	Puzzle* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	Puzzle* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->puzzle;
	_tmp1_ = self->priv->puzzle;
	_tmp2_ = puzzle_get_paused (_tmp1_);
	_tmp3_ = _tmp2_;
	puzzle_set_paused (_tmp0_, !_tmp3_);
	_tmp4_ = g_action_map_lookup_action ((GActionMap*) self, "solve");
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp4_) : NULL);
	solve = _tmp5_;
	_tmp6_ = solve;
	_tmp7_ = self->priv->puzzle;
	_tmp8_ = puzzle_get_paused (_tmp7_);
	_tmp9_ = _tmp8_;
	g_simple_action_set_enabled (_tmp6_, !_tmp9_);
	_tmp10_ = self->priv->puzzle;
	_tmp11_ = puzzle_get_paused (_tmp10_);
	_tmp12_ = _tmp11_;
	if (_tmp12_) {
		GtkToolButton* _tmp13_;
		GtkToolButton* _tmp14_;
		const gchar* _tmp15_ = NULL;
		_tmp13_ = self->priv->pause_button;
		gtk_tool_button_set_icon_name (_tmp13_, "media-playback-start");
		_tmp14_ = self->priv->pause_button;
		_tmp15_ = _ ("Res_ume");
		gtk_tool_button_set_label (_tmp14_, _tmp15_);
	} else {
		GtkToolButton* _tmp16_;
		GtkToolButton* _tmp17_;
		const gchar* _tmp18_ = NULL;
		_tmp16_ = self->priv->pause_button;
		gtk_tool_button_set_icon_name (_tmp16_, "media-playback-pause");
		_tmp17_ = self->priv->pause_button;
		_tmp18_ = _ ("_Pause");
		gtk_tool_button_set_label (_tmp17_, _tmp18_);
	}
	_g_object_unref0 (solve);
}


static void gnotravex_fullscreen_cb (Gnotravex* self) {
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->is_fullscreen;
	if (_tmp0_) {
		GtkWindow* _tmp1_;
		_tmp1_ = self->priv->window;
		gtk_window_unfullscreen (_tmp1_);
	} else {
		GtkWindow* _tmp2_;
		_tmp2_ = self->priv->window;
		gtk_window_fullscreen (_tmp2_);
	}
}


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 = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GNOTRAVEX, Gnotravex);
	_g_object_unref0 (self->priv->settings);
	_puzzle_unref0 (self->priv->puzzle);
	_g_object_unref0 (self->priv->clock_label);
	_g_object_unref0 (self->priv->highscores);
	_g_object_unref0 (self->priv->view);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->pause_button);
	_g_object_unref0 (self->priv->fullscreen_button);
	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);
}



