/* quadrapassel.c generated by valac 0.25.4.4-19ea, the Vala compiler
 * generated from quadrapassel.vala, do not modify */

/*
 * Copyright (C) 2010-2013 Robert Ancell
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 2 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

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


#define TYPE_QUADRAPASSEL (quadrapassel_get_type ())
#define QUADRAPASSEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUADRAPASSEL, Quadrapassel))
#define QUADRAPASSEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUADRAPASSEL, QuadrapasselClass))
#define IS_QUADRAPASSEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUADRAPASSEL))
#define IS_QUADRAPASSEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUADRAPASSEL))
#define QUADRAPASSEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUADRAPASSEL, QuadrapasselClass))

typedef struct _Quadrapassel Quadrapassel;
typedef struct _QuadrapasselClass QuadrapasselClass;
typedef struct _QuadrapasselPrivate QuadrapasselPrivate;

#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 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_PREVIEW (preview_get_type ())
#define PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREVIEW, Preview))
#define PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREVIEW, PreviewClass))
#define IS_PREVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREVIEW))
#define IS_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREVIEW))
#define PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREVIEW, PreviewClass))

typedef struct _Preview Preview;
typedef struct _PreviewClass PreviewClass;

#define TYPE_HISTORY (history_get_type ())
#define HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY, History))
#define HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY, HistoryClass))
#define IS_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY))
#define IS_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY))
#define HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY, HistoryClass))

typedef struct _History History;
typedef struct _HistoryClass HistoryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GameViewPrivate GameViewPrivate;
typedef struct _GamePrivate GamePrivate;

#define TYPE_SHAPE (shape_get_type ())
#define SHAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SHAPE, Shape))
#define SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SHAPE, ShapeClass))
#define IS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SHAPE))
#define IS_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SHAPE))
#define SHAPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SHAPE, ShapeClass))

typedef struct _Shape Shape;
typedef struct _ShapeClass ShapeClass;

#define TYPE_BLOCK (block_get_type ())
#define BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BLOCK, Block))
#define BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BLOCK, BlockClass))
#define IS_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BLOCK))
#define IS_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BLOCK))
#define BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BLOCK, BlockClass))

typedef struct _Block Block;
typedef struct _BlockClass BlockClass;

#define TYPE_HISTORY_ENTRY (history_entry_get_type ())
#define HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_ENTRY, HistoryEntry))
#define HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_ENTRY, HistoryEntryClass))
#define IS_HISTORY_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_ENTRY))
#define IS_HISTORY_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_ENTRY))
#define HISTORY_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_ENTRY, HistoryEntryClass))

typedef struct _HistoryEntry HistoryEntry;
typedef struct _HistoryEntryClass HistoryEntryClass;
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))

#define TYPE_SCORE_DIALOG (score_dialog_get_type ())
#define SCORE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCORE_DIALOG, ScoreDialog))
#define SCORE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCORE_DIALOG, ScoreDialogClass))
#define IS_SCORE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCORE_DIALOG))
#define IS_SCORE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCORE_DIALOG))
#define SCORE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCORE_DIALOG, ScoreDialogClass))

typedef struct _ScoreDialog ScoreDialog;
typedef struct _ScoreDialogClass ScoreDialogClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))

struct _Quadrapassel {
	GtkApplication parent_instance;
	QuadrapasselPrivate * priv;
};

struct _QuadrapasselClass {
	GtkApplicationClass parent_class;
};

struct _QuadrapasselPrivate {
	GSettings* settings;
	GtkWindow* window;
	gint window_width;
	gint window_height;
	gboolean is_maximized;
	Game* game;
	GameView* view;
	Preview* preview;
	GtkLabel* score_label;
	GtkLabel* n_destroyed_label;
	GtkLabel* level_label;
	History* history;
	GSimpleAction* pause_action;
	GtkButton* pause_play_button;
	GtkImage* pause_play_button_image;
	GtkDialog* preferences_dialog;
	GtkSpinButton* starting_level_spin;
	Preview* theme_preview;
	GtkSpinButton* fill_height_spinner;
	GtkSpinButton* fill_prob_spinner;
	GtkCheckButton* do_preview_toggle;
	GtkCheckButton* difficult_blocks_toggle;
	GtkCheckButton* rotate_counter_clock_wise_toggle;
	GtkCheckButton* show_shadow_toggle;
	GtkCheckButton* sound_toggle;
	GtkListStore* controls_model;
};

struct _GameView {
	GtkClutterEmbed parent_instance;
	GameViewPrivate * priv;
	gboolean mute;
};

struct _GameViewClass {
	GtkClutterEmbedClass parent_class;
};

struct _Game {
	GObject parent_instance;
	GamePrivate * priv;
	Shape* shape;
	Shape* next_shape;
	Block** blocks;
	gint blocks_length1;
	gint blocks_length2;
	gint n_lines_destroyed;
	gint score;
	gboolean game_over;
};

struct _GameClass {
	GObjectClass parent_class;
};


static gpointer quadrapassel_parent_class = NULL;

GType quadrapassel_get_type (void) G_GNUC_CONST;
GType game_get_type (void) G_GNUC_CONST;
GType game_view_get_type (void) G_GNUC_CONST;
GType preview_get_type (void) G_GNUC_CONST;
GType history_get_type (void) G_GNUC_CONST;
#define QUADRAPASSEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_QUADRAPASSEL, QuadrapasselPrivate))
enum  {
	QUADRAPASSEL_DUMMY_PROPERTY
};
static void quadrapassel_new_game_cb (Quadrapassel* self);
static void _quadrapassel_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_pause_cb (Quadrapassel* self);
static void _quadrapassel_pause_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_scores_cb (Quadrapassel* self);
static void _quadrapassel_scores_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_preferences_cb (Quadrapassel* self);
static void _quadrapassel_preferences_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_help_cb (Quadrapassel* self);
static void _quadrapassel_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_about_cb (Quadrapassel* self);
static void _quadrapassel_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
static void quadrapassel_quit_cb (Quadrapassel* self);
static void _quadrapassel_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
Quadrapassel* quadrapassel_new (void);
Quadrapassel* quadrapassel_construct (GType object_type);
static void quadrapassel_real_startup (GApplication* base);
static gboolean quadrapassel_window_configure_event_cb (Quadrapassel* self, GdkEventConfigure* event);
static gboolean _quadrapassel_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self);
static gboolean quadrapassel_window_state_event_cb (Quadrapassel* self, GdkEventWindowState* event);
static gboolean _quadrapassel_window_state_event_cb_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self);
static gboolean quadrapassel_key_press_event_cb (Quadrapassel* self, GtkWidget* widget, GdkEventKey* event);
static gboolean _quadrapassel_key_press_event_cb_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
static gboolean quadrapassel_key_release_event_cb (Quadrapassel* self, GtkWidget* widget, GdkEventKey* event);
static gboolean _quadrapassel_key_release_event_cb_gtk_widget_key_release_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
GameView* game_view_new (void);
GameView* game_view_construct (GType object_type);
void game_view_set_theme (GameView* self, const gchar* value);
void game_view_set_show_shadow (GameView* self, gboolean value);
Game* game_new (gint lines, gint columns, gint starting_level, gint filled_lines, gint fill_prob, gboolean pick_difficult_blocks);
Game* game_construct (GType object_type, gint lines, gint columns, gint starting_level, gint filled_lines, gint fill_prob, gboolean pick_difficult_blocks);
void game_view_set_game (GameView* self, Game* value);
Preview* preview_new (GtkFrame* parent);
Preview* preview_construct (GType object_type, GtkFrame* parent);
void preview_set_theme (Preview* self, const gchar* value);
void preview_set_enabled (Preview* self, gboolean value);
History* history_new (const gchar* filename);
History* history_construct (GType object_type, const gchar* filename);
void history_load (History* self);
static void quadrapassel_real_shutdown (GApplication* base);
GType shape_get_type (void) G_GNUC_CONST;
GType block_get_type (void) G_GNUC_CONST;
GType history_entry_get_type (void) G_GNUC_CONST;
HistoryEntry* history_entry_new (GDateTime* date, gint score);
HistoryEntry* history_entry_construct (GType object_type, GDateTime* date, gint score);
void history_add (History* self, HistoryEntry* entry);
void history_save (History* self);
static void quadrapassel_real_activate (GApplication* base);
static void quadrapassel_preferences_dialog_close_cb (Quadrapassel* self);
static void quadrapassel_preferences_dialog_response_cb (Quadrapassel* self, gint response_id);
static void _quadrapassel_preferences_dialog_close_cb_gtk_dialog_close (GtkDialog* _sender, gpointer self);
static void _quadrapassel_preferences_dialog_response_cb_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
static void quadrapassel_fill_height_spinner_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin);
static void _quadrapassel_fill_height_spinner_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self);
static void quadrapassel_fill_prob_spinner_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin);
static void _quadrapassel_fill_prob_spinner_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self);
static void quadrapassel_starting_level_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin);
static void _quadrapassel_starting_level_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self);
static void quadrapassel_sound_toggle_toggled_cb (Quadrapassel* self);
static void _quadrapassel_sound_toggle_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void quadrapassel_difficult_blocks_toggled_cb (Quadrapassel* self);
static void _quadrapassel_difficult_blocks_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void quadrapassel_do_preview_toggle_toggled_cb (Quadrapassel* self);
static void _quadrapassel_do_preview_toggle_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void quadrapassel_set_rotate_counter_clock_wise (Quadrapassel* self);
static void _quadrapassel_set_rotate_counter_clock_wise_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void quadrapassel_user_target_toggled_cb (Quadrapassel* self);
static void _quadrapassel_user_target_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void quadrapassel_accel_edited_cb (Quadrapassel* self, GtkCellRendererAccel* cell, const gchar* path_string, guint keyval, GdkModifierType mask, guint hardware_keycode);
static void _quadrapassel_accel_edited_cb_gtk_cell_renderer_accel_accel_edited (GtkCellRendererAccel* _sender, const gchar* path_string, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, gpointer self);
static void quadrapassel_accel_cleared_cb (Quadrapassel* self, GtkCellRendererAccel* cell, const gchar* path_string);
static void _quadrapassel_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared (GtkCellRendererAccel* _sender, const gchar* path_string, gpointer self);
static void quadrapassel_theme_combo_changed_cb (Quadrapassel* self, GtkComboBox* widget);
static void _quadrapassel_theme_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self);
void preview_set_game (Preview* self, Game* value);
static void quadrapassel_update_preview_settings (Quadrapassel* self);
gboolean game_get_paused (Game* self);
void game_set_paused (Game* self, gboolean value);
static guint quadrapassel_upper_key (Quadrapassel* self, guint keyval);
gboolean game_move_left (Game* self);
gboolean game_move_right (Game* self);
gboolean game_rotate_left (Game* self);
gboolean game_rotate_right (Game* self);
void game_set_fast_forward (Game* self, gboolean enable);
void game_drop (Game* self);
static void quadrapassel_new_game (Quadrapassel* self);
void game_stop (Game* self);
static void quadrapassel_pause_changed_cb (Quadrapassel* self);
static void _quadrapassel_pause_changed_cb_game_pause_changed (Game* _sender, gpointer self);
static void quadrapassel_shape_landed_cb (Quadrapassel* self, gint* lines, int lines_length1, GList* line_blocks);
static void _quadrapassel_shape_landed_cb_game_shape_landed (Game* _sender, gint* lines, int lines_length1, GList* line_blocks, gpointer self);
static void quadrapassel_complete_cb (Quadrapassel* self);
static void _quadrapassel_complete_cb_game_complete (Game* _sender, gpointer self);
void game_start (Game* self);
static void quadrapassel_update_score (Quadrapassel* self);
static gint quadrapassel_show_scores (Quadrapassel* self, HistoryEntry* selected_entry, gboolean show_close);
GType score_dialog_get_type (void) G_GNUC_CONST;
ScoreDialog* score_dialog_new (History* history, HistoryEntry* selected_entry, gboolean show_close);
ScoreDialog* score_dialog_construct (GType object_type, History* history, HistoryEntry* selected_entry, gboolean show_close);
gint game_get_level (Game* self);
gint quadrapassel_main (gchar** args, int args_length1);
static void quadrapassel_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 QUADRAPASSEL_action_entries[7] = {{"new-game", _quadrapassel_new_game_cb_gsimple_action_activate_callback}, {"pause", _quadrapassel_pause_cb_gsimple_action_activate_callback}, {"scores", _quadrapassel_scores_cb_gsimple_action_activate_callback}, {"preferences", _quadrapassel_preferences_cb_gsimple_action_activate_callback}, {"help", _quadrapassel_help_cb_gsimple_action_activate_callback}, {"about", _quadrapassel_about_cb_gsimple_action_activate_callback}, {"quit", _quadrapassel_quit_cb_gsimple_action_activate_callback}};

static void _quadrapassel_new_game_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_new_game_cb ((Quadrapassel*) self);
}


static void _quadrapassel_pause_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_pause_cb ((Quadrapassel*) self);
}


static void _quadrapassel_scores_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_scores_cb ((Quadrapassel*) self);
}


static void _quadrapassel_preferences_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_preferences_cb ((Quadrapassel*) self);
}


static void _quadrapassel_help_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_help_cb ((Quadrapassel*) self);
}


static void _quadrapassel_about_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_about_cb ((Quadrapassel*) self);
}


static void _quadrapassel_quit_cb_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	quadrapassel_quit_cb ((Quadrapassel*) self);
}


Quadrapassel* quadrapassel_construct (GType object_type) {
	Quadrapassel * self = NULL;
	self = (Quadrapassel*) g_object_new (object_type, "application-id", "org.gnome.quadrapassel", "flags", G_APPLICATION_FLAGS_NONE, NULL);
	return self;
}


Quadrapassel* quadrapassel_new (void) {
	return quadrapassel_construct (TYPE_QUADRAPASSEL);
}


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


static gboolean _quadrapassel_window_configure_event_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self) {
	gboolean result;
	result = quadrapassel_window_configure_event_cb ((Quadrapassel*) self, event);
	return result;
}


static gboolean _quadrapassel_window_state_event_cb_gtk_widget_window_state_event (GtkWidget* _sender, GdkEventWindowState* event, gpointer self) {
	gboolean result;
	result = quadrapassel_window_state_event_cb ((Quadrapassel*) self, event);
	return result;
}


static gboolean _quadrapassel_key_press_event_cb_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = quadrapassel_key_press_event_cb ((Quadrapassel*) self, _sender, event);
	return result;
}


static gboolean _quadrapassel_key_release_event_cb_gtk_widget_key_release_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
	gboolean result;
	result = quadrapassel_key_release_event_cb ((Quadrapassel*) self, _sender, event);
	return result;
}


static void quadrapassel_real_startup (GApplication* base) {
	Quadrapassel * self;
	GtkSettings* _tmp0_ = NULL;
	GAction* _tmp1_ = NULL;
	GSimpleAction* _tmp2_ = NULL;
	GMenu* menu = NULL;
	GMenu* _tmp3_ = NULL;
	GMenu* section = NULL;
	GMenu* _tmp4_ = NULL;
	GMenu* _tmp5_ = NULL;
	GMenu* _tmp6_ = NULL;
	GMenu* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	GMenu* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	GMenu* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	GMenu* _tmp13_ = NULL;
	GMenu* _tmp14_ = NULL;
	GMenu* _tmp15_ = NULL;
	GMenu* _tmp16_ = NULL;
	const gchar* _tmp17_ = NULL;
	GMenu* _tmp18_ = NULL;
	const gchar* _tmp19_ = NULL;
	GMenu* _tmp20_ = NULL;
	const gchar* _tmp21_ = NULL;
	GMenu* _tmp22_ = NULL;
	GSettings* _tmp23_ = NULL;
	GtkApplicationWindow* _tmp24_ = NULL;
	GtkWindow* _tmp25_ = NULL;
	GtkWindow* _tmp26_ = NULL;
	GtkWindow* _tmp27_ = NULL;
	gint _tmp28_ = 0;
	GtkWindow* _tmp29_ = NULL;
	const gchar* _tmp30_ = NULL;
	GtkWindow* _tmp31_ = NULL;
	GtkWindow* _tmp32_ = NULL;
	GtkWindow* _tmp33_ = NULL;
	GtkWindow* _tmp34_ = NULL;
	GtkWindow* _tmp35_ = NULL;
	GSettings* _tmp36_ = NULL;
	gint _tmp37_ = 0;
	GSettings* _tmp38_ = NULL;
	gint _tmp39_ = 0;
	GSettings* _tmp40_ = NULL;
	gboolean _tmp41_ = FALSE;
	GtkHeaderBar* headerbar = NULL;
	GtkHeaderBar* _tmp43_ = NULL;
	GtkHeaderBar* _tmp44_ = NULL;
	GtkHeaderBar* _tmp45_ = NULL;
	const gchar* _tmp46_ = NULL;
	GtkHeaderBar* _tmp47_ = NULL;
	GtkWindow* _tmp48_ = NULL;
	GtkHeaderBar* _tmp49_ = NULL;
	GtkGrid* game_grid = NULL;
	GtkGrid* _tmp50_ = NULL;
	GtkGrid* _tmp51_ = NULL;
	GtkWindow* _tmp52_ = NULL;
	GtkGrid* _tmp53_ = NULL;
	GameView* _tmp54_ = NULL;
	GameView* _tmp55_ = NULL;
	GSettings* _tmp56_ = NULL;
	gchar* _tmp57_ = NULL;
	gchar* _tmp58_ = NULL;
	GameView* _tmp59_ = NULL;
	GSettings* _tmp60_ = NULL;
	gboolean _tmp61_ = FALSE;
	GameView* _tmp62_ = NULL;
	GSettings* _tmp63_ = NULL;
	gboolean _tmp64_ = FALSE;
	GameView* _tmp65_ = NULL;
	Game* _tmp66_ = NULL;
	Game* _tmp67_ = NULL;
	GameView* _tmp68_ = NULL;
	GtkGrid* _tmp69_ = NULL;
	GameView* _tmp70_ = NULL;
	gboolean rtl = FALSE;
	GtkTextDirection _tmp71_ = 0;
	GtkButton* _tmp72_ = NULL;
	const gchar* _tmp73_ = NULL;
	gboolean _tmp74_ = FALSE;
	GtkImage* _tmp75_ = NULL;
	GtkButton* _tmp76_ = NULL;
	GtkImage* _tmp77_ = NULL;
	GtkButton* _tmp78_ = NULL;
	GtkButton* _tmp79_ = NULL;
	const gchar* _tmp80_ = NULL;
	GtkButton* _tmp81_ = NULL;
	GtkImage* _tmp82_ = NULL;
	GtkButton* _tmp83_ = NULL;
	GtkAspectFrame* preview_frame = NULL;
	const gchar* _tmp84_ = NULL;
	GtkAspectFrame* _tmp85_ = NULL;
	Preview* _tmp86_ = NULL;
	Preview* _tmp87_ = NULL;
	GSettings* _tmp88_ = NULL;
	gchar* _tmp89_ = NULL;
	gchar* _tmp90_ = NULL;
	Preview* _tmp91_ = NULL;
	GSettings* _tmp92_ = NULL;
	gboolean _tmp93_ = FALSE;
	Preview* _tmp94_ = NULL;
	Preview* _tmp95_ = NULL;
	GtkGrid* _tmp96_ = NULL;
	GtkGrid* _tmp97_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp98_ = NULL;
	GtkLabel* _tmp99_ = NULL;
	GtkLabel* _tmp100_ = NULL;
	GtkLabel* _tmp101_ = NULL;
	GtkGrid* _tmp102_ = NULL;
	GtkLabel* _tmp103_ = NULL;
	GtkLabel* _tmp104_ = NULL;
	GtkLabel* _tmp105_ = NULL;
	GtkLabel* _tmp106_ = NULL;
	GtkLabel* _tmp107_ = NULL;
	GtkGrid* _tmp108_ = NULL;
	GtkLabel* _tmp109_ = NULL;
	const gchar* _tmp110_ = NULL;
	GtkLabel* _tmp111_ = NULL;
	GtkLabel* _tmp112_ = NULL;
	GtkLabel* _tmp113_ = NULL;
	GtkGrid* _tmp114_ = NULL;
	GtkLabel* _tmp115_ = NULL;
	GtkLabel* _tmp116_ = NULL;
	GtkLabel* _tmp117_ = NULL;
	GtkLabel* _tmp118_ = NULL;
	GtkLabel* _tmp119_ = NULL;
	GtkGrid* _tmp120_ = NULL;
	GtkLabel* _tmp121_ = NULL;
	const gchar* _tmp122_ = NULL;
	GtkLabel* _tmp123_ = NULL;
	GtkLabel* _tmp124_ = NULL;
	GtkLabel* _tmp125_ = NULL;
	GtkGrid* _tmp126_ = NULL;
	GtkLabel* _tmp127_ = NULL;
	GtkLabel* _tmp128_ = NULL;
	GtkLabel* _tmp129_ = NULL;
	GtkLabel* _tmp130_ = NULL;
	GtkLabel* _tmp131_ = NULL;
	GtkGrid* _tmp132_ = NULL;
	GtkLabel* _tmp133_ = NULL;
	GtkGrid* _tmp134_ = NULL;
	GtkButton* _tmp135_ = NULL;
	const gchar* _tmp136_ = NULL;
	gchar* _tmp137_ = NULL;
	gchar* _tmp138_ = NULL;
	History* _tmp139_ = NULL;
	History* _tmp140_ = NULL;
	GSimpleAction* _tmp141_ = NULL;
	self = (Quadrapassel*) base;
	G_APPLICATION_CLASS (quadrapassel_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), GtkApplication));
	_tmp0_ = gtk_settings_get_default ();
	g_object_set ((GObject*) _tmp0_, "gtk-application-prefer-dark-theme", TRUE, NULL);
	g_action_map_add_action_entries ((GActionMap*) self, QUADRAPASSEL_action_entries, G_N_ELEMENTS (QUADRAPASSEL_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_ = g_action_map_lookup_action ((GActionMap*) self, "pause");
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp1_) : NULL);
	_g_object_unref0 (self->priv->pause_action);
	self->priv->pause_action = _tmp2_;
	_tmp3_ = g_menu_new ();
	menu = _tmp3_;
	_tmp4_ = g_menu_new ();
	section = _tmp4_;
	_tmp5_ = menu;
	_tmp6_ = section;
	g_menu_append_section (_tmp5_, NULL, (GMenuModel*) _tmp6_);
	_tmp7_ = section;
	_tmp8_ = _ ("_New Game");
	g_menu_append (_tmp7_, _tmp8_, "app.new-game");
	_tmp9_ = section;
	_tmp10_ = _ ("_Scores");
	g_menu_append (_tmp9_, _tmp10_, "app.scores");
	_tmp11_ = section;
	_tmp12_ = _ ("_Preferences");
	g_menu_append (_tmp11_, _tmp12_, "app.preferences");
	_tmp13_ = g_menu_new ();
	_g_object_unref0 (section);
	section = _tmp13_;
	_tmp14_ = menu;
	_tmp15_ = section;
	g_menu_append_section (_tmp14_, NULL, (GMenuModel*) _tmp15_);
	_tmp16_ = section;
	_tmp17_ = _ ("_Help");
	g_menu_append (_tmp16_, _tmp17_, "app.help");
	_tmp18_ = section;
	_tmp19_ = _ ("_About");
	g_menu_append (_tmp18_, _tmp19_, "app.about");
	_tmp20_ = section;
	_tmp21_ = _ ("_Quit");
	g_menu_append (_tmp20_, _tmp21_, "app.quit");
	_tmp22_ = menu;
	gtk_application_set_app_menu ((GtkApplication*) self, (GMenuModel*) _tmp22_);
	_tmp23_ = g_settings_new ("org.gnome.quadrapassel");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp23_;
	_tmp24_ = (GtkApplicationWindow*) gtk_application_window_new ((GtkApplication*) self);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (self->priv->window);
	self->priv->window = (GtkWindow*) _tmp24_;
	_tmp25_ = self->priv->window;
	gtk_window_set_icon_name (_tmp25_, "quadrapassel");
	_tmp26_ = self->priv->window;
	_tmp27_ = self->priv->window;
	_tmp28_ = gtk_widget_get_events ((GtkWidget*) _tmp27_);
	gtk_widget_set_events ((GtkWidget*) _tmp26_, (_tmp28_ | GDK_KEY_PRESS_MASK) | GDK_KEY_RELEASE_MASK);
	_tmp29_ = self->priv->window;
	_tmp30_ = _ ("Quadrapassel");
	gtk_window_set_title (_tmp29_, _tmp30_);
	_tmp31_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp31_, "configure-event", (GCallback) _quadrapassel_window_configure_event_cb_gtk_widget_configure_event, self, 0);
	_tmp32_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp32_, "window-state-event", (GCallback) _quadrapassel_window_state_event_cb_gtk_widget_window_state_event, self, 0);
	_tmp33_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp33_, "key-press-event", (GCallback) _quadrapassel_key_press_event_cb_gtk_widget_key_press_event, self, 0);
	_tmp34_ = self->priv->window;
	g_signal_connect_object ((GtkWidget*) _tmp34_, "key-release-event", (GCallback) _quadrapassel_key_release_event_cb_gtk_widget_key_release_event, self, 0);
	_tmp35_ = self->priv->window;
	_tmp36_ = self->priv->settings;
	_tmp37_ = g_settings_get_int (_tmp36_, "window-width");
	_tmp38_ = self->priv->settings;
	_tmp39_ = g_settings_get_int (_tmp38_, "window-height");
	gtk_window_set_default_size (_tmp35_, _tmp37_, _tmp39_);
	_tmp40_ = self->priv->settings;
	_tmp41_ = g_settings_get_boolean (_tmp40_, "window-is-maximized");
	if (_tmp41_) {
		GtkWindow* _tmp42_ = NULL;
		_tmp42_ = self->priv->window;
		gtk_window_maximize (_tmp42_);
	}
	_tmp43_ = (GtkHeaderBar*) gtk_header_bar_new ();
	g_object_ref_sink (_tmp43_);
	headerbar = _tmp43_;
	_tmp44_ = headerbar;
	gtk_header_bar_set_show_close_button (_tmp44_, TRUE);
	_tmp45_ = headerbar;
	_tmp46_ = _ ("Quadrapassel");
	gtk_header_bar_set_title (_tmp45_, _tmp46_);
	_tmp47_ = headerbar;
	gtk_widget_show ((GtkWidget*) _tmp47_);
	_tmp48_ = self->priv->window;
	_tmp49_ = headerbar;
	gtk_window_set_titlebar (_tmp48_, (GtkWidget*) _tmp49_);
	_tmp50_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp50_);
	game_grid = _tmp50_;
	_tmp51_ = game_grid;
	gtk_grid_set_column_homogeneous (_tmp51_, TRUE);
	_tmp52_ = self->priv->window;
	_tmp53_ = game_grid;
	gtk_container_add ((GtkContainer*) _tmp52_, (GtkWidget*) _tmp53_);
	_tmp54_ = game_view_new ();
	g_object_ref_sink (_tmp54_);
	_g_object_unref0 (self->priv->view);
	self->priv->view = _tmp54_;
	_tmp55_ = self->priv->view;
	_tmp56_ = self->priv->settings;
	_tmp57_ = g_settings_get_string (_tmp56_, "theme");
	_tmp58_ = _tmp57_;
	game_view_set_theme (_tmp55_, _tmp58_);
	_g_free0 (_tmp58_);
	_tmp59_ = self->priv->view;
	_tmp60_ = self->priv->settings;
	_tmp61_ = g_settings_get_boolean (_tmp60_, "sound");
	_tmp59_->mute = !_tmp61_;
	_tmp62_ = self->priv->view;
	_tmp63_ = self->priv->settings;
	_tmp64_ = g_settings_get_boolean (_tmp63_, "show-shadow");
	game_view_set_show_shadow (_tmp62_, _tmp64_);
	_tmp65_ = self->priv->view;
	_tmp66_ = game_new (20, 14, 1, 20, 10, FALSE);
	_tmp67_ = _tmp66_;
	game_view_set_game (_tmp65_, _tmp67_);
	_g_object_unref0 (_tmp67_);
	_tmp68_ = self->priv->view;
	gtk_widget_show ((GtkWidget*) _tmp68_);
	_tmp69_ = game_grid;
	_tmp70_ = self->priv->view;
	gtk_grid_attach (_tmp69_, (GtkWidget*) _tmp70_, 0, 0, 2, 18);
	_tmp71_ = gtk_widget_get_default_direction ();
	rtl = _tmp71_ == GTK_TEXT_DIR_RTL;
	_tmp72_ = (GtkButton*) gtk_button_new ();
	g_object_ref_sink (_tmp72_);
	_g_object_unref0 (self->priv->pause_play_button);
	self->priv->pause_play_button = _tmp72_;
	_tmp74_ = rtl;
	if (_tmp74_) {
		_tmp73_ = "media-playback-start-rtl-symbolic";
	} else {
		_tmp73_ = "media-playback-start-symbolic";
	}
	_tmp75_ = (GtkImage*) gtk_image_new_from_icon_name (_tmp73_, GTK_ICON_SIZE_DIALOG);
	g_object_ref_sink (_tmp75_);
	_g_object_unref0 (self->priv->pause_play_button_image);
	self->priv->pause_play_button_image = _tmp75_;
	_tmp76_ = self->priv->pause_play_button;
	_tmp77_ = self->priv->pause_play_button_image;
	gtk_container_add ((GtkContainer*) _tmp76_, (GtkWidget*) _tmp77_);
	_tmp78_ = self->priv->pause_play_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp78_, "app.new-game");
	_tmp79_ = self->priv->pause_play_button;
	_tmp80_ = _ ("Start a new game");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp79_, _tmp80_);
	_tmp81_ = self->priv->pause_play_button;
	g_object_set ((GtkWidget*) _tmp81_, "margin", 30, NULL);
	_tmp82_ = self->priv->pause_play_button_image;
	gtk_widget_show ((GtkWidget*) _tmp82_);
	_tmp83_ = self->priv->pause_play_button;
	gtk_widget_show ((GtkWidget*) _tmp83_);
	_tmp84_ = _ ("Next");
	_tmp85_ = (GtkAspectFrame*) gtk_aspect_frame_new (_tmp84_, 0.5f, 0.5f, 1.0f, FALSE);
	g_object_ref_sink (_tmp85_);
	preview_frame = _tmp85_;
	gtk_frame_set_label_align ((GtkFrame*) preview_frame, 0.5f, 1.0f);
	_tmp86_ = preview_new ((GtkFrame*) preview_frame);
	g_object_ref_sink (_tmp86_);
	_g_object_unref0 (self->priv->preview);
	self->priv->preview = _tmp86_;
	_tmp87_ = self->priv->preview;
	_tmp88_ = self->priv->settings;
	_tmp89_ = g_settings_get_string (_tmp88_, "theme");
	_tmp90_ = _tmp89_;
	preview_set_theme (_tmp87_, _tmp90_);
	_g_free0 (_tmp90_);
	_tmp91_ = self->priv->preview;
	_tmp92_ = self->priv->settings;
	_tmp93_ = g_settings_get_boolean (_tmp92_, "do-preview");
	preview_set_enabled (_tmp91_, _tmp93_);
	_tmp94_ = self->priv->preview;
	gtk_container_add ((GtkContainer*) preview_frame, (GtkWidget*) _tmp94_);
	gtk_widget_show ((GtkWidget*) preview_frame);
	_tmp95_ = self->priv->preview;
	gtk_widget_show ((GtkWidget*) _tmp95_);
	_tmp96_ = game_grid;
	gtk_grid_attach (_tmp96_, (GtkWidget*) preview_frame, 2, 1, 1, 3);
	_tmp97_ = game_grid;
	gtk_widget_show ((GtkWidget*) _tmp97_);
	_tmp98_ = _ ("Score");
	_tmp99_ = (GtkLabel*) gtk_label_new (_tmp98_);
	g_object_ref_sink (_tmp99_);
	label = _tmp99_;
	_tmp100_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp100_, 0.5f, 0.5f);
	_tmp101_ = label;
	gtk_widget_show ((GtkWidget*) _tmp101_);
	_tmp102_ = game_grid;
	_tmp103_ = label;
	gtk_grid_attach (_tmp102_, (GtkWidget*) _tmp103_, 2, 5, 1, 1);
	_tmp104_ = (GtkLabel*) gtk_label_new ("<big>-</big>");
	g_object_ref_sink (_tmp104_);
	_g_object_unref0 (self->priv->score_label);
	self->priv->score_label = _tmp104_;
	_tmp105_ = self->priv->score_label;
	gtk_label_set_use_markup (_tmp105_, TRUE);
	_tmp106_ = self->priv->score_label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp106_, 0.5f, 0.0f);
	_tmp107_ = self->priv->score_label;
	gtk_widget_show ((GtkWidget*) _tmp107_);
	_tmp108_ = game_grid;
	_tmp109_ = self->priv->score_label;
	gtk_grid_attach (_tmp108_, (GtkWidget*) _tmp109_, 2, 6, 1, 2);
	_tmp110_ = _ ("Lines");
	_tmp111_ = (GtkLabel*) gtk_label_new (_tmp110_);
	g_object_ref_sink (_tmp111_);
	_g_object_unref0 (label);
	label = _tmp111_;
	_tmp112_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp112_, 0.5f, 0.5f);
	_tmp113_ = label;
	gtk_widget_show ((GtkWidget*) _tmp113_);
	_tmp114_ = game_grid;
	_tmp115_ = label;
	gtk_grid_attach (_tmp114_, (GtkWidget*) _tmp115_, 2, 9, 1, 1);
	_tmp116_ = (GtkLabel*) gtk_label_new ("<big>-</big>");
	g_object_ref_sink (_tmp116_);
	_g_object_unref0 (self->priv->n_destroyed_label);
	self->priv->n_destroyed_label = _tmp116_;
	_tmp117_ = self->priv->n_destroyed_label;
	gtk_label_set_use_markup (_tmp117_, TRUE);
	_tmp118_ = self->priv->n_destroyed_label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp118_, 0.5f, 0.0f);
	_tmp119_ = self->priv->n_destroyed_label;
	gtk_widget_show ((GtkWidget*) _tmp119_);
	_tmp120_ = game_grid;
	_tmp121_ = self->priv->n_destroyed_label;
	gtk_grid_attach (_tmp120_, (GtkWidget*) _tmp121_, 2, 10, 1, 2);
	_tmp122_ = _ ("Level");
	_tmp123_ = (GtkLabel*) gtk_label_new (_tmp122_);
	g_object_ref_sink (_tmp123_);
	_g_object_unref0 (label);
	label = _tmp123_;
	_tmp124_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp124_, 0.5f, 0.5f);
	_tmp125_ = label;
	gtk_widget_show ((GtkWidget*) _tmp125_);
	_tmp126_ = game_grid;
	_tmp127_ = label;
	gtk_grid_attach (_tmp126_, (GtkWidget*) _tmp127_, 2, 13, 1, 1);
	_tmp128_ = (GtkLabel*) gtk_label_new ("<big>-</big>");
	g_object_ref_sink (_tmp128_);
	_g_object_unref0 (self->priv->level_label);
	self->priv->level_label = _tmp128_;
	_tmp129_ = self->priv->level_label;
	gtk_label_set_use_markup (_tmp129_, TRUE);
	_tmp130_ = self->priv->level_label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp130_, 0.5f, 0.0f);
	_tmp131_ = self->priv->level_label;
	gtk_widget_show ((GtkWidget*) _tmp131_);
	_tmp132_ = game_grid;
	_tmp133_ = self->priv->level_label;
	gtk_grid_attach (_tmp132_, (GtkWidget*) _tmp133_, 2, 14, 1, 2);
	_tmp134_ = game_grid;
	_tmp135_ = self->priv->pause_play_button;
	gtk_grid_attach (_tmp134_, (GtkWidget*) _tmp135_, 2, 16, 1, 2);
	_tmp136_ = g_get_user_data_dir ();
	_tmp137_ = g_build_filename (_tmp136_, "quadrapassel", "history", NULL);
	_tmp138_ = _tmp137_;
	_tmp139_ = history_new (_tmp138_);
	_g_object_unref0 (self->priv->history);
	self->priv->history = _tmp139_;
	_g_free0 (_tmp138_);
	_tmp140_ = self->priv->history;
	history_load (_tmp140_);
	_tmp141_ = self->priv->pause_action;
	g_simple_action_set_enabled (_tmp141_, FALSE);
	_g_object_unref0 (label);
	_g_object_unref0 (preview_frame);
	_g_object_unref0 (game_grid);
	_g_object_unref0 (headerbar);
	_g_object_unref0 (section);
	_g_object_unref0 (menu);
}


static gboolean quadrapassel_window_configure_event_cb (Quadrapassel* self, GdkEventConfigure* event) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = self->priv->is_maximized;
	if (!_tmp0_) {
		GdkEventConfigure* _tmp1_ = NULL;
		gint _tmp2_ = 0;
		GdkEventConfigure* _tmp3_ = NULL;
		gint _tmp4_ = 0;
		_tmp1_ = event;
		_tmp2_ = _tmp1_->width;
		self->priv->window_width = _tmp2_;
		_tmp3_ = event;
		_tmp4_ = _tmp3_->height;
		self->priv->window_height = _tmp4_;
	}
	result = FALSE;
	return result;
}


static gboolean quadrapassel_window_state_event_cb (Quadrapassel* self, GdkEventWindowState* event) {
	gboolean result = FALSE;
	GdkEventWindowState* _tmp0_ = NULL;
	GdkWindowState _tmp1_ = 0;
	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_ = NULL;
		GdkWindowState _tmp3_ = 0;
		_tmp2_ = event;
		_tmp3_ = _tmp2_->new_window_state;
		self->priv->is_maximized = (_tmp3_ & GDK_WINDOW_STATE_MAXIMIZED) != 0;
	}
	result = FALSE;
	return result;
}


static void quadrapassel_real_shutdown (GApplication* base) {
	Quadrapassel * self;
	GSettings* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GSettings* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	GSettings* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	Game* _tmp7_ = NULL;
	self = (Quadrapassel*) base;
	G_APPLICATION_CLASS (quadrapassel_parent_class)->shutdown ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), 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_);
	_tmp7_ = self->priv->game;
	if (_tmp7_ != NULL) {
		Game* _tmp8_ = NULL;
		gint _tmp9_ = 0;
		_tmp8_ = self->priv->game;
		_tmp9_ = _tmp8_->score;
		_tmp6_ = _tmp9_ > 0;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		GDateTime* date = NULL;
		GDateTime* _tmp10_ = NULL;
		HistoryEntry* entry = NULL;
		GDateTime* _tmp11_ = NULL;
		Game* _tmp12_ = NULL;
		gint _tmp13_ = 0;
		HistoryEntry* _tmp14_ = NULL;
		History* _tmp15_ = NULL;
		HistoryEntry* _tmp16_ = NULL;
		History* _tmp17_ = NULL;
		_tmp10_ = g_date_time_new_now_local ();
		date = _tmp10_;
		_tmp11_ = date;
		_tmp12_ = self->priv->game;
		_tmp13_ = _tmp12_->score;
		_tmp14_ = history_entry_new (_tmp11_, _tmp13_);
		entry = _tmp14_;
		_tmp15_ = self->priv->history;
		_tmp16_ = entry;
		history_add (_tmp15_, _tmp16_);
		_tmp17_ = self->priv->history;
		history_save (_tmp17_);
		_g_object_unref0 (entry);
		_g_date_time_unref0 (date);
	}
}


static void quadrapassel_real_activate (GApplication* base) {
	Quadrapassel * self;
	GtkWindow* _tmp0_ = NULL;
	self = (Quadrapassel*) base;
	_tmp0_ = self->priv->window;
	gtk_window_present (_tmp0_);
}


static void quadrapassel_preferences_dialog_close_cb (Quadrapassel* self) {
	GtkDialog* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->preferences_dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
	_g_object_unref0 (self->priv->preferences_dialog);
	self->priv->preferences_dialog = NULL;
}


static void quadrapassel_preferences_dialog_response_cb (Quadrapassel* self, gint response_id) {
	g_return_if_fail (self != NULL);
	quadrapassel_preferences_dialog_close_cb (self);
}


static void _quadrapassel_preferences_dialog_close_cb_gtk_dialog_close (GtkDialog* _sender, gpointer self) {
	quadrapassel_preferences_dialog_close_cb ((Quadrapassel*) self);
}


static void _quadrapassel_preferences_dialog_response_cb_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	quadrapassel_preferences_dialog_response_cb ((Quadrapassel*) self, response_id);
}


static void _quadrapassel_fill_height_spinner_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
	quadrapassel_fill_height_spinner_value_changed_cb ((Quadrapassel*) self, _sender);
}


static void _quadrapassel_fill_prob_spinner_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
	quadrapassel_fill_prob_spinner_value_changed_cb ((Quadrapassel*) self, _sender);
}


static void _quadrapassel_starting_level_value_changed_cb_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
	quadrapassel_starting_level_value_changed_cb ((Quadrapassel*) self, _sender);
}


static void _quadrapassel_sound_toggle_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	quadrapassel_sound_toggle_toggled_cb ((Quadrapassel*) self);
}


static void _quadrapassel_difficult_blocks_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	quadrapassel_difficult_blocks_toggled_cb ((Quadrapassel*) self);
}


static void _quadrapassel_do_preview_toggle_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	quadrapassel_do_preview_toggle_toggled_cb ((Quadrapassel*) self);
}


static void _quadrapassel_set_rotate_counter_clock_wise_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	quadrapassel_set_rotate_counter_clock_wise ((Quadrapassel*) self);
}


static void _quadrapassel_user_target_toggled_cb_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	quadrapassel_user_target_toggled_cb ((Quadrapassel*) self);
}


static void _quadrapassel_accel_edited_cb_gtk_cell_renderer_accel_accel_edited (GtkCellRendererAccel* _sender, const gchar* path_string, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, gpointer self) {
	quadrapassel_accel_edited_cb ((Quadrapassel*) self, _sender, path_string, accel_key, accel_mods, hardware_keycode);
}


static void _quadrapassel_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared (GtkCellRendererAccel* _sender, const gchar* path_string, gpointer self) {
	quadrapassel_accel_cleared_cb ((Quadrapassel*) self, _sender, path_string);
}


static void _quadrapassel_theme_combo_changed_cb_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
	quadrapassel_theme_combo_changed_cb ((Quadrapassel*) self, _sender);
}


static void quadrapassel_preferences_cb (Quadrapassel* self) {
	GtkDialog* _tmp0_ = NULL;
	const gchar* _tmp2_ = NULL;
	GtkWindow* _tmp3_ = NULL;
	GtkDialog* _tmp4_ = NULL;
	GtkDialog* _tmp5_ = NULL;
	GtkBox* vbox = NULL;
	GtkDialog* _tmp6_ = NULL;
	GtkBox* _tmp7_ = NULL;
	GtkBox* _tmp8_ = NULL;
	GtkBox* _tmp9_ = NULL;
	GtkDialog* _tmp10_ = NULL;
	GtkDialog* _tmp11_ = NULL;
	GtkNotebook* notebook = NULL;
	GtkNotebook* _tmp12_ = NULL;
	GtkNotebook* _tmp13_ = NULL;
	GtkBox* _tmp14_ = NULL;
	GtkNotebook* _tmp15_ = NULL;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp16_ = NULL;
	GtkGrid* _tmp17_ = NULL;
	GtkGrid* _tmp18_ = NULL;
	GtkGrid* _tmp19_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp20_ = NULL;
	GtkLabel* _tmp21_ = NULL;
	GtkNotebook* _tmp22_ = NULL;
	GtkGrid* _tmp23_ = NULL;
	GtkLabel* _tmp24_ = NULL;
	const gchar* _tmp25_ = NULL;
	GtkLabel* _tmp26_ = NULL;
	GtkLabel* _tmp27_ = NULL;
	GtkLabel* _tmp28_ = NULL;
	GtkGrid* _tmp29_ = NULL;
	GtkLabel* _tmp30_ = NULL;
	GtkAdjustment* adj = NULL;
	GSettings* _tmp31_ = NULL;
	gint _tmp32_ = 0;
	GtkAdjustment* _tmp33_ = NULL;
	GtkAdjustment* _tmp34_ = NULL;
	GtkSpinButton* _tmp35_ = NULL;
	GtkSpinButton* _tmp36_ = NULL;
	GtkSpinButton* _tmp37_ = NULL;
	GtkSpinButton* _tmp38_ = NULL;
	GtkGrid* _tmp39_ = NULL;
	GtkSpinButton* _tmp40_ = NULL;
	GtkLabel* _tmp41_ = NULL;
	GtkSpinButton* _tmp42_ = NULL;
	const gchar* _tmp43_ = NULL;
	GtkLabel* _tmp44_ = NULL;
	GtkLabel* _tmp45_ = NULL;
	GtkLabel* _tmp46_ = NULL;
	GtkGrid* _tmp47_ = NULL;
	GtkLabel* _tmp48_ = NULL;
	GSettings* _tmp49_ = NULL;
	gint _tmp50_ = 0;
	GtkAdjustment* _tmp51_ = NULL;
	GtkAdjustment* _tmp52_ = NULL;
	GtkSpinButton* _tmp53_ = NULL;
	GtkSpinButton* _tmp54_ = NULL;
	GtkSpinButton* _tmp55_ = NULL;
	GtkSpinButton* _tmp56_ = NULL;
	GtkGrid* _tmp57_ = NULL;
	GtkSpinButton* _tmp58_ = NULL;
	GtkLabel* _tmp59_ = NULL;
	GtkSpinButton* _tmp60_ = NULL;
	const gchar* _tmp61_ = NULL;
	GtkLabel* _tmp62_ = NULL;
	GtkLabel* _tmp63_ = NULL;
	GtkLabel* _tmp64_ = NULL;
	GtkGrid* _tmp65_ = NULL;
	GtkLabel* _tmp66_ = NULL;
	GSettings* _tmp67_ = NULL;
	gint _tmp68_ = 0;
	GtkAdjustment* _tmp69_ = NULL;
	GtkAdjustment* _tmp70_ = NULL;
	GtkSpinButton* _tmp71_ = NULL;
	GtkSpinButton* _tmp72_ = NULL;
	GtkSpinButton* _tmp73_ = NULL;
	GtkSpinButton* _tmp74_ = NULL;
	GtkGrid* _tmp75_ = NULL;
	GtkSpinButton* _tmp76_ = NULL;
	GtkLabel* _tmp77_ = NULL;
	GtkSpinButton* _tmp78_ = NULL;
	const gchar* _tmp79_ = NULL;
	GtkCheckButton* _tmp80_ = NULL;
	GtkCheckButton* _tmp81_ = NULL;
	GSettings* _tmp82_ = NULL;
	gboolean _tmp83_ = FALSE;
	GtkCheckButton* _tmp84_ = NULL;
	GtkGrid* _tmp85_ = NULL;
	GtkCheckButton* _tmp86_ = NULL;
	const gchar* _tmp87_ = NULL;
	GtkCheckButton* _tmp88_ = NULL;
	GtkCheckButton* _tmp89_ = NULL;
	GSettings* _tmp90_ = NULL;
	gboolean _tmp91_ = FALSE;
	GtkCheckButton* _tmp92_ = NULL;
	GtkGrid* _tmp93_ = NULL;
	GtkCheckButton* _tmp94_ = NULL;
	const gchar* _tmp95_ = NULL;
	GtkCheckButton* _tmp96_ = NULL;
	GtkCheckButton* _tmp97_ = NULL;
	GSettings* _tmp98_ = NULL;
	gboolean _tmp99_ = FALSE;
	GtkCheckButton* _tmp100_ = NULL;
	GSettings* _tmp101_ = NULL;
	gboolean _tmp102_ = FALSE;
	GtkCheckButton* _tmp103_ = NULL;
	GtkGrid* _tmp104_ = NULL;
	GtkCheckButton* _tmp105_ = NULL;
	const gchar* _tmp106_ = NULL;
	GtkCheckButton* _tmp107_ = NULL;
	GtkCheckButton* _tmp108_ = NULL;
	GSettings* _tmp109_ = NULL;
	gboolean _tmp110_ = FALSE;
	GtkCheckButton* _tmp111_ = NULL;
	GtkGrid* _tmp112_ = NULL;
	GtkCheckButton* _tmp113_ = NULL;
	const gchar* _tmp114_ = NULL;
	GtkCheckButton* _tmp115_ = NULL;
	GtkCheckButton* _tmp116_ = NULL;
	GSettings* _tmp117_ = NULL;
	gboolean _tmp118_ = FALSE;
	GtkCheckButton* _tmp119_ = NULL;
	GtkGrid* _tmp120_ = NULL;
	GtkCheckButton* _tmp121_ = NULL;
	GtkListStore* _tmp122_ = NULL;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp123_ = NULL;
	GtkTreeIter _tmp124_ = {0};
	gint keyval = 0;
	GSettings* _tmp125_ = NULL;
	gint _tmp126_ = 0;
	GtkListStore* _tmp127_ = NULL;
	GtkTreeIter _tmp128_ = {0};
	const gchar* _tmp129_ = NULL;
	gint _tmp130_ = 0;
	GtkListStore* _tmp131_ = NULL;
	GtkTreeIter _tmp132_ = {0};
	GSettings* _tmp133_ = NULL;
	gint _tmp134_ = 0;
	GtkListStore* _tmp135_ = NULL;
	GtkTreeIter _tmp136_ = {0};
	const gchar* _tmp137_ = NULL;
	gint _tmp138_ = 0;
	GtkListStore* _tmp139_ = NULL;
	GtkTreeIter _tmp140_ = {0};
	GSettings* _tmp141_ = NULL;
	gint _tmp142_ = 0;
	GtkListStore* _tmp143_ = NULL;
	GtkTreeIter _tmp144_ = {0};
	const gchar* _tmp145_ = NULL;
	gint _tmp146_ = 0;
	GtkListStore* _tmp147_ = NULL;
	GtkTreeIter _tmp148_ = {0};
	GSettings* _tmp149_ = NULL;
	gint _tmp150_ = 0;
	GtkListStore* _tmp151_ = NULL;
	GtkTreeIter _tmp152_ = {0};
	const gchar* _tmp153_ = NULL;
	gint _tmp154_ = 0;
	GtkListStore* _tmp155_ = NULL;
	GtkTreeIter _tmp156_ = {0};
	GSettings* _tmp157_ = NULL;
	gint _tmp158_ = 0;
	GtkListStore* _tmp159_ = NULL;
	GtkTreeIter _tmp160_ = {0};
	const gchar* _tmp161_ = NULL;
	gint _tmp162_ = 0;
	GtkListStore* _tmp163_ = NULL;
	GtkTreeIter _tmp164_ = {0};
	GSettings* _tmp165_ = NULL;
	gint _tmp166_ = 0;
	GtkListStore* _tmp167_ = NULL;
	GtkTreeIter _tmp168_ = {0};
	const gchar* _tmp169_ = NULL;
	gint _tmp170_ = 0;
	GtkTreeView* controls_view = NULL;
	GtkListStore* _tmp171_ = NULL;
	GtkTreeView* _tmp172_ = NULL;
	GtkTreeView* _tmp173_ = NULL;
	GtkTreeView* _tmp174_ = NULL;
	GtkCellRendererText* label_renderer = NULL;
	GtkCellRendererText* _tmp175_ = NULL;
	GtkTreeView* _tmp176_ = NULL;
	GtkCellRendererText* _tmp177_ = NULL;
	GtkCellRendererAccel* key_renderer = NULL;
	GtkCellRendererAccel* _tmp178_ = NULL;
	GtkCellRendererAccel* _tmp179_ = NULL;
	GtkCellRendererAccel* _tmp180_ = NULL;
	GtkCellRendererAccel* _tmp181_ = NULL;
	GtkCellRendererAccel* _tmp182_ = NULL;
	GtkTreeView* _tmp183_ = NULL;
	GtkCellRendererAccel* _tmp184_ = NULL;
	GtkScrolledWindow* controls_list = NULL;
	GtkScrolledWindow* _tmp185_ = NULL;
	GtkScrolledWindow* _tmp186_ = NULL;
	GtkScrolledWindow* _tmp187_ = NULL;
	GtkScrolledWindow* _tmp188_ = NULL;
	GtkScrolledWindow* _tmp189_ = NULL;
	GtkScrolledWindow* _tmp190_ = NULL;
	GtkTreeView* _tmp191_ = NULL;
	const gchar* _tmp192_ = NULL;
	GtkLabel* _tmp193_ = NULL;
	GtkNotebook* _tmp194_ = NULL;
	GtkScrolledWindow* _tmp195_ = NULL;
	GtkLabel* _tmp196_ = NULL;
	GtkBox* _tmp197_ = NULL;
	GtkBox* _tmp198_ = NULL;
	const gchar* _tmp199_ = NULL;
	GtkLabel* _tmp200_ = NULL;
	GtkNotebook* _tmp201_ = NULL;
	GtkBox* _tmp202_ = NULL;
	GtkLabel* _tmp203_ = NULL;
	GtkComboBox* theme_combo = NULL;
	GtkComboBox* _tmp204_ = NULL;
	GtkBox* _tmp205_ = NULL;
	GtkComboBox* _tmp206_ = NULL;
	GtkListStore* theme_store = NULL;
	GtkListStore* _tmp207_ = NULL;
	GtkComboBox* _tmp208_ = NULL;
	GtkListStore* _tmp209_ = NULL;
	GtkCellRendererText* renderer = NULL;
	GtkCellRendererText* _tmp210_ = NULL;
	GtkComboBox* _tmp211_ = NULL;
	GtkCellRendererText* _tmp212_ = NULL;
	GtkComboBox* _tmp213_ = NULL;
	GtkCellRendererText* _tmp214_ = NULL;
	GtkListStore* _tmp215_ = NULL;
	GtkTreeIter _tmp216_ = {0};
	GtkListStore* _tmp217_ = NULL;
	GtkTreeIter _tmp218_ = {0};
	const gchar* _tmp219_ = NULL;
	GSettings* _tmp220_ = NULL;
	gchar* _tmp221_ = NULL;
	gchar* _tmp222_ = NULL;
	gboolean _tmp223_ = FALSE;
	GtkListStore* _tmp226_ = NULL;
	GtkTreeIter _tmp227_ = {0};
	GtkListStore* _tmp228_ = NULL;
	GtkTreeIter _tmp229_ = {0};
	const gchar* _tmp230_ = NULL;
	GSettings* _tmp231_ = NULL;
	gchar* _tmp232_ = NULL;
	gchar* _tmp233_ = NULL;
	gboolean _tmp234_ = FALSE;
	GtkListStore* _tmp237_ = NULL;
	GtkTreeIter _tmp238_ = {0};
	GtkListStore* _tmp239_ = NULL;
	GtkTreeIter _tmp240_ = {0};
	const gchar* _tmp241_ = NULL;
	GSettings* _tmp242_ = NULL;
	gchar* _tmp243_ = NULL;
	gchar* _tmp244_ = NULL;
	gboolean _tmp245_ = FALSE;
	GtkListStore* _tmp248_ = NULL;
	GtkTreeIter _tmp249_ = {0};
	GtkListStore* _tmp250_ = NULL;
	GtkTreeIter _tmp251_ = {0};
	const gchar* _tmp252_ = NULL;
	GSettings* _tmp253_ = NULL;
	gchar* _tmp254_ = NULL;
	gchar* _tmp255_ = NULL;
	gboolean _tmp256_ = FALSE;
	GtkComboBox* _tmp259_ = NULL;
	Preview* _tmp260_ = NULL;
	Preview* _tmp261_ = NULL;
	Game* _tmp262_ = NULL;
	Game* _tmp263_ = NULL;
	Preview* _tmp264_ = NULL;
	GSettings* _tmp265_ = NULL;
	gchar* _tmp266_ = NULL;
	gchar* _tmp267_ = NULL;
	GtkBox* _tmp268_ = NULL;
	Preview* _tmp269_ = NULL;
	GtkDialog* _tmp270_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->preferences_dialog;
	if (_tmp0_ != NULL) {
		GtkDialog* _tmp1_ = NULL;
		_tmp1_ = self->priv->preferences_dialog;
		gtk_window_present ((GtkWindow*) _tmp1_);
		return;
	}
	_tmp2_ = _ ("Preferences");
	_tmp3_ = self->priv->window;
	_tmp4_ = (GtkDialog*) gtk_dialog_new_with_buttons (_tmp2_, _tmp3_, GTK_DIALOG_USE_HEADER_BAR, NULL, NULL);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->preferences_dialog);
	self->priv->preferences_dialog = _tmp4_;
	_tmp5_ = self->priv->preferences_dialog;
	gtk_container_set_border_width ((GtkContainer*) _tmp5_, (guint) 5);
	_tmp6_ = self->priv->preferences_dialog;
	_tmp7_ = (GtkBox*) gtk_dialog_get_content_area (_tmp6_);
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_box_get_type (), GtkBox));
	vbox = _tmp8_;
	_tmp9_ = vbox;
	gtk_box_set_spacing (_tmp9_, 2);
	_tmp10_ = self->priv->preferences_dialog;
	g_signal_connect_object (_tmp10_, "close", (GCallback) _quadrapassel_preferences_dialog_close_cb_gtk_dialog_close, self, 0);
	_tmp11_ = self->priv->preferences_dialog;
	g_signal_connect_object (_tmp11_, "response", (GCallback) _quadrapassel_preferences_dialog_response_cb_gtk_dialog_response, self, 0);
	_tmp12_ = (GtkNotebook*) gtk_notebook_new ();
	g_object_ref_sink (_tmp12_);
	notebook = _tmp12_;
	_tmp13_ = notebook;
	gtk_container_set_border_width ((GtkContainer*) _tmp13_, (guint) 5);
	_tmp14_ = vbox;
	_tmp15_ = notebook;
	gtk_box_pack_start (_tmp14_, (GtkWidget*) _tmp15_, TRUE, TRUE, (guint) 0);
	_tmp16_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp16_);
	grid = _tmp16_;
	_tmp17_ = grid;
	gtk_grid_set_row_spacing (_tmp17_, (guint) 6);
	_tmp18_ = grid;
	gtk_grid_set_column_spacing (_tmp18_, (guint) 12);
	_tmp19_ = grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp19_, (guint) 12);
	_tmp20_ = _ ("Game");
	_tmp21_ = (GtkLabel*) gtk_label_new (_tmp20_);
	g_object_ref_sink (_tmp21_);
	label = _tmp21_;
	_tmp22_ = notebook;
	_tmp23_ = grid;
	_tmp24_ = label;
	gtk_notebook_append_page (_tmp22_, (GtkWidget*) _tmp23_, (GtkWidget*) _tmp24_);
	_tmp25_ = _ ("_Number of pre-filled rows:");
	_tmp26_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp25_);
	g_object_ref_sink (_tmp26_);
	_g_object_unref0 (label);
	label = _tmp26_;
	_tmp27_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp27_, (gfloat) 0, 0.5f);
	_tmp28_ = label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp28_, TRUE);
	_tmp29_ = grid;
	_tmp30_ = label;
	gtk_grid_attach (_tmp29_, (GtkWidget*) _tmp30_, 0, 0, 1, 1);
	_tmp31_ = self->priv->settings;
	_tmp32_ = g_settings_get_int (_tmp31_, "line-fill-height");
	_tmp33_ = gtk_adjustment_new ((gdouble) _tmp32_, (gdouble) 0, (gdouble) 15, (gdouble) 1, (gdouble) 5, (gdouble) 0);
	g_object_ref_sink (_tmp33_);
	adj = _tmp33_;
	_tmp34_ = adj;
	_tmp35_ = (GtkSpinButton*) gtk_spin_button_new (_tmp34_, (gdouble) 10, (guint) 0);
	g_object_ref_sink (_tmp35_);
	_g_object_unref0 (self->priv->fill_height_spinner);
	self->priv->fill_height_spinner = _tmp35_;
	_tmp36_ = self->priv->fill_height_spinner;
	gtk_spin_button_set_update_policy (_tmp36_, GTK_UPDATE_ALWAYS);
	_tmp37_ = self->priv->fill_height_spinner;
	gtk_spin_button_set_snap_to_ticks (_tmp37_, TRUE);
	_tmp38_ = self->priv->fill_height_spinner;
	g_signal_connect_object (_tmp38_, "value-changed", (GCallback) _quadrapassel_fill_height_spinner_value_changed_cb_gtk_spin_button_value_changed, self, 0);
	_tmp39_ = grid;
	_tmp40_ = self->priv->fill_height_spinner;
	gtk_grid_attach (_tmp39_, (GtkWidget*) _tmp40_, 1, 0, 1, 1);
	_tmp41_ = label;
	_tmp42_ = self->priv->fill_height_spinner;
	gtk_label_set_mnemonic_widget (_tmp41_, (GtkWidget*) _tmp42_);
	_tmp43_ = _ ("_Density of blocks in a pre-filled row:");
	_tmp44_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp43_);
	g_object_ref_sink (_tmp44_);
	_g_object_unref0 (label);
	label = _tmp44_;
	_tmp45_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp45_, (gfloat) 0, 0.5f);
	_tmp46_ = label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp46_, TRUE);
	_tmp47_ = grid;
	_tmp48_ = label;
	gtk_grid_attach (_tmp47_, (GtkWidget*) _tmp48_, 0, 1, 1, 1);
	_tmp49_ = self->priv->settings;
	_tmp50_ = g_settings_get_int (_tmp49_, "line-fill-probability");
	_tmp51_ = gtk_adjustment_new ((gdouble) _tmp50_, (gdouble) 0, (gdouble) 10, (gdouble) 1, (gdouble) 5, (gdouble) 0);
	g_object_ref_sink (_tmp51_);
	_g_object_unref0 (adj);
	adj = _tmp51_;
	_tmp52_ = adj;
	_tmp53_ = (GtkSpinButton*) gtk_spin_button_new (_tmp52_, (gdouble) 10, (guint) 0);
	g_object_ref_sink (_tmp53_);
	_g_object_unref0 (self->priv->fill_prob_spinner);
	self->priv->fill_prob_spinner = _tmp53_;
	_tmp54_ = self->priv->fill_prob_spinner;
	gtk_spin_button_set_update_policy (_tmp54_, GTK_UPDATE_ALWAYS);
	_tmp55_ = self->priv->fill_prob_spinner;
	gtk_spin_button_set_snap_to_ticks (_tmp55_, TRUE);
	_tmp56_ = self->priv->fill_prob_spinner;
	g_signal_connect_object (_tmp56_, "value-changed", (GCallback) _quadrapassel_fill_prob_spinner_value_changed_cb_gtk_spin_button_value_changed, self, 0);
	_tmp57_ = grid;
	_tmp58_ = self->priv->fill_prob_spinner;
	gtk_grid_attach (_tmp57_, (GtkWidget*) _tmp58_, 1, 1, 1, 1);
	_tmp59_ = label;
	_tmp60_ = self->priv->fill_prob_spinner;
	gtk_label_set_mnemonic_widget (_tmp59_, (GtkWidget*) _tmp60_);
	_tmp61_ = _ ("_Starting level:");
	_tmp62_ = (GtkLabel*) gtk_label_new_with_mnemonic (_tmp61_);
	g_object_ref_sink (_tmp62_);
	_g_object_unref0 (label);
	label = _tmp62_;
	_tmp63_ = label;
	gtk_misc_set_alignment ((GtkMisc*) _tmp63_, (gfloat) 0, 0.5f);
	_tmp64_ = label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp64_, TRUE);
	_tmp65_ = grid;
	_tmp66_ = label;
	gtk_grid_attach (_tmp65_, (GtkWidget*) _tmp66_, 0, 2, 1, 1);
	_tmp67_ = self->priv->settings;
	_tmp68_ = g_settings_get_int (_tmp67_, "starting-level");
	_tmp69_ = gtk_adjustment_new ((gdouble) _tmp68_, (gdouble) 1, (gdouble) 20, (gdouble) 1, (gdouble) 5, (gdouble) 0);
	g_object_ref_sink (_tmp69_);
	_g_object_unref0 (adj);
	adj = _tmp69_;
	_tmp70_ = adj;
	_tmp71_ = (GtkSpinButton*) gtk_spin_button_new (_tmp70_, 10.0, (guint) 0);
	g_object_ref_sink (_tmp71_);
	_g_object_unref0 (self->priv->starting_level_spin);
	self->priv->starting_level_spin = _tmp71_;
	_tmp72_ = self->priv->starting_level_spin;
	gtk_spin_button_set_update_policy (_tmp72_, GTK_UPDATE_ALWAYS);
	_tmp73_ = self->priv->starting_level_spin;
	gtk_spin_button_set_snap_to_ticks (_tmp73_, TRUE);
	_tmp74_ = self->priv->starting_level_spin;
	g_signal_connect_object (_tmp74_, "value-changed", (GCallback) _quadrapassel_starting_level_value_changed_cb_gtk_spin_button_value_changed, self, 0);
	_tmp75_ = grid;
	_tmp76_ = self->priv->starting_level_spin;
	gtk_grid_attach (_tmp75_, (GtkWidget*) _tmp76_, 1, 2, 1, 1);
	_tmp77_ = label;
	_tmp78_ = self->priv->starting_level_spin;
	gtk_label_set_mnemonic_widget (_tmp77_, (GtkWidget*) _tmp78_);
	_tmp79_ = _ ("_Enable sounds");
	_tmp80_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp79_);
	g_object_ref_sink (_tmp80_);
	_g_object_unref0 (self->priv->sound_toggle);
	self->priv->sound_toggle = _tmp80_;
	_tmp81_ = self->priv->sound_toggle;
	_tmp82_ = self->priv->settings;
	_tmp83_ = g_settings_get_boolean (_tmp82_, "sound");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp81_, _tmp83_);
	_tmp84_ = self->priv->sound_toggle;
	g_signal_connect_object ((GtkToggleButton*) _tmp84_, "toggled", (GCallback) _quadrapassel_sound_toggle_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp85_ = grid;
	_tmp86_ = self->priv->sound_toggle;
	gtk_grid_attach (_tmp85_, (GtkWidget*) _tmp86_, 0, 3, 2, 1);
	_tmp87_ = _ ("Choose difficult _blocks");
	_tmp88_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp87_);
	g_object_ref_sink (_tmp88_);
	_g_object_unref0 (self->priv->difficult_blocks_toggle);
	self->priv->difficult_blocks_toggle = _tmp88_;
	_tmp89_ = self->priv->difficult_blocks_toggle;
	_tmp90_ = self->priv->settings;
	_tmp91_ = g_settings_get_boolean (_tmp90_, "pick-difficult-blocks");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp89_, _tmp91_);
	_tmp92_ = self->priv->difficult_blocks_toggle;
	g_signal_connect_object ((GtkToggleButton*) _tmp92_, "toggled", (GCallback) _quadrapassel_difficult_blocks_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp93_ = grid;
	_tmp94_ = self->priv->difficult_blocks_toggle;
	gtk_grid_attach (_tmp93_, (GtkWidget*) _tmp94_, 0, 4, 2, 1);
	_tmp95_ = _ ("_Preview next block");
	_tmp96_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp95_);
	g_object_ref_sink (_tmp96_);
	_g_object_unref0 (self->priv->do_preview_toggle);
	self->priv->do_preview_toggle = _tmp96_;
	_tmp97_ = self->priv->do_preview_toggle;
	_tmp98_ = self->priv->settings;
	_tmp99_ = g_settings_get_boolean (_tmp98_, "do-preview");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp97_, _tmp99_);
	_tmp100_ = self->priv->do_preview_toggle;
	_tmp101_ = self->priv->settings;
	_tmp102_ = g_settings_get_boolean (_tmp101_, "pick-difficult-blocks");
	gtk_widget_set_sensitive ((GtkWidget*) _tmp100_, !_tmp102_);
	_tmp103_ = self->priv->do_preview_toggle;
	g_signal_connect_object ((GtkToggleButton*) _tmp103_, "toggled", (GCallback) _quadrapassel_do_preview_toggle_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp104_ = grid;
	_tmp105_ = self->priv->do_preview_toggle;
	gtk_grid_attach (_tmp104_, (GtkWidget*) _tmp105_, 0, 5, 2, 1);
	_tmp106_ = _ ("_Rotate blocks counterclockwise");
	_tmp107_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp106_);
	g_object_ref_sink (_tmp107_);
	_g_object_unref0 (self->priv->rotate_counter_clock_wise_toggle);
	self->priv->rotate_counter_clock_wise_toggle = _tmp107_;
	_tmp108_ = self->priv->rotate_counter_clock_wise_toggle;
	_tmp109_ = self->priv->settings;
	_tmp110_ = g_settings_get_boolean (_tmp109_, "rotate-counter-clock-wise");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp108_, _tmp110_);
	_tmp111_ = self->priv->rotate_counter_clock_wise_toggle;
	g_signal_connect_object ((GtkToggleButton*) _tmp111_, "toggled", (GCallback) _quadrapassel_set_rotate_counter_clock_wise_gtk_toggle_button_toggled, self, 0);
	_tmp112_ = grid;
	_tmp113_ = self->priv->rotate_counter_clock_wise_toggle;
	gtk_grid_attach (_tmp112_, (GtkWidget*) _tmp113_, 0, 6, 2, 1);
	_tmp114_ = _ ("Show _where the block will land");
	_tmp115_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp114_);
	g_object_ref_sink (_tmp115_);
	_g_object_unref0 (self->priv->show_shadow_toggle);
	self->priv->show_shadow_toggle = _tmp115_;
	_tmp116_ = self->priv->show_shadow_toggle;
	_tmp117_ = self->priv->settings;
	_tmp118_ = g_settings_get_boolean (_tmp117_, "show-shadow");
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp116_, _tmp118_);
	_tmp119_ = self->priv->show_shadow_toggle;
	g_signal_connect_object ((GtkToggleButton*) _tmp119_, "toggled", (GCallback) _quadrapassel_user_target_toggled_cb_gtk_toggle_button_toggled, self, 0);
	_tmp120_ = grid;
	_tmp121_ = self->priv->show_shadow_toggle;
	gtk_grid_attach (_tmp120_, (GtkWidget*) _tmp121_, 0, 7, 2, 1);
	_tmp122_ = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, -1);
	_g_object_unref0 (self->priv->controls_model);
	self->priv->controls_model = _tmp122_;
	_tmp123_ = self->priv->controls_model;
	gtk_list_store_append (_tmp123_, &_tmp124_);
	iter = _tmp124_;
	_tmp125_ = self->priv->settings;
	_tmp126_ = g_settings_get_int (_tmp125_, "key-left");
	keyval = _tmp126_;
	_tmp127_ = self->priv->controls_model;
	_tmp128_ = iter;
	_tmp129_ = _ ("Move left");
	_tmp130_ = keyval;
	gtk_list_store_set (_tmp127_, &_tmp128_, 0, "key-left", 1, _tmp129_, 2, _tmp130_, -1);
	_tmp131_ = self->priv->controls_model;
	gtk_list_store_append (_tmp131_, &_tmp132_);
	iter = _tmp132_;
	_tmp133_ = self->priv->settings;
	_tmp134_ = g_settings_get_int (_tmp133_, "key-right");
	keyval = _tmp134_;
	_tmp135_ = self->priv->controls_model;
	_tmp136_ = iter;
	_tmp137_ = _ ("Move right");
	_tmp138_ = keyval;
	gtk_list_store_set (_tmp135_, &_tmp136_, 0, "key-right", 1, _tmp137_, 2, _tmp138_, -1);
	_tmp139_ = self->priv->controls_model;
	gtk_list_store_append (_tmp139_, &_tmp140_);
	iter = _tmp140_;
	_tmp141_ = self->priv->settings;
	_tmp142_ = g_settings_get_int (_tmp141_, "key-down");
	keyval = _tmp142_;
	_tmp143_ = self->priv->controls_model;
	_tmp144_ = iter;
	_tmp145_ = _ ("Move down");
	_tmp146_ = keyval;
	gtk_list_store_set (_tmp143_, &_tmp144_, 0, "key-down", 1, _tmp145_, 2, _tmp146_, -1);
	_tmp147_ = self->priv->controls_model;
	gtk_list_store_append (_tmp147_, &_tmp148_);
	iter = _tmp148_;
	_tmp149_ = self->priv->settings;
	_tmp150_ = g_settings_get_int (_tmp149_, "key-drop");
	keyval = _tmp150_;
	_tmp151_ = self->priv->controls_model;
	_tmp152_ = iter;
	_tmp153_ = _ ("Drop");
	_tmp154_ = keyval;
	gtk_list_store_set (_tmp151_, &_tmp152_, 0, "key-drop", 1, _tmp153_, 2, _tmp154_, -1);
	_tmp155_ = self->priv->controls_model;
	gtk_list_store_append (_tmp155_, &_tmp156_);
	iter = _tmp156_;
	_tmp157_ = self->priv->settings;
	_tmp158_ = g_settings_get_int (_tmp157_, "key-rotate");
	keyval = _tmp158_;
	_tmp159_ = self->priv->controls_model;
	_tmp160_ = iter;
	_tmp161_ = _ ("Rotate");
	_tmp162_ = keyval;
	gtk_list_store_set (_tmp159_, &_tmp160_, 0, "key-rotate", 1, _tmp161_, 2, _tmp162_, -1);
	_tmp163_ = self->priv->controls_model;
	gtk_list_store_append (_tmp163_, &_tmp164_);
	iter = _tmp164_;
	_tmp165_ = self->priv->settings;
	_tmp166_ = g_settings_get_int (_tmp165_, "key-pause");
	keyval = _tmp166_;
	_tmp167_ = self->priv->controls_model;
	_tmp168_ = iter;
	_tmp169_ = _ ("Pause");
	_tmp170_ = keyval;
	gtk_list_store_set (_tmp167_, &_tmp168_, 0, "key-pause", 1, _tmp169_, 2, _tmp170_, -1);
	_tmp171_ = self->priv->controls_model;
	_tmp172_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp171_);
	g_object_ref_sink (_tmp172_);
	controls_view = _tmp172_;
	_tmp173_ = controls_view;
	gtk_tree_view_set_headers_visible (_tmp173_, FALSE);
	_tmp174_ = controls_view;
	gtk_tree_view_set_enable_search (_tmp174_, FALSE);
	_tmp175_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp175_);
	label_renderer = _tmp175_;
	_tmp176_ = controls_view;
	_tmp177_ = label_renderer;
	gtk_tree_view_insert_column_with_attributes (_tmp176_, -1, "Control", (GtkCellRenderer*) _tmp177_, "text", 1, NULL);
	_tmp178_ = (GtkCellRendererAccel*) gtk_cell_renderer_accel_new ();
	g_object_ref_sink (_tmp178_);
	key_renderer = _tmp178_;
	_tmp179_ = key_renderer;
	g_object_set ((GtkCellRendererText*) _tmp179_, "editable", TRUE, NULL);
	_tmp180_ = key_renderer;
	g_object_set (_tmp180_, "accel-mode", GTK_CELL_RENDERER_ACCEL_MODE_OTHER, NULL);
	_tmp181_ = key_renderer;
	g_signal_connect_object (_tmp181_, "accel-edited", (GCallback) _quadrapassel_accel_edited_cb_gtk_cell_renderer_accel_accel_edited, self, 0);
	_tmp182_ = key_renderer;
	g_signal_connect_object (_tmp182_, "accel-cleared", (GCallback) _quadrapassel_accel_cleared_cb_gtk_cell_renderer_accel_accel_cleared, self, 0);
	_tmp183_ = controls_view;
	_tmp184_ = key_renderer;
	gtk_tree_view_insert_column_with_attributes (_tmp183_, -1, "Key", (GtkCellRenderer*) _tmp184_, "accel-key", 2, "accel-mods", 3, NULL);
	_tmp185_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp185_);
	controls_list = _tmp185_;
	_tmp186_ = controls_list;
	gtk_container_set_border_width ((GtkContainer*) _tmp186_, (guint) 12);
	_tmp187_ = controls_list;
	g_object_set (_tmp187_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	_tmp188_ = controls_list;
	g_object_set (_tmp188_, "vscrollbar-policy", GTK_POLICY_ALWAYS, NULL);
	_tmp189_ = controls_list;
	gtk_scrolled_window_set_shadow_type (_tmp189_, GTK_SHADOW_IN);
	_tmp190_ = controls_list;
	_tmp191_ = controls_view;
	gtk_container_add ((GtkContainer*) _tmp190_, (GtkWidget*) _tmp191_);
	_tmp192_ = _ ("Controls");
	_tmp193_ = (GtkLabel*) gtk_label_new (_tmp192_);
	g_object_ref_sink (_tmp193_);
	_g_object_unref0 (label);
	label = _tmp193_;
	_tmp194_ = notebook;
	_tmp195_ = controls_list;
	_tmp196_ = label;
	gtk_notebook_append_page (_tmp194_, (GtkWidget*) _tmp195_, (GtkWidget*) _tmp196_);
	_tmp197_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp197_);
	_g_object_unref0 (vbox);
	vbox = _tmp197_;
	_tmp198_ = vbox;
	gtk_container_set_border_width ((GtkContainer*) _tmp198_, (guint) 12);
	_tmp199_ = _ ("Theme");
	_tmp200_ = (GtkLabel*) gtk_label_new (_tmp199_);
	g_object_ref_sink (_tmp200_);
	_g_object_unref0 (label);
	label = _tmp200_;
	_tmp201_ = notebook;
	_tmp202_ = vbox;
	_tmp203_ = label;
	gtk_notebook_append_page (_tmp201_, (GtkWidget*) _tmp202_, (GtkWidget*) _tmp203_);
	_tmp204_ = (GtkComboBox*) gtk_combo_box_new ();
	g_object_ref_sink (_tmp204_);
	theme_combo = _tmp204_;
	_tmp205_ = vbox;
	_tmp206_ = theme_combo;
	gtk_box_pack_start (_tmp205_, (GtkWidget*) _tmp206_, FALSE, TRUE, (guint) 0);
	_tmp207_ = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING, -1);
	theme_store = _tmp207_;
	_tmp208_ = theme_combo;
	_tmp209_ = theme_store;
	gtk_combo_box_set_model (_tmp208_, (GtkTreeModel*) _tmp209_);
	_tmp210_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
	g_object_ref_sink (_tmp210_);
	renderer = _tmp210_;
	_tmp211_ = theme_combo;
	_tmp212_ = renderer;
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp211_, (GtkCellRenderer*) _tmp212_, TRUE);
	_tmp213_ = theme_combo;
	_tmp214_ = renderer;
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp213_, (GtkCellRenderer*) _tmp214_, "text", 0);
	_tmp215_ = theme_store;
	gtk_list_store_append (_tmp215_, &_tmp216_);
	iter = _tmp216_;
	_tmp217_ = theme_store;
	_tmp218_ = iter;
	_tmp219_ = _ ("Plain");
	gtk_list_store_set (_tmp217_, &_tmp218_, 0, _tmp219_, 1, "plain", -1, -1);
	_tmp220_ = self->priv->settings;
	_tmp221_ = g_settings_get_string (_tmp220_, "theme");
	_tmp222_ = _tmp221_;
	_tmp223_ = g_strcmp0 (_tmp222_, "plain") == 0;
	_g_free0 (_tmp222_);
	if (_tmp223_) {
		GtkComboBox* _tmp224_ = NULL;
		GtkTreeIter _tmp225_ = {0};
		_tmp224_ = theme_combo;
		_tmp225_ = iter;
		gtk_combo_box_set_active_iter (_tmp224_, &_tmp225_);
	}
	_tmp226_ = theme_store;
	gtk_list_store_append (_tmp226_, &_tmp227_);
	iter = _tmp227_;
	_tmp228_ = theme_store;
	_tmp229_ = iter;
	_tmp230_ = _ ("Tango Flat");
	gtk_list_store_set (_tmp228_, &_tmp229_, 0, _tmp230_, 1, "tangoflat", -1, -1);
	_tmp231_ = self->priv->settings;
	_tmp232_ = g_settings_get_string (_tmp231_, "theme");
	_tmp233_ = _tmp232_;
	_tmp234_ = g_strcmp0 (_tmp233_, "tangoflat") == 0;
	_g_free0 (_tmp233_);
	if (_tmp234_) {
		GtkComboBox* _tmp235_ = NULL;
		GtkTreeIter _tmp236_ = {0};
		_tmp235_ = theme_combo;
		_tmp236_ = iter;
		gtk_combo_box_set_active_iter (_tmp235_, &_tmp236_);
	}
	_tmp237_ = theme_store;
	gtk_list_store_append (_tmp237_, &_tmp238_);
	iter = _tmp238_;
	_tmp239_ = theme_store;
	_tmp240_ = iter;
	_tmp241_ = _ ("Tango Shaded");
	gtk_list_store_set (_tmp239_, &_tmp240_, 0, _tmp241_, 1, "tangoshaded", -1, -1);
	_tmp242_ = self->priv->settings;
	_tmp243_ = g_settings_get_string (_tmp242_, "theme");
	_tmp244_ = _tmp243_;
	_tmp245_ = g_strcmp0 (_tmp244_, "tangoshaded") == 0;
	_g_free0 (_tmp244_);
	if (_tmp245_) {
		GtkComboBox* _tmp246_ = NULL;
		GtkTreeIter _tmp247_ = {0};
		_tmp246_ = theme_combo;
		_tmp247_ = iter;
		gtk_combo_box_set_active_iter (_tmp246_, &_tmp247_);
	}
	_tmp248_ = theme_store;
	gtk_list_store_append (_tmp248_, &_tmp249_);
	iter = _tmp249_;
	_tmp250_ = theme_store;
	_tmp251_ = iter;
	_tmp252_ = _ ("Clean");
	gtk_list_store_set (_tmp250_, &_tmp251_, 0, _tmp252_, 1, "clean", -1, -1);
	_tmp253_ = self->priv->settings;
	_tmp254_ = g_settings_get_string (_tmp253_, "theme");
	_tmp255_ = _tmp254_;
	_tmp256_ = g_strcmp0 (_tmp255_, "clean") == 0;
	_g_free0 (_tmp255_);
	if (_tmp256_) {
		GtkComboBox* _tmp257_ = NULL;
		GtkTreeIter _tmp258_ = {0};
		_tmp257_ = theme_combo;
		_tmp258_ = iter;
		gtk_combo_box_set_active_iter (_tmp257_, &_tmp258_);
	}
	_tmp259_ = theme_combo;
	g_signal_connect_object (_tmp259_, "changed", (GCallback) _quadrapassel_theme_combo_changed_cb_gtk_combo_box_changed, self, 0);
	_tmp260_ = preview_new (NULL);
	g_object_ref_sink (_tmp260_);
	_g_object_unref0 (self->priv->theme_preview);
	self->priv->theme_preview = _tmp260_;
	_tmp261_ = self->priv->theme_preview;
	_tmp262_ = game_new (20, 14, 1, 0, 5, FALSE);
	_tmp263_ = _tmp262_;
	preview_set_game (_tmp261_, _tmp263_);
	_g_object_unref0 (_tmp263_);
	_tmp264_ = self->priv->theme_preview;
	_tmp265_ = self->priv->settings;
	_tmp266_ = g_settings_get_string (_tmp265_, "theme");
	_tmp267_ = _tmp266_;
	preview_set_theme (_tmp264_, _tmp267_);
	_g_free0 (_tmp267_);
	_tmp268_ = vbox;
	_tmp269_ = self->priv->theme_preview;
	gtk_box_pack_start (_tmp268_, (GtkWidget*) _tmp269_, TRUE, TRUE, (guint) 0);
	_tmp270_ = self->priv->preferences_dialog;
	gtk_widget_show_all ((GtkWidget*) _tmp270_);
	_g_object_unref0 (renderer);
	_g_object_unref0 (theme_store);
	_g_object_unref0 (theme_combo);
	_g_object_unref0 (controls_list);
	_g_object_unref0 (key_renderer);
	_g_object_unref0 (label_renderer);
	_g_object_unref0 (controls_view);
	_g_object_unref0 (adj);
	_g_object_unref0 (label);
	_g_object_unref0 (grid);
	_g_object_unref0 (notebook);
	_g_object_unref0 (vbox);
}


static void quadrapassel_sound_toggle_toggled_cb (Quadrapassel* self) {
	gboolean play_sound = FALSE;
	GtkCheckButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_ = NULL;
	GameView* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->sound_toggle;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	play_sound = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_boolean (_tmp2_, "sound", play_sound);
	_tmp3_ = self->priv->view;
	_tmp3_->mute = !play_sound;
}


static void quadrapassel_do_preview_toggle_toggled_cb (Quadrapassel* self) {
	GSettings* _tmp0_ = NULL;
	GtkCheckButton* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->do_preview_toggle;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	g_settings_set_boolean (_tmp0_, "do-preview", _tmp2_);
	quadrapassel_update_preview_settings (self);
}


static void quadrapassel_difficult_blocks_toggled_cb (Quadrapassel* self) {
	GSettings* _tmp0_ = NULL;
	GtkCheckButton* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	GtkCheckButton* _tmp3_ = NULL;
	GSettings* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->difficult_blocks_toggle;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	g_settings_set_boolean (_tmp0_, "pick-difficult-blocks", _tmp2_);
	_tmp3_ = self->priv->do_preview_toggle;
	_tmp4_ = self->priv->settings;
	_tmp5_ = g_settings_get_boolean (_tmp4_, "pick-difficult-blocks");
	gtk_widget_set_sensitive ((GtkWidget*) _tmp3_, !_tmp5_);
	quadrapassel_update_preview_settings (self);
}


static void quadrapassel_update_preview_settings (Quadrapassel* self) {
	gboolean do_preview = FALSE;
	GtkCheckButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean difficult_block_mode = FALSE;
	GtkCheckButton* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	Preview* _tmp7_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->do_preview_toggle;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	do_preview = _tmp1_;
	_tmp2_ = self->priv->difficult_blocks_toggle;
	_tmp3_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp2_);
	difficult_block_mode = _tmp3_;
	_tmp5_ = do_preview;
	if (_tmp5_) {
		gboolean _tmp6_ = FALSE;
		_tmp6_ = difficult_block_mode;
		_tmp4_ = !_tmp6_;
	} else {
		_tmp4_ = FALSE;
	}
	_tmp7_ = self->priv->preview;
	preview_set_enabled (_tmp7_, _tmp4_);
}


static void quadrapassel_set_rotate_counter_clock_wise (Quadrapassel* self) {
	GSettings* _tmp0_ = NULL;
	GtkCheckButton* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->rotate_counter_clock_wise_toggle;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	g_settings_set_boolean (_tmp0_, "rotate-counter-clock-wise", _tmp2_);
}


static void quadrapassel_user_target_toggled_cb (Quadrapassel* self) {
	gboolean show_shadow = FALSE;
	GtkCheckButton* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GSettings* _tmp2_ = NULL;
	GameView* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->show_shadow_toggle;
	_tmp1_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp0_);
	show_shadow = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_boolean (_tmp2_, "show-shadow", show_shadow);
	_tmp3_ = self->priv->view;
	game_view_set_show_shadow (_tmp3_, show_shadow);
}


static void quadrapassel_accel_edited_cb (Quadrapassel* self, GtkCellRendererAccel* cell, const gchar* path_string, guint keyval, GdkModifierType mask, guint hardware_keycode) {
	GtkTreePath* path = NULL;
	const gchar* _tmp0_ = NULL;
	GtkTreePath* _tmp1_ = NULL;
	GtkTreePath* _tmp2_ = NULL;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp3_ = NULL;
	GtkTreePath* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	gboolean _tmp6_ = FALSE;
	gchar* key = NULL;
	GtkListStore* _tmp7_ = NULL;
	GtkTreeIter _tmp8_ = {0};
	const gchar* _tmp9_ = NULL;
	GtkListStore* _tmp10_ = NULL;
	GtkTreeIter _tmp11_ = {0};
	guint _tmp12_ = 0U;
	GSettings* _tmp13_ = NULL;
	const gchar* _tmp14_ = NULL;
	guint _tmp15_ = 0U;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (path_string != NULL);
	_tmp0_ = path_string;
	_tmp1_ = gtk_tree_path_new_from_string (_tmp0_);
	path = _tmp1_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp3_ = self->priv->controls_model;
	_tmp4_ = path;
	_tmp6_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp3_, &_tmp5_, _tmp4_);
	iter = _tmp5_;
	if (!_tmp6_) {
		_gtk_tree_path_free0 (path);
		return;
	}
	key = NULL;
	_tmp7_ = self->priv->controls_model;
	_tmp8_ = iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp7_, &_tmp8_, 0, &key, -1);
	_tmp9_ = key;
	if (_tmp9_ == NULL) {
		_g_free0 (key);
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp10_ = self->priv->controls_model;
	_tmp11_ = iter;
	_tmp12_ = keyval;
	gtk_list_store_set (_tmp10_, &_tmp11_, 2, _tmp12_, -1);
	_tmp13_ = self->priv->settings;
	_tmp14_ = key;
	_tmp15_ = keyval;
	g_settings_set_int (_tmp13_, _tmp14_, (gint) _tmp15_);
	_g_free0 (key);
	_gtk_tree_path_free0 (path);
}


static void quadrapassel_accel_cleared_cb (Quadrapassel* self, GtkCellRendererAccel* cell, const gchar* path_string) {
	GtkTreePath* path = NULL;
	const gchar* _tmp0_ = NULL;
	GtkTreePath* _tmp1_ = NULL;
	GtkTreePath* _tmp2_ = NULL;
	GtkTreeIter iter = {0};
	GtkListStore* _tmp3_ = NULL;
	GtkTreePath* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	gboolean _tmp6_ = FALSE;
	gchar* key = NULL;
	GtkListStore* _tmp7_ = NULL;
	GtkTreeIter _tmp8_ = {0};
	const gchar* _tmp9_ = NULL;
	GtkListStore* _tmp10_ = NULL;
	GtkTreeIter _tmp11_ = {0};
	GSettings* _tmp12_ = NULL;
	const gchar* _tmp13_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cell != NULL);
	g_return_if_fail (path_string != NULL);
	_tmp0_ = path_string;
	_tmp1_ = gtk_tree_path_new_from_string (_tmp0_);
	path = _tmp1_;
	_tmp2_ = path;
	if (_tmp2_ == NULL) {
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp3_ = self->priv->controls_model;
	_tmp4_ = path;
	_tmp6_ = gtk_tree_model_get_iter ((GtkTreeModel*) _tmp3_, &_tmp5_, _tmp4_);
	iter = _tmp5_;
	if (!_tmp6_) {
		_gtk_tree_path_free0 (path);
		return;
	}
	key = NULL;
	_tmp7_ = self->priv->controls_model;
	_tmp8_ = iter;
	gtk_tree_model_get ((GtkTreeModel*) _tmp7_, &_tmp8_, 0, &key, -1);
	_tmp9_ = key;
	if (_tmp9_ == NULL) {
		_g_free0 (key);
		_gtk_tree_path_free0 (path);
		return;
	}
	_tmp10_ = self->priv->controls_model;
	_tmp11_ = iter;
	gtk_list_store_set (_tmp10_, &_tmp11_, 2, 0, -1);
	_tmp12_ = self->priv->settings;
	_tmp13_ = key;
	g_settings_set_int (_tmp12_, _tmp13_, 0);
	_g_free0 (key);
	_gtk_tree_path_free0 (path);
}


static void quadrapassel_theme_combo_changed_cb (Quadrapassel* self, GtkComboBox* widget) {
	GtkTreeIter iter = {0};
	GtkComboBox* _tmp0_ = NULL;
	GtkTreeIter _tmp1_ = {0};
	gchar* theme = NULL;
	GtkComboBox* _tmp2_ = NULL;
	GtkTreeModel* _tmp3_ = NULL;
	GtkTreeModel* _tmp4_ = NULL;
	GtkTreeIter _tmp5_ = {0};
	GameView* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	Preview* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	Preview* _tmp10_ = NULL;
	GSettings* _tmp13_ = NULL;
	const gchar* _tmp14_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	gtk_combo_box_get_active_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	_tmp2_ = widget;
	_tmp3_ = gtk_combo_box_get_model (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = iter;
	gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &theme, -1);
	_tmp6_ = self->priv->view;
	_tmp7_ = theme;
	game_view_set_theme (_tmp6_, _tmp7_);
	_tmp8_ = self->priv->preview;
	_tmp9_ = theme;
	preview_set_theme (_tmp8_, _tmp9_);
	_tmp10_ = self->priv->theme_preview;
	if (_tmp10_ != NULL) {
		Preview* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		_tmp11_ = self->priv->theme_preview;
		_tmp12_ = theme;
		preview_set_theme (_tmp11_, _tmp12_);
	}
	_tmp13_ = self->priv->settings;
	_tmp14_ = theme;
	g_settings_set_string (_tmp13_, "theme", _tmp14_);
	_g_free0 (theme);
}


static void quadrapassel_fill_height_spinner_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin) {
	gint value = 0;
	GtkSpinButton* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GSettings* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spin != NULL);
	_tmp0_ = spin;
	_tmp1_ = gtk_spin_button_get_value_as_int (_tmp0_);
	value = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_int (_tmp2_, "line-fill-height", value);
}


static void quadrapassel_fill_prob_spinner_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin) {
	gint value = 0;
	GtkSpinButton* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GSettings* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spin != NULL);
	_tmp0_ = spin;
	_tmp1_ = gtk_spin_button_get_value_as_int (_tmp0_);
	value = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_int (_tmp2_, "line-fill-probability", value);
}


static void quadrapassel_starting_level_value_changed_cb (Quadrapassel* self, GtkSpinButton* spin) {
	gint value = 0;
	GtkSpinButton* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GSettings* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (spin != NULL);
	_tmp0_ = spin;
	_tmp1_ = gtk_spin_button_get_value_as_int (_tmp0_);
	value = _tmp1_;
	_tmp2_ = self->priv->settings;
	g_settings_set_int (_tmp2_, "starting-level", value);
}


static void quadrapassel_pause_cb (Quadrapassel* self) {
	Game* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	if (_tmp0_ != NULL) {
		Game* _tmp1_ = NULL;
		Game* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_ = FALSE;
		_tmp1_ = self->priv->game;
		_tmp2_ = self->priv->game;
		_tmp3_ = game_get_paused (_tmp2_);
		_tmp4_ = _tmp3_;
		game_set_paused (_tmp1_, !_tmp4_);
	}
}


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


static gboolean quadrapassel_key_press_event_cb (Quadrapassel* self, GtkWidget* widget, GdkEventKey* event) {
	gboolean result = FALSE;
	guint keyval = 0U;
	GdkEventKey* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	Game* _tmp3_ = NULL;
	guint _tmp4_ = 0U;
	GSettings* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	guint _tmp7_ = 0U;
	Game* _tmp12_ = NULL;
	gboolean _tmp13_ = FALSE;
	gboolean _tmp14_ = FALSE;
	guint _tmp15_ = 0U;
	GSettings* _tmp16_ = NULL;
	gint _tmp17_ = 0;
	guint _tmp18_ = 0U;
	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_ = event;
	_tmp1_ = _tmp0_->keyval;
	_tmp2_ = quadrapassel_upper_key (self, _tmp1_);
	keyval = _tmp2_;
	_tmp3_ = self->priv->game;
	if (_tmp3_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp4_ = keyval;
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_settings_get_int (_tmp5_, "key-pause");
	_tmp7_ = quadrapassel_upper_key (self, (guint) _tmp6_);
	if (_tmp4_ == _tmp7_) {
		Game* _tmp8_ = NULL;
		Game* _tmp9_ = NULL;
		gboolean _tmp10_ = FALSE;
		gboolean _tmp11_ = FALSE;
		_tmp8_ = self->priv->game;
		_tmp9_ = self->priv->game;
		_tmp10_ = game_get_paused (_tmp9_);
		_tmp11_ = _tmp10_;
		game_set_paused (_tmp8_, !_tmp11_);
		result = TRUE;
		return result;
	}
	_tmp12_ = self->priv->game;
	_tmp13_ = game_get_paused (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_) {
		result = FALSE;
		return result;
	}
	_tmp15_ = keyval;
	_tmp16_ = self->priv->settings;
	_tmp17_ = g_settings_get_int (_tmp16_, "key-left");
	_tmp18_ = quadrapassel_upper_key (self, (guint) _tmp17_);
	if (_tmp15_ == _tmp18_) {
		Game* _tmp19_ = NULL;
		_tmp19_ = self->priv->game;
		game_move_left (_tmp19_);
		result = TRUE;
		return result;
	} else {
		guint _tmp20_ = 0U;
		GSettings* _tmp21_ = NULL;
		gint _tmp22_ = 0;
		guint _tmp23_ = 0U;
		_tmp20_ = keyval;
		_tmp21_ = self->priv->settings;
		_tmp22_ = g_settings_get_int (_tmp21_, "key-right");
		_tmp23_ = quadrapassel_upper_key (self, (guint) _tmp22_);
		if (_tmp20_ == _tmp23_) {
			Game* _tmp24_ = NULL;
			_tmp24_ = self->priv->game;
			game_move_right (_tmp24_);
			result = TRUE;
			return result;
		} else {
			guint _tmp25_ = 0U;
			GSettings* _tmp26_ = NULL;
			gint _tmp27_ = 0;
			guint _tmp28_ = 0U;
			_tmp25_ = keyval;
			_tmp26_ = self->priv->settings;
			_tmp27_ = g_settings_get_int (_tmp26_, "key-rotate");
			_tmp28_ = quadrapassel_upper_key (self, (guint) _tmp27_);
			if (_tmp25_ == _tmp28_) {
				GSettings* _tmp29_ = NULL;
				gboolean _tmp30_ = FALSE;
				_tmp29_ = self->priv->settings;
				_tmp30_ = g_settings_get_boolean (_tmp29_, "rotate-counter-clock-wise");
				if (_tmp30_) {
					Game* _tmp31_ = NULL;
					_tmp31_ = self->priv->game;
					game_rotate_left (_tmp31_);
				} else {
					Game* _tmp32_ = NULL;
					_tmp32_ = self->priv->game;
					game_rotate_right (_tmp32_);
				}
				result = TRUE;
				return result;
			} else {
				guint _tmp33_ = 0U;
				GSettings* _tmp34_ = NULL;
				gint _tmp35_ = 0;
				guint _tmp36_ = 0U;
				_tmp33_ = keyval;
				_tmp34_ = self->priv->settings;
				_tmp35_ = g_settings_get_int (_tmp34_, "key-down");
				_tmp36_ = quadrapassel_upper_key (self, (guint) _tmp35_);
				if (_tmp33_ == _tmp36_) {
					Game* _tmp37_ = NULL;
					_tmp37_ = self->priv->game;
					game_set_fast_forward (_tmp37_, TRUE);
					result = TRUE;
					return result;
				} else {
					guint _tmp38_ = 0U;
					GSettings* _tmp39_ = NULL;
					gint _tmp40_ = 0;
					guint _tmp41_ = 0U;
					_tmp38_ = keyval;
					_tmp39_ = self->priv->settings;
					_tmp40_ = g_settings_get_int (_tmp39_, "key-drop");
					_tmp41_ = quadrapassel_upper_key (self, (guint) _tmp40_);
					if (_tmp38_ == _tmp41_) {
						Game* _tmp42_ = NULL;
						_tmp42_ = self->priv->game;
						game_drop (_tmp42_);
						result = TRUE;
						return result;
					}
				}
			}
		}
	}
	result = FALSE;
	return result;
}


static gboolean quadrapassel_key_release_event_cb (Quadrapassel* self, GtkWidget* widget, GdkEventKey* event) {
	gboolean result = FALSE;
	guint keyval = 0U;
	GdkEventKey* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	Game* _tmp3_ = NULL;
	guint _tmp4_ = 0U;
	GSettings* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	guint _tmp7_ = 0U;
	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_ = event;
	_tmp1_ = _tmp0_->keyval;
	_tmp2_ = quadrapassel_upper_key (self, _tmp1_);
	keyval = _tmp2_;
	_tmp3_ = self->priv->game;
	if (_tmp3_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp4_ = keyval;
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_settings_get_int (_tmp5_, "key-down");
	_tmp7_ = quadrapassel_upper_key (self, (guint) _tmp6_);
	if (_tmp4_ == _tmp7_) {
		Game* _tmp8_ = NULL;
		_tmp8_ = self->priv->game;
		game_set_fast_forward (_tmp8_, FALSE);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static guint quadrapassel_upper_key (Quadrapassel* self, guint keyval) {
	guint result = 0U;
	guint _tmp0_ = 0U;
	guint _tmp2_ = 0U;
	gchar _tmp3_ = '\0';
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = keyval;
	if (_tmp0_ > ((guint) 255)) {
		guint _tmp1_ = 0U;
		_tmp1_ = keyval;
		result = _tmp1_;
		return result;
	}
	_tmp2_ = keyval;
	_tmp3_ = g_ascii_toupper ((gchar) _tmp2_);
	result = (guint) _tmp3_;
	return result;
}


static void quadrapassel_new_game_cb (Quadrapassel* self) {
	g_return_if_fail (self != NULL);
	quadrapassel_new_game (self);
}


static void _quadrapassel_pause_changed_cb_game_pause_changed (Game* _sender, gpointer self) {
	quadrapassel_pause_changed_cb ((Quadrapassel*) self);
}


static void _quadrapassel_shape_landed_cb_game_shape_landed (Game* _sender, gint* lines, int lines_length1, GList* line_blocks, gpointer self) {
	quadrapassel_shape_landed_cb ((Quadrapassel*) self, lines, lines_length1, line_blocks);
}


static void _quadrapassel_complete_cb_game_complete (Game* _sender, gpointer self) {
	quadrapassel_complete_cb ((Quadrapassel*) self);
}


static void quadrapassel_new_game (Quadrapassel* self) {
	Game* _tmp0_ = NULL;
	GSettings* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	GSettings* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	GSettings* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	GSettings* _tmp9_ = NULL;
	gboolean _tmp10_ = FALSE;
	Game* _tmp11_ = NULL;
	Game* _tmp12_ = NULL;
	Game* _tmp13_ = NULL;
	Game* _tmp14_ = NULL;
	Preview* _tmp15_ = NULL;
	Game* _tmp16_ = NULL;
	GameView* _tmp17_ = NULL;
	Game* _tmp18_ = NULL;
	Game* _tmp19_ = NULL;
	GSimpleAction* _tmp20_ = NULL;
	GtkButton* _tmp21_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	if (_tmp0_ != NULL) {
		Game* _tmp1_ = NULL;
		Game* _tmp2_ = NULL;
		_tmp1_ = self->priv->game;
		game_stop (_tmp1_);
		_tmp2_ = self->priv->game;
		g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_DATA, (guint) 0, (GQuark) 0, NULL, NULL, self);
	}
	_tmp3_ = self->priv->settings;
	_tmp4_ = g_settings_get_int (_tmp3_, "starting-level");
	_tmp5_ = self->priv->settings;
	_tmp6_ = g_settings_get_int (_tmp5_, "line-fill-height");
	_tmp7_ = self->priv->settings;
	_tmp8_ = g_settings_get_int (_tmp7_, "line-fill-probability");
	_tmp9_ = self->priv->settings;
	_tmp10_ = g_settings_get_boolean (_tmp9_, "pick-difficult-blocks");
	_tmp11_ = game_new (20, 14, _tmp4_, _tmp6_, _tmp8_, _tmp10_);
	_g_object_unref0 (self->priv->game);
	self->priv->game = _tmp11_;
	_tmp12_ = self->priv->game;
	g_signal_connect_object (_tmp12_, "pause-changed", (GCallback) _quadrapassel_pause_changed_cb_game_pause_changed, self, 0);
	_tmp13_ = self->priv->game;
	g_signal_connect_object (_tmp13_, "shape-landed", (GCallback) _quadrapassel_shape_landed_cb_game_shape_landed, self, 0);
	_tmp14_ = self->priv->game;
	g_signal_connect_object (_tmp14_, "complete", (GCallback) _quadrapassel_complete_cb_game_complete, self, 0);
	_tmp15_ = self->priv->preview;
	_tmp16_ = self->priv->game;
	preview_set_game (_tmp15_, _tmp16_);
	_tmp17_ = self->priv->view;
	_tmp18_ = self->priv->game;
	game_view_set_game (_tmp17_, _tmp18_);
	_tmp19_ = self->priv->game;
	game_start (_tmp19_);
	quadrapassel_update_score (self);
	_tmp20_ = self->priv->pause_action;
	g_simple_action_set_enabled (_tmp20_, TRUE);
	_tmp21_ = self->priv->pause_play_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp21_, "app.pause");
}


static void quadrapassel_pause_changed_cb (Quadrapassel* self) {
	Game* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = game_get_paused (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		gboolean rtl = FALSE;
		GtkTextDirection _tmp3_ = 0;
		const gchar* _tmp4_ = NULL;
		gboolean _tmp5_ = FALSE;
		GtkImage* _tmp6_ = NULL;
		GtkButton* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		_tmp3_ = gtk_widget_get_default_direction ();
		rtl = _tmp3_ == GTK_TEXT_DIR_RTL;
		_tmp5_ = rtl;
		if (_tmp5_) {
			_tmp4_ = "media-playback-start-rtl-symbolic";
		} else {
			_tmp4_ = "media-playback-start-symbolic";
		}
		_tmp6_ = self->priv->pause_play_button_image;
		gtk_image_set_from_icon_name (_tmp6_, _tmp4_, GTK_ICON_SIZE_DIALOG);
		_tmp7_ = self->priv->pause_play_button;
		_tmp8_ = _ ("Unpause the game");
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp7_, _tmp8_);
	} else {
		GtkImage* _tmp9_ = NULL;
		GtkButton* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		_tmp9_ = self->priv->pause_play_button_image;
		gtk_image_set_from_icon_name (_tmp9_, "media-playback-pause-symbolic", GTK_ICON_SIZE_DIALOG);
		_tmp10_ = self->priv->pause_play_button;
		_tmp11_ = _ ("Pause the game");
		gtk_widget_set_tooltip_text ((GtkWidget*) _tmp10_, _tmp11_);
	}
}


static void quadrapassel_shape_landed_cb (Quadrapassel* self, gint* lines, int lines_length1, GList* line_blocks) {
	g_return_if_fail (self != NULL);
	quadrapassel_update_score (self);
}


static void quadrapassel_complete_cb (Quadrapassel* self) {
	GSimpleAction* _tmp0_ = NULL;
	GtkImage* _tmp1_ = NULL;
	GtkButton* _tmp2_ = NULL;
	GtkButton* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	Game* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->pause_action;
	g_simple_action_set_enabled (_tmp0_, FALSE);
	_tmp1_ = self->priv->pause_play_button_image;
	gtk_image_set_from_icon_name (_tmp1_, "view-refresh-symbolic", GTK_ICON_SIZE_DIALOG);
	_tmp2_ = self->priv->pause_play_button;
	gtk_actionable_set_action_name ((GtkActionable*) _tmp2_, "app.new-game");
	_tmp3_ = self->priv->pause_play_button;
	_tmp4_ = _ ("Start a new game");
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, _tmp4_);
	_tmp5_ = self->priv->game;
	_tmp6_ = _tmp5_->score;
	if (_tmp6_ > 0) {
		GDateTime* date = NULL;
		GDateTime* _tmp7_ = NULL;
		HistoryEntry* entry = NULL;
		GDateTime* _tmp8_ = NULL;
		Game* _tmp9_ = NULL;
		gint _tmp10_ = 0;
		HistoryEntry* _tmp11_ = NULL;
		History* _tmp12_ = NULL;
		HistoryEntry* _tmp13_ = NULL;
		History* _tmp14_ = NULL;
		HistoryEntry* _tmp15_ = NULL;
		gint _tmp16_ = 0;
		_tmp7_ = g_date_time_new_now_local ();
		date = _tmp7_;
		_tmp8_ = date;
		_tmp9_ = self->priv->game;
		_tmp10_ = _tmp9_->score;
		_tmp11_ = history_entry_new (_tmp8_, _tmp10_);
		entry = _tmp11_;
		_tmp12_ = self->priv->history;
		_tmp13_ = entry;
		history_add (_tmp12_, _tmp13_);
		_tmp14_ = self->priv->history;
		history_save (_tmp14_);
		_tmp15_ = entry;
		_tmp16_ = quadrapassel_show_scores (self, _tmp15_, TRUE);
		if (_tmp16_ == ((gint) GTK_RESPONSE_OK)) {
			quadrapassel_new_game (self);
		}
		_g_object_unref0 (entry);
		_g_date_time_unref0 (date);
	}
}


static gint quadrapassel_show_scores (Quadrapassel* self, HistoryEntry* selected_entry, gboolean show_close) {
	gint result = 0;
	ScoreDialog* dialog = NULL;
	History* _tmp0_ = NULL;
	HistoryEntry* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	ScoreDialog* _tmp3_ = NULL;
	GtkWindow* _tmp4_ = NULL;
	gint _result_ = 0;
	gint _tmp5_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->history;
	_tmp1_ = selected_entry;
	_tmp2_ = show_close;
	_tmp3_ = score_dialog_new (_tmp0_, _tmp1_, _tmp2_);
	g_object_ref_sink (_tmp3_);
	dialog = _tmp3_;
	gtk_window_set_modal ((GtkWindow*) dialog, TRUE);
	_tmp4_ = self->priv->window;
	gtk_window_set_transient_for ((GtkWindow*) dialog, _tmp4_);
	_tmp5_ = gtk_dialog_run ((GtkDialog*) dialog);
	_result_ = _tmp5_;
	gtk_widget_destroy ((GtkWidget*) dialog);
	result = _result_;
	_g_object_unref0 (dialog);
	return result;
}


static void quadrapassel_update_score (Quadrapassel* self) {
	gint score = 0;
	gint level = 0;
	gint n_lines_destroyed = 0;
	Game* _tmp0_ = NULL;
	GtkLabel* _tmp8_ = NULL;
	gint _tmp9_ = 0;
	gchar* _tmp10_ = NULL;
	gchar* _tmp11_ = NULL;
	GtkLabel* _tmp12_ = NULL;
	gint _tmp13_ = 0;
	gchar* _tmp14_ = NULL;
	gchar* _tmp15_ = NULL;
	GtkLabel* _tmp16_ = NULL;
	gint _tmp17_ = 0;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_ = NULL;
	g_return_if_fail (self != NULL);
	score = 0;
	level = 0;
	n_lines_destroyed = 0;
	_tmp0_ = self->priv->game;
	if (_tmp0_ != NULL) {
		Game* _tmp1_ = NULL;
		gint _tmp2_ = 0;
		Game* _tmp3_ = NULL;
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		Game* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		_tmp1_ = self->priv->game;
		_tmp2_ = _tmp1_->score;
		score = _tmp2_;
		_tmp3_ = self->priv->game;
		_tmp4_ = game_get_level (_tmp3_);
		_tmp5_ = _tmp4_;
		level = _tmp5_;
		_tmp6_ = self->priv->game;
		_tmp7_ = _tmp6_->n_lines_destroyed;
		n_lines_destroyed = _tmp7_;
	}
	_tmp8_ = self->priv->score_label;
	_tmp9_ = score;
	_tmp10_ = g_strdup_printf ("<big>%d</big>", _tmp9_);
	_tmp11_ = _tmp10_;
	gtk_label_set_markup (_tmp8_, _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = self->priv->level_label;
	_tmp13_ = level;
	_tmp14_ = g_strdup_printf ("<big>%d</big>", _tmp13_);
	_tmp15_ = _tmp14_;
	gtk_label_set_markup (_tmp12_, _tmp15_);
	_g_free0 (_tmp15_);
	_tmp16_ = self->priv->n_destroyed_label;
	_tmp17_ = n_lines_destroyed;
	_tmp18_ = g_strdup_printf ("<big>%d</big>", _tmp17_);
	_tmp19_ = _tmp18_;
	gtk_label_set_markup (_tmp16_, _tmp19_);
	_g_free0 (_tmp19_);
}


static void quadrapassel_help_cb (Quadrapassel* self) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GtkWindow* _tmp0_ = NULL;
		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:quadrapassel", _tmp2_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("quadrapassel.vala:733: Failed to show help: %s", _tmp4_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_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 quadrapassel_about_cb (Quadrapassel* self) {
	gchar** authors = NULL;
	gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint authors_length1 = 0;
	gint _authors_size_ = 0;
	gchar** documenters = NULL;
	gchar* _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint documenters_length1 = 0;
	gint _documenters_size_ = 0;
	GtkWindow* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("GNOME Games Team");
	_tmp1_ = g_new0 (gchar*, 2 + 1);
	_tmp1_[0] = _tmp0_;
	_tmp1_[1] = NULL;
	authors = _tmp1_;
	authors_length1 = 2;
	_authors_size_ = authors_length1;
	_tmp2_ = g_strdup ("Angela Boyle");
	_tmp3_ = g_new0 (gchar*, 2 + 1);
	_tmp3_[0] = _tmp2_;
	_tmp3_[1] = NULL;
	documenters = _tmp3_;
	documenters_length1 = 2;
	_documenters_size_ = documenters_length1;
	_tmp4_ = self->priv->window;
	_tmp5_ = _ ("Quadrapassel");
	_tmp6_ = _ ("A classic game of fitting falling blocks together\n" \
"\n" \
"Quadrapassel is a part of GNOME Games.");
	_tmp7_ = _ ("translator-credits");
	gtk_show_about_dialog (_tmp4_, "program-name", _tmp5_, "version", VERSION, "comments", _tmp6_, "copyright", "Copyright © 1999 J. Marcin Gorycki, 2000–2009 Others", "license-type", GTK_LICENSE_GPL_2_0, "authors", authors, "documenters", documenters, "translator-credits", _tmp7_, "logo-icon-name", "quadrapassel", "website", "https://wiki.gnome.org/Apps/Quadrapassel", NULL, NULL);
	documenters = (_vala_array_free (documenters, documenters_length1, (GDestroyNotify) g_free), NULL);
	authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
}


static void quadrapassel_scores_cb (Quadrapassel* self) {
	g_return_if_fail (self != NULL);
	quadrapassel_show_scores (self, NULL, FALSE);
}


gint quadrapassel_main (gchar** args, int args_length1) {
	gint result = 0;
	GOptionContext* context = NULL;
	GOptionContext* _tmp0_ = NULL;
	GOptionContext* _tmp1_ = NULL;
	GOptionGroup* _tmp2_ = NULL;
	GOptionContext* _tmp3_ = NULL;
	GOptionGroup* _tmp4_ = NULL;
	const gchar* _tmp9_ = NULL;
	Quadrapassel* app = NULL;
	Quadrapassel* _tmp19_ = NULL;
	Quadrapassel* _tmp20_ = NULL;
	gchar** _tmp21_ = NULL;
	gint _tmp21__length1 = 0;
	gint _tmp22_ = 0;
	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;
	_tmp2_ = gtk_get_option_group (TRUE);
	g_option_context_add_group (_tmp1_, _tmp2_);
	_tmp3_ = context;
	_tmp4_ = clutter_get_option_group_without_init ();
	g_option_context_add_group (_tmp3_, _tmp4_);
	{
		GOptionContext* _tmp5_ = NULL;
		_tmp5_ = context;
		g_option_context_parse (_tmp5_, &args_length1, &args, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		FILE* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp6_ = stderr;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		fprintf (_tmp6_, "%s\n", _tmp8_);
		result = EXIT_FAILURE;
		_g_error_free0 (e);
		_g_option_context_free0 (context);
		return result;
	}
	__finally1:
	if (G_UNLIKELY (_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;
	}
	_tmp9_ = _ ("Quadrapassel");
	g_set_application_name (_tmp9_);
	gtk_window_set_default_icon_name ("quadrapassel");
	{
		GOptionEntry* _tmp10_ = NULL;
		GOptionEntry* _tmp11_ = NULL;
		gint _tmp11__length1 = 0;
		_tmp10_ = g_new0 (GOptionEntry, 0);
		_tmp11_ = _tmp10_;
		_tmp11__length1 = 0;
		gtk_clutter_init_with_args (&args_length1, &args, "", _tmp11_, NULL, &_inner_error_);
		_tmp11_ = (g_free (_tmp11_), NULL);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch2_g_error;
		}
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
		GtkMessageDialog* dialog = NULL;
		GError* _tmp12_ = NULL;
		const gchar* _tmp13_ = NULL;
		GtkMessageDialog* _tmp14_ = NULL;
		GtkMessageDialog* _tmp15_ = NULL;
		const gchar* _tmp16_ = NULL;
		GtkMessageDialog* _tmp17_ = NULL;
		GtkMessageDialog* _tmp18_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		_tmp14_ = (GtkMessageDialog*) gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_NONE, "Unable to initialize Clutter:\n%s", _tmp13_);
		g_object_ref_sink (_tmp14_);
		dialog = _tmp14_;
		_tmp15_ = dialog;
		_tmp16_ = g_get_application_name ();
		gtk_window_set_title ((GtkWindow*) _tmp15_, _tmp16_);
		_tmp17_ = dialog;
		gtk_dialog_run ((GtkDialog*) _tmp17_);
		_tmp18_ = dialog;
		gtk_widget_destroy ((GtkWidget*) _tmp18_);
		result = EXIT_FAILURE;
		_g_object_unref0 (dialog);
		_g_error_free0 (e);
		_g_option_context_free0 (context);
		return result;
	}
	__finally2:
	if (G_UNLIKELY (_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;
	}
	_tmp19_ = quadrapassel_new ();
	app = _tmp19_;
	_tmp20_ = app;
	_tmp21_ = args;
	_tmp21__length1 = args_length1;
	_tmp22_ = g_application_run ((GApplication*) _tmp20_, _tmp21__length1, _tmp21_);
	result = _tmp22_;
	_g_object_unref0 (app);
	_g_option_context_free0 (context);
	return result;
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
	return quadrapassel_main (argv, argc);
}


static void quadrapassel_class_init (QuadrapasselClass * klass) {
	quadrapassel_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (QuadrapasselPrivate));
	((GApplicationClass *) klass)->startup = quadrapassel_real_startup;
	((GApplicationClass *) klass)->shutdown = quadrapassel_real_shutdown;
	((GApplicationClass *) klass)->activate = quadrapassel_real_activate;
	G_OBJECT_CLASS (klass)->finalize = quadrapassel_finalize;
}


static void quadrapassel_instance_init (Quadrapassel * self) {
	self->priv = QUADRAPASSEL_GET_PRIVATE (self);
	self->priv->game = NULL;
}


static void quadrapassel_finalize (GObject* obj) {
	Quadrapassel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_QUADRAPASSEL, Quadrapassel);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->game);
	_g_object_unref0 (self->priv->view);
	_g_object_unref0 (self->priv->preview);
	_g_object_unref0 (self->priv->score_label);
	_g_object_unref0 (self->priv->n_destroyed_label);
	_g_object_unref0 (self->priv->level_label);
	_g_object_unref0 (self->priv->history);
	_g_object_unref0 (self->priv->pause_action);
	_g_object_unref0 (self->priv->pause_play_button);
	_g_object_unref0 (self->priv->pause_play_button_image);
	_g_object_unref0 (self->priv->preferences_dialog);
	_g_object_unref0 (self->priv->starting_level_spin);
	_g_object_unref0 (self->priv->theme_preview);
	_g_object_unref0 (self->priv->fill_height_spinner);
	_g_object_unref0 (self->priv->fill_prob_spinner);
	_g_object_unref0 (self->priv->do_preview_toggle);
	_g_object_unref0 (self->priv->difficult_blocks_toggle);
	_g_object_unref0 (self->priv->rotate_counter_clock_wise_toggle);
	_g_object_unref0 (self->priv->show_shadow_toggle);
	_g_object_unref0 (self->priv->sound_toggle);
	_g_object_unref0 (self->priv->controls_model);
	G_OBJECT_CLASS (quadrapassel_parent_class)->finalize (obj);
}


GType quadrapassel_get_type (void) {
	static volatile gsize quadrapassel_type_id__volatile = 0;
	if (g_once_init_enter (&quadrapassel_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (QuadrapasselClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) quadrapassel_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Quadrapassel), 0, (GInstanceInitFunc) quadrapassel_instance_init, NULL };
		GType quadrapassel_type_id;
		quadrapassel_type_id = g_type_register_static (gtk_application_get_type (), "Quadrapassel", &g_define_type_info, 0);
		g_once_init_leave (&quadrapassel_type_id__volatile, quadrapassel_type_id);
	}
	return quadrapassel_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);
}



