/* theme-selector-dialog.c generated by valac 0.34.2, the Vala compiler
 * generated from theme-selector-dialog.vala, do not modify */


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


#define TYPE_MINEFIELD (minefield_get_type ())
#define MINEFIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MINEFIELD, Minefield))
#define MINEFIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MINEFIELD, MinefieldClass))
#define IS_MINEFIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MINEFIELD))
#define IS_MINEFIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MINEFIELD))
#define MINEFIELD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MINEFIELD, MinefieldClass))

typedef struct _Minefield Minefield;
typedef struct _MinefieldClass MinefieldClass;
typedef struct _MinefieldPrivate MinefieldPrivate;

#define TYPE_LOCATION (location_get_type ())
#define LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LOCATION, Location))
#define LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LOCATION, LocationClass))
#define IS_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LOCATION))
#define IS_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LOCATION))
#define LOCATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LOCATION, LocationClass))

typedef struct _Location Location;
typedef struct _LocationClass LocationClass;

#define TYPE_PREVIEW_FIELD (preview_field_get_type ())
#define PREVIEW_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PREVIEW_FIELD, PreviewField))
#define PREVIEW_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PREVIEW_FIELD, PreviewFieldClass))
#define IS_PREVIEW_FIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PREVIEW_FIELD))
#define IS_PREVIEW_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PREVIEW_FIELD))
#define PREVIEW_FIELD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PREVIEW_FIELD, PreviewFieldClass))

typedef struct _PreviewField PreviewField;
typedef struct _PreviewFieldClass PreviewFieldClass;
typedef struct _PreviewFieldPrivate PreviewFieldPrivate;

#define TYPE_NEIGHBOUR (neighbour_get_type ())
typedef struct _Neighbour Neighbour;
typedef struct _LocationPrivate LocationPrivate;

#define TYPE_FLAG_TYPE (flag_type_get_type ())

#define TYPE_THEME_SELECTOR_DIALOG (theme_selector_dialog_get_type ())
#define THEME_SELECTOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME_SELECTOR_DIALOG, ThemeSelectorDialog))
#define THEME_SELECTOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME_SELECTOR_DIALOG, ThemeSelectorDialogClass))
#define IS_THEME_SELECTOR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME_SELECTOR_DIALOG))
#define IS_THEME_SELECTOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME_SELECTOR_DIALOG))
#define THEME_SELECTOR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME_SELECTOR_DIALOG, ThemeSelectorDialogClass))

typedef struct _ThemeSelectorDialog ThemeSelectorDialog;
typedef struct _ThemeSelectorDialogClass ThemeSelectorDialogClass;
typedef struct _ThemeSelectorDialogPrivate ThemeSelectorDialogPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_MINEFIELD_VIEW (minefield_view_get_type ())
#define MINEFIELD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MINEFIELD_VIEW, MinefieldView))
#define MINEFIELD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MINEFIELD_VIEW, MinefieldViewClass))
#define IS_MINEFIELD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MINEFIELD_VIEW))
#define IS_MINEFIELD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MINEFIELD_VIEW))
#define MINEFIELD_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MINEFIELD_VIEW, MinefieldViewClass))

typedef struct _MinefieldView MinefieldView;
typedef struct _MinefieldViewClass MinefieldViewClass;
typedef struct _Block3Data Block3Data;

struct _Minefield {
	GObject parent_instance;
	MinefieldPrivate * priv;
	guint width;
	guint height;
	guint n_mines;
	Location** locations;
	gint locations_length1;
	gint locations_length2;
	gboolean exploded;
	gboolean placed_mines;
	gboolean _use_autoflag;
};

struct _MinefieldClass {
	GObjectClass parent_class;
};

struct _PreviewField {
	Minefield parent_instance;
	PreviewFieldPrivate * priv;
};

struct _PreviewFieldClass {
	MinefieldClass parent_class;
};

struct _Neighbour {
	gint x;
	gint y;
};

typedef enum  {
	FLAG_TYPE_NONE,
	FLAG_TYPE_FLAG,
	FLAG_TYPE_MAYBE
} FlagType;

struct _Location {
	GObject parent_instance;
	LocationPrivate * priv;
	gboolean has_mine;
	gboolean cleared;
	FlagType flag;
	gint adjacent_mines;
};

struct _LocationClass {
	GObjectClass parent_class;
};

struct _ThemeSelectorDialog {
	GtkDialog parent_instance;
	ThemeSelectorDialogPrivate * priv;
};

struct _ThemeSelectorDialogClass {
	GtkDialogClass parent_class;
};

struct _ThemeSelectorDialogPrivate {
	GtkButton* previous;
	GtkButton* next;
	GSettings* settings;
};

struct _Block3Data {
	int _ref_count_;
	ThemeSelectorDialog* self;
	MinefieldView* minefield;
	GList* themes;
	gint current_index;
};


static gpointer preview_field_parent_class = NULL;
static gpointer theme_selector_dialog_parent_class = NULL;

GType minefield_get_type (void) G_GNUC_CONST;
GType location_get_type (void) G_GNUC_CONST;
GType preview_field_get_type (void) G_GNUC_CONST;
enum  {
	PREVIEW_FIELD_DUMMY_PROPERTY
};
GType neighbour_get_type (void) G_GNUC_CONST;
Neighbour* neighbour_dup (const Neighbour* self);
void neighbour_free (Neighbour* self);
#define PREVIEW_FIELD_SIZE 7
PreviewField* preview_field_new (void);
PreviewField* preview_field_construct (GType object_type);
Minefield* minefield_new (guint width, guint height, guint n_mines);
Minefield* minefield_construct (GType object_type, guint width, guint height, guint n_mines);
void preview_field_place_mines (PreviewField* self, guint x, guint y);
GType flag_type_get_type (void) G_GNUC_CONST;
gboolean minefield_is_location (Minefield* self, gint x, gint y);
GType theme_selector_dialog_get_type (void) G_GNUC_CONST;
#define THEME_SELECTOR_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_THEME_SELECTOR_DIALOG, ThemeSelectorDialogPrivate))
enum  {
	THEME_SELECTOR_DIALOG_DUMMY_PROPERTY
};
GList* theme_selector_dialog_list_themes (ThemeSelectorDialog* self);
static void _g_free0_ (gpointer var);
static void _g_list_free__g_free0_ (GList* self);
GType minefield_view_get_type (void) G_GNUC_CONST;
static GtkWidget* theme_selector_dialog_create_preview_widget (ThemeSelectorDialog* self, MinefieldView** view);
MinefieldView* minefield_view_new (GSettings* settings);
MinefieldView* minefield_view_construct (GType object_type, GSettings* settings);
void minefield_view_set_minefield (MinefieldView* self, Minefield* value);
static void theme_selector_dialog_reveal_nonmines (ThemeSelectorDialog* self, MinefieldView* view);
ThemeSelectorDialog* theme_selector_dialog_new (GtkWindow* parent);
ThemeSelectorDialog* theme_selector_dialog_construct (GType object_type, GtkWindow* parent);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void __lambda16_ (Block3Data* _data3_);
static void theme_selector_dialog_switch_theme_preview (ThemeSelectorDialog* self, gint to_index, GList* themes);
static void theme_selector_dialog_update_sensitivities (ThemeSelectorDialog* self, GList* themes, gint current_index);
void minefield_view_refresh (MinefieldView* self);
static void ___lambda16__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda17_ (Block3Data* _data3_);
static void ___lambda17__gtk_button_clicked (GtkButton* _sender, gpointer self);
Minefield* minefield_view_get_minefield (MinefieldView* self);
gboolean minefield_has_mine (Minefield* self, guint x, guint y);
void minefield_clear_mine (Minefield* self, guint x, guint y);
void minefield_multi_release (Minefield* self, guint x, guint y);
void minefield_view_toggle_mark (MinefieldView* self, guint x, guint y);
static void theme_selector_dialog_finalize (GObject* obj);

static const Neighbour PREVIEW_FIELD_neighbour_map[8] = {{-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}};

PreviewField* preview_field_construct (GType object_type) {
	PreviewField * self = NULL;
	self = (PreviewField*) minefield_construct (object_type, (guint) PREVIEW_FIELD_SIZE, (guint) PREVIEW_FIELD_SIZE, (guint) (3 * PREVIEW_FIELD_SIZE));
	preview_field_place_mines (self, (guint) 0, (guint) 0);
	((Minefield*) self)->placed_mines = TRUE;
	return self;
}


PreviewField* preview_field_new (void) {
	return preview_field_construct (TYPE_PREVIEW_FIELD);
}


void preview_field_place_mines (PreviewField* self, guint x, guint y) {
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_ = 0;
				Location** _tmp3_ = NULL;
				gint _tmp3__length1 = 0;
				gint _tmp3__length2 = 0;
				gint _tmp4_ = 0;
				Location* _tmp5_ = NULL;
				gint _tmp6_ = 0;
				if (!_tmp0_) {
					gint _tmp1_ = 0;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = i;
				if (!(_tmp2_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp3_ = ((Minefield*) self)->locations;
				_tmp3__length1 = ((Minefield*) self)->locations_length1;
				_tmp3__length2 = ((Minefield*) self)->locations_length2;
				_tmp4_ = i;
				_tmp5_ = _tmp3_[(_tmp4_ * _tmp3__length2) + 0];
				_tmp6_ = i;
				_tmp5_->has_mine = _tmp6_ >= 5;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp7_ = FALSE;
			_tmp7_ = TRUE;
			while (TRUE) {
				gint _tmp9_ = 0;
				Location** _tmp10_ = NULL;
				gint _tmp10__length1 = 0;
				gint _tmp10__length2 = 0;
				gint _tmp11_ = 0;
				Location* _tmp12_ = NULL;
				if (!_tmp7_) {
					gint _tmp8_ = 0;
					_tmp8_ = i;
					i = _tmp8_ + 1;
				}
				_tmp7_ = FALSE;
				_tmp9_ = i;
				if (!(_tmp9_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp10_ = ((Minefield*) self)->locations;
				_tmp10__length1 = ((Minefield*) self)->locations_length1;
				_tmp10__length2 = ((Minefield*) self)->locations_length2;
				_tmp11_ = i;
				_tmp12_ = _tmp10_[(_tmp11_ * _tmp10__length2) + 1];
				_tmp12_->has_mine = FALSE;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp13_ = FALSE;
			_tmp13_ = TRUE;
			while (TRUE) {
				gint _tmp15_ = 0;
				gboolean _tmp16_ = FALSE;
				gint _tmp17_ = 0;
				Location** _tmp19_ = NULL;
				gint _tmp19__length1 = 0;
				gint _tmp19__length2 = 0;
				gint _tmp20_ = 0;
				Location* _tmp21_ = NULL;
				if (!_tmp13_) {
					gint _tmp14_ = 0;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp13_ = FALSE;
				_tmp15_ = i;
				if (!(_tmp15_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp17_ = i;
				if (_tmp17_ == 0) {
					_tmp16_ = TRUE;
				} else {
					gint _tmp18_ = 0;
					_tmp18_ = i;
					_tmp16_ = _tmp18_ == 3;
				}
				_tmp19_ = ((Minefield*) self)->locations;
				_tmp19__length1 = ((Minefield*) self)->locations_length1;
				_tmp19__length2 = ((Minefield*) self)->locations_length2;
				_tmp20_ = i;
				_tmp21_ = _tmp19_[(_tmp20_ * _tmp19__length2) + 2];
				_tmp21_->has_mine = _tmp16_;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp22_ = FALSE;
			_tmp22_ = TRUE;
			while (TRUE) {
				gint _tmp24_ = 0;
				gboolean _tmp25_ = FALSE;
				gint _tmp26_ = 0;
				Location** _tmp28_ = NULL;
				gint _tmp28__length1 = 0;
				gint _tmp28__length2 = 0;
				gint _tmp29_ = 0;
				Location* _tmp30_ = NULL;
				if (!_tmp22_) {
					gint _tmp23_ = 0;
					_tmp23_ = i;
					i = _tmp23_ + 1;
				}
				_tmp22_ = FALSE;
				_tmp24_ = i;
				if (!(_tmp24_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp26_ = i;
				if (_tmp26_ == 0) {
					_tmp25_ = TRUE;
				} else {
					gint _tmp27_ = 0;
					_tmp27_ = i;
					_tmp25_ = _tmp27_ == 2;
				}
				_tmp28_ = ((Minefield*) self)->locations;
				_tmp28__length1 = ((Minefield*) self)->locations_length1;
				_tmp28__length2 = ((Minefield*) self)->locations_length2;
				_tmp29_ = i;
				_tmp30_ = _tmp28_[(_tmp29_ * _tmp28__length2) + 3];
				_tmp30_->has_mine = _tmp25_;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp31_ = FALSE;
			_tmp31_ = TRUE;
			while (TRUE) {
				gint _tmp33_ = 0;
				gboolean _tmp34_ = FALSE;
				gboolean _tmp35_ = FALSE;
				gint _tmp36_ = 0;
				Location** _tmp39_ = NULL;
				gint _tmp39__length1 = 0;
				gint _tmp39__length2 = 0;
				gint _tmp40_ = 0;
				Location* _tmp41_ = NULL;
				if (!_tmp31_) {
					gint _tmp32_ = 0;
					_tmp32_ = i;
					i = _tmp32_ + 1;
				}
				_tmp31_ = FALSE;
				_tmp33_ = i;
				if (!(_tmp33_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp36_ = i;
				if (_tmp36_ == 0) {
					_tmp35_ = TRUE;
				} else {
					gint _tmp37_ = 0;
					_tmp37_ = i;
					_tmp35_ = _tmp37_ == 2;
				}
				if (_tmp35_) {
					_tmp34_ = TRUE;
				} else {
					gint _tmp38_ = 0;
					_tmp38_ = i;
					_tmp34_ = _tmp38_ > 3;
				}
				_tmp39_ = ((Minefield*) self)->locations;
				_tmp39__length1 = ((Minefield*) self)->locations_length1;
				_tmp39__length2 = ((Minefield*) self)->locations_length2;
				_tmp40_ = i;
				_tmp41_ = _tmp39_[(_tmp40_ * _tmp39__length2) + 4];
				_tmp41_->has_mine = _tmp34_;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp42_ = FALSE;
			_tmp42_ = TRUE;
			while (TRUE) {
				gint _tmp44_ = 0;
				Location** _tmp45_ = NULL;
				gint _tmp45__length1 = 0;
				gint _tmp45__length2 = 0;
				gint _tmp46_ = 0;
				Location* _tmp47_ = NULL;
				gint _tmp48_ = 0;
				if (!_tmp42_) {
					gint _tmp43_ = 0;
					_tmp43_ = i;
					i = _tmp43_ + 1;
				}
				_tmp42_ = FALSE;
				_tmp44_ = i;
				if (!(_tmp44_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp45_ = ((Minefield*) self)->locations;
				_tmp45__length1 = ((Minefield*) self)->locations_length1;
				_tmp45__length2 = ((Minefield*) self)->locations_length2;
				_tmp46_ = i;
				_tmp47_ = _tmp45_[(_tmp46_ * _tmp45__length2) + 5];
				_tmp48_ = i;
				_tmp47_->has_mine = (_tmp48_ % 2) == 0;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp49_ = FALSE;
			_tmp49_ = TRUE;
			while (TRUE) {
				gint _tmp51_ = 0;
				Location** _tmp52_ = NULL;
				gint _tmp52__length1 = 0;
				gint _tmp52__length2 = 0;
				gint _tmp53_ = 0;
				Location* _tmp54_ = NULL;
				gint _tmp55_ = 0;
				if (!_tmp49_) {
					gint _tmp50_ = 0;
					_tmp50_ = i;
					i = _tmp50_ + 1;
				}
				_tmp49_ = FALSE;
				_tmp51_ = i;
				if (!(_tmp51_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				_tmp52_ = ((Minefield*) self)->locations;
				_tmp52__length1 = ((Minefield*) self)->locations_length1;
				_tmp52__length2 = ((Minefield*) self)->locations_length2;
				_tmp53_ = i;
				_tmp54_ = _tmp52_[(_tmp53_ * _tmp52__length2) + 6];
				_tmp55_ = i;
				_tmp54_->has_mine = _tmp55_ != 1;
			}
		}
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp56_ = FALSE;
			_tmp56_ = TRUE;
			while (TRUE) {
				gint _tmp58_ = 0;
				if (!_tmp56_) {
					gint _tmp57_ = 0;
					_tmp57_ = i;
					i = _tmp57_ + 1;
				}
				_tmp56_ = FALSE;
				_tmp58_ = i;
				if (!(_tmp58_ < PREVIEW_FIELD_SIZE)) {
					break;
				}
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp59_ = FALSE;
						_tmp59_ = TRUE;
						while (TRUE) {
							gint _tmp61_ = 0;
							if (!_tmp59_) {
								gint _tmp60_ = 0;
								_tmp60_ = j;
								j = _tmp60_ + 1;
							}
							_tmp59_ = FALSE;
							_tmp61_ = j;
							if (!(_tmp61_ < PREVIEW_FIELD_SIZE)) {
								break;
							}
							{
								Neighbour* neighbour_collection = NULL;
								gint neighbour_collection_length1 = 0;
								gint _neighbour_collection_size_ = 0;
								gint neighbour_it = 0;
								neighbour_collection = PREVIEW_FIELD_neighbour_map;
								neighbour_collection_length1 = G_N_ELEMENTS (PREVIEW_FIELD_neighbour_map);
								for (neighbour_it = 0; neighbour_it < G_N_ELEMENTS (PREVIEW_FIELD_neighbour_map); neighbour_it = neighbour_it + 1) {
									Neighbour neighbour = {0};
									neighbour = neighbour_collection[neighbour_it];
									{
										gint nx = 0;
										gint _tmp62_ = 0;
										Neighbour _tmp63_ = {0};
										gint _tmp64_ = 0;
										gint ny = 0;
										gint _tmp65_ = 0;
										Neighbour _tmp66_ = {0};
										gint _tmp67_ = 0;
										gboolean _tmp68_ = FALSE;
										gint _tmp69_ = 0;
										gint _tmp70_ = 0;
										gboolean _tmp71_ = FALSE;
										_tmp62_ = i;
										_tmp63_ = neighbour;
										_tmp64_ = _tmp63_.x;
										nx = _tmp62_ + _tmp64_;
										_tmp65_ = j;
										_tmp66_ = neighbour;
										_tmp67_ = _tmp66_.y;
										ny = _tmp65_ + _tmp67_;
										_tmp69_ = nx;
										_tmp70_ = ny;
										_tmp71_ = minefield_is_location ((Minefield*) self, _tmp69_, _tmp70_);
										if (_tmp71_) {
											Location** _tmp72_ = NULL;
											gint _tmp72__length1 = 0;
											gint _tmp72__length2 = 0;
											gint _tmp73_ = 0;
											gint _tmp74_ = 0;
											Location* _tmp75_ = NULL;
											gboolean _tmp76_ = FALSE;
											_tmp72_ = ((Minefield*) self)->locations;
											_tmp72__length1 = ((Minefield*) self)->locations_length1;
											_tmp72__length2 = ((Minefield*) self)->locations_length2;
											_tmp73_ = nx;
											_tmp74_ = ny;
											_tmp75_ = _tmp72_[(_tmp73_ * _tmp72__length2) + _tmp74_];
											_tmp76_ = _tmp75_->has_mine;
											_tmp68_ = _tmp76_;
										} else {
											_tmp68_ = FALSE;
										}
										if (_tmp68_) {
											Location** _tmp77_ = NULL;
											gint _tmp77__length1 = 0;
											gint _tmp77__length2 = 0;
											gint _tmp78_ = 0;
											gint _tmp79_ = 0;
											Location* _tmp80_ = NULL;
											gint _tmp81_ = 0;
											_tmp77_ = ((Minefield*) self)->locations;
											_tmp77__length1 = ((Minefield*) self)->locations_length1;
											_tmp77__length2 = ((Minefield*) self)->locations_length2;
											_tmp78_ = i;
											_tmp79_ = j;
											_tmp80_ = _tmp77_[(_tmp78_ * _tmp77__length2) + _tmp79_];
											_tmp81_ = _tmp80_->adjacent_mines;
											_tmp80_->adjacent_mines = _tmp81_ + 1;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}


static void preview_field_class_init (PreviewFieldClass * klass) {
	preview_field_parent_class = g_type_class_peek_parent (klass);
}


static void preview_field_instance_init (PreviewField * self) {
}


GType preview_field_get_type (void) {
	static volatile gsize preview_field_type_id__volatile = 0;
	if (g_once_init_enter (&preview_field_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PreviewFieldClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) preview_field_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PreviewField), 0, (GInstanceInitFunc) preview_field_instance_init, NULL };
		GType preview_field_type_id;
		preview_field_type_id = g_type_register_static (TYPE_MINEFIELD, "PreviewField", &g_define_type_info, 0);
		g_once_init_leave (&preview_field_type_id__volatile, preview_field_type_id);
	}
	return preview_field_type_id__volatile;
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _g_list_free__g_free0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_free0_, NULL);
	g_list_free (self);
}


GList* theme_selector_dialog_list_themes (ThemeSelectorDialog* self) {
	GList* result = NULL;
	gchar* themes_dir = NULL;
	gchar* _tmp0_ = NULL;
	GList* themes = NULL;
	GFile* file = NULL;
	const gchar* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_build_path (G_DIR_SEPARATOR_S, DATA_DIRECTORY, "themes", NULL);
	themes_dir = _tmp0_;
	themes = NULL;
	_tmp1_ = themes_dir;
	_tmp2_ = g_file_new_for_path (_tmp1_);
	file = _tmp2_;
	{
		GFileEnumerator* enumerator = NULL;
		GFile* _tmp3_ = NULL;
		GFileEnumerator* _tmp4_ = NULL;
		GFileInfo* info = NULL;
		_tmp3_ = file;
		_tmp4_ = g_file_enumerate_children (_tmp3_, "standard::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_);
		enumerator = _tmp4_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch5_g_error;
		}
		info = NULL;
		while (TRUE) {
			GFileInfo* _tmp5_ = NULL;
			GFileEnumerator* _tmp6_ = NULL;
			GFileInfo* _tmp7_ = NULL;
			GFileInfo* _tmp8_ = NULL;
			GFileInfo* _tmp9_ = NULL;
			GFileInfo* _tmp10_ = NULL;
			GFileType _tmp11_ = 0;
			_tmp6_ = enumerator;
			_tmp7_ = g_file_enumerator_next_file (_tmp6_, NULL, &_inner_error_);
			_tmp5_ = _tmp7_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				_g_object_unref0 (info);
				_g_object_unref0 (enumerator);
				goto __catch5_g_error;
			}
			_tmp8_ = _tmp5_;
			_tmp5_ = NULL;
			_g_object_unref0 (info);
			info = _tmp8_;
			_tmp9_ = info;
			if (!(_tmp9_ != NULL)) {
				_g_object_unref0 (_tmp5_);
				break;
			}
			_tmp10_ = info;
			_tmp11_ = g_file_info_get_file_type (_tmp10_);
			if (_tmp11_ == G_FILE_TYPE_DIRECTORY) {
				GFileInfo* _tmp12_ = NULL;
				const gchar* _tmp13_ = NULL;
				gchar* _tmp14_ = NULL;
				_tmp12_ = info;
				_tmp13_ = g_file_info_get_name (_tmp12_);
				_tmp14_ = g_strdup (_tmp13_);
				themes = g_list_append (themes, _tmp14_);
			}
			_g_object_unref0 (_tmp5_);
		}
		_g_object_unref0 (info);
		_g_object_unref0 (enumerator);
	}
	goto __finally5;
	__catch5_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp15_ = NULL;
		const gchar* _tmp16_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp15_ = themes_dir;
		_tmp16_ = e->message;
		g_error ("theme-selector-dialog.vala:82: Error enumerating themes from directory" \
" %s : %s\n", _tmp15_, _tmp16_);
		_g_error_free0 (e);
	}
	__finally5:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (file);
		__g_list_free__g_free0_0 (themes);
		_g_free0 (themes_dir);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	result = themes;
	_g_object_unref0 (file);
	_g_free0 (themes_dir);
	return result;
}


static GtkWidget* theme_selector_dialog_create_preview_widget (ThemeSelectorDialog* self, MinefieldView** view) {
	MinefieldView* _vala_view = NULL;
	GtkWidget* result = NULL;
	GSettings* _tmp0_ = NULL;
	MinefieldView* _tmp1_ = NULL;
	PreviewField* _tmp2_ = NULL;
	PreviewField* _tmp3_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp4_ = NULL;
	GtkAspectFrame* frame = NULL;
	GtkAspectFrame* _tmp5_ = NULL;
	GtkCheckButton* animations_check = NULL;
	const gchar* _tmp6_ = NULL;
	GtkCheckButton* _tmp7_ = NULL;
	GValue _tmp8_ = {0};
	GtkSettings* _tmp9_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = minefield_view_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (_vala_view);
	_vala_view = _tmp1_;
	_tmp2_ = preview_field_new ();
	_tmp3_ = _tmp2_;
	minefield_view_set_minefield (_vala_view, (Minefield*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	g_object_ref_sink (_tmp4_);
	box = _tmp4_;
	_tmp5_ = (GtkAspectFrame*) gtk_aspect_frame_new (NULL, 0.5f, 0.5f, 1.0f, FALSE);
	g_object_ref_sink (_tmp5_);
	frame = _tmp5_;
	gtk_container_set_border_width ((GtkContainer*) frame, (guint) 6);
	gtk_container_add ((GtkContainer*) frame, (GtkWidget*) _vala_view);
	theme_selector_dialog_reveal_nonmines (self, _vala_view);
	gtk_box_pack_start (box, (GtkWidget*) frame, TRUE, TRUE, (guint) 0);
	_tmp6_ = _ ("Use _animations");
	_tmp7_ = (GtkCheckButton*) gtk_check_button_new_with_mnemonic (_tmp6_);
	g_object_ref_sink (_tmp7_);
	animations_check = _tmp7_;
	g_value_init (&_tmp8_, GTK_TYPE_ALIGN);
	g_value_set_enum (&_tmp8_, GTK_ALIGN_CENTER);
	g_object_set_property ((GObject*) animations_check, "halign", &_tmp8_);
	G_IS_VALUE (&_tmp8_) ? (g_value_unset (&_tmp8_), NULL) : NULL;
	gtk_box_pack_start (box, (GtkWidget*) animations_check, FALSE, FALSE, (guint) 0);
	_tmp9_ = gtk_settings_get_default ();
	g_object_bind_property_with_closures ((GObject*) _tmp9_, "gtk-enable-animations", (GObject*) animations_check, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
	result = (GtkWidget*) box;
	_g_object_unref0 (animations_check);
	_g_object_unref0 (frame);
	if (view) {
		*view = _vala_view;
	} else {
		_g_object_unref0 (_vala_view);
	}
	return result;
}


static Block3Data* block3_data_ref (Block3Data* _data3_) {
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}


static void block3_data_unref (void * _userdata_) {
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		ThemeSelectorDialog* self;
		self = _data3_->self;
		__g_list_free__g_free0_0 (_data3_->themes);
		_g_object_unref0 (_data3_->minefield);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}


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


static void __lambda16_ (Block3Data* _data3_) {
	ThemeSelectorDialog* self;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GList* _tmp2_ = NULL;
	GList* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	MinefieldView* _tmp5_ = NULL;
	self = _data3_->self;
	_tmp0_ = _data3_->current_index;
	_data3_->current_index = _tmp0_ + 1;
	_tmp1_ = _data3_->current_index;
	_tmp2_ = _data3_->themes;
	theme_selector_dialog_switch_theme_preview (self, _tmp1_, _tmp2_);
	_tmp3_ = _data3_->themes;
	_tmp4_ = _data3_->current_index;
	theme_selector_dialog_update_sensitivities (self, _tmp3_, _tmp4_);
	_tmp5_ = _data3_->minefield;
	minefield_view_refresh (_tmp5_);
}


static void ___lambda16__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda16_ (self);
}


static void __lambda17_ (Block3Data* _data3_) {
	ThemeSelectorDialog* self;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GList* _tmp2_ = NULL;
	GList* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	MinefieldView* _tmp5_ = NULL;
	self = _data3_->self;
	_tmp0_ = _data3_->current_index;
	_data3_->current_index = _tmp0_ - 1;
	_tmp1_ = _data3_->current_index;
	_tmp2_ = _data3_->themes;
	theme_selector_dialog_switch_theme_preview (self, _tmp1_, _tmp2_);
	_tmp3_ = _data3_->themes;
	_tmp4_ = _data3_->current_index;
	theme_selector_dialog_update_sensitivities (self, _tmp3_, _tmp4_);
	_tmp5_ = _data3_->minefield;
	minefield_view_refresh (_tmp5_);
}


static void ___lambda17__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda17_ (self);
}


ThemeSelectorDialog* theme_selector_dialog_construct (GType object_type, GtkWindow* parent) {
	ThemeSelectorDialog * self = NULL;
	Block3Data* _data3_;
	gchar* desktop = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_ = NULL;
	gboolean use_headerbar = FALSE;
	gint _tmp5_ = 0;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_ = NULL;
	GtkWindow* _tmp8_ = NULL;
	GtkButton* _tmp9_ = NULL;
	GtkButton* _tmp10_ = NULL;
	GtkButton* _tmp11_ = NULL;
	GtkButton* _tmp12_ = NULL;
	GtkButton* _tmp13_ = NULL;
	GtkButton* _tmp14_ = NULL;
	GtkBox* buttons_holder = NULL;
	GtkBox* _tmp15_ = NULL;
	gboolean _tmp16_ = FALSE;
	GList* _tmp43_ = NULL;
	gchar* current_theme = NULL;
	GSettings* _tmp44_ = NULL;
	gchar* _tmp45_ = NULL;
	GtkButton* _tmp58_ = NULL;
	GtkButton* _tmp59_ = NULL;
	GList* _tmp60_ = NULL;
	gint _tmp61_ = 0;
	MinefieldView* _tmp62_ = NULL;
	g_return_val_if_fail (parent != NULL, NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_tmp0_ = g_getenv ("XDG_CURRENT_DESKTOP");
	_tmp1_ = g_strdup (_tmp0_);
	desktop = _tmp1_;
	_tmp3_ = desktop;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_ = NULL;
		_tmp4_ = desktop;
		_tmp2_ = g_strcmp0 (_tmp4_, "Unity") != 0;
	}
	use_headerbar = _tmp2_;
	_tmp6_ = use_headerbar;
	if (_tmp6_) {
		_tmp5_ = 1;
	} else {
		_tmp5_ = 0;
	}
	_tmp7_ = _ ("Select Theme");
	_tmp8_ = parent;
	self = (ThemeSelectorDialog*) g_object_new (object_type, "use-header-bar", _tmp5_, "title", _tmp7_, "modal", TRUE, "transient-for", _tmp8_, "resizable", FALSE, "border-width", 12, NULL);
	_data3_->self = g_object_ref (self);
	_tmp9_ = (GtkButton*) gtk_button_new_from_icon_name ("go-previous-symbolic", GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->previous);
	self->priv->previous = _tmp9_;
	_tmp10_ = self->priv->previous;
	gtk_widget_set_valign ((GtkWidget*) _tmp10_, GTK_ALIGN_CENTER);
	_tmp11_ = self->priv->previous;
	gtk_widget_set_halign ((GtkWidget*) _tmp11_, GTK_ALIGN_START);
	_tmp12_ = (GtkButton*) gtk_button_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_BUTTON);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->next);
	self->priv->next = _tmp12_;
	_tmp13_ = self->priv->next;
	gtk_widget_set_valign ((GtkWidget*) _tmp13_, GTK_ALIGN_CENTER);
	_tmp14_ = self->priv->next;
	gtk_widget_set_halign ((GtkWidget*) _tmp14_, GTK_ALIGN_END);
	_tmp15_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp15_);
	buttons_holder = _tmp15_;
	_tmp16_ = use_headerbar;
	if (_tmp16_) {
		GtkHeaderBar* headerbar = NULL;
		GtkWidget* _tmp17_ = NULL;
		GtkHeaderBar* _tmp18_ = NULL;
		GtkHeaderBar* _tmp19_ = NULL;
		GtkBox* _tmp20_ = NULL;
		MinefieldView* _tmp21_ = NULL;
		GtkWidget* _tmp22_ = NULL;
		GtkWidget* _tmp23_ = NULL;
		GtkBox* _tmp24_ = NULL;
		GtkButton* _tmp25_ = NULL;
		GtkBox* _tmp26_ = NULL;
		GtkButton* _tmp27_ = NULL;
		GtkBox* _tmp28_ = NULL;
		GtkStyleContext* _tmp29_ = NULL;
		GtkHeaderBar* _tmp30_ = NULL;
		GtkBox* _tmp31_ = NULL;
		_tmp17_ = gtk_dialog_get_header_bar ((GtkDialog*) self);
		_tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, gtk_header_bar_get_type ()) ? ((GtkHeaderBar*) _tmp17_) : NULL);
		headerbar = _tmp18_;
		_tmp19_ = headerbar;
		gtk_header_bar_set_show_close_button (_tmp19_, TRUE);
		_tmp20_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
		_tmp22_ = theme_selector_dialog_create_preview_widget (self, &_tmp21_);
		_g_object_unref0 (_data3_->minefield);
		_data3_->minefield = _tmp21_;
		_tmp23_ = _tmp22_;
		gtk_box_pack_start (_tmp20_, _tmp23_, TRUE, TRUE, (guint) 0);
		_g_object_unref0 (_tmp23_);
		_tmp24_ = buttons_holder;
		_tmp25_ = self->priv->previous;
		gtk_box_pack_start (_tmp24_, (GtkWidget*) _tmp25_, TRUE, TRUE, (guint) 0);
		_tmp26_ = buttons_holder;
		_tmp27_ = self->priv->next;
		gtk_box_pack_start (_tmp26_, (GtkWidget*) _tmp27_, TRUE, TRUE, (guint) 0);
		_tmp28_ = buttons_holder;
		_tmp29_ = gtk_widget_get_style_context ((GtkWidget*) _tmp28_);
		gtk_style_context_add_class (_tmp29_, "linked");
		_tmp30_ = headerbar;
		_tmp31_ = buttons_holder;
		gtk_header_bar_pack_start (_tmp30_, (GtkWidget*) _tmp31_);
		_g_object_unref0 (headerbar);
	} else {
		const gchar* _tmp32_ = NULL;
		GtkBox* _tmp33_ = NULL;
		GtkButton* _tmp34_ = NULL;
		GtkBox* _tmp35_ = NULL;
		MinefieldView* _tmp36_ = NULL;
		GtkWidget* _tmp37_ = NULL;
		GtkWidget* _tmp38_ = NULL;
		GtkBox* _tmp39_ = NULL;
		GtkButton* _tmp40_ = NULL;
		GtkBox* _tmp41_ = NULL;
		GtkBox* _tmp42_ = NULL;
		_tmp32_ = _ ("Close");
		gtk_dialog_add_button ((GtkDialog*) self, _tmp32_, (gint) GTK_RESPONSE_DELETE_EVENT);
		gtk_container_set_border_width ((GtkContainer*) self, (guint) 12);
		_tmp33_ = buttons_holder;
		_tmp34_ = self->priv->previous;
		gtk_box_pack_start (_tmp33_, (GtkWidget*) _tmp34_, FALSE, FALSE, (guint) 0);
		_tmp35_ = buttons_holder;
		_tmp37_ = theme_selector_dialog_create_preview_widget (self, &_tmp36_);
		_g_object_unref0 (_data3_->minefield);
		_data3_->minefield = _tmp36_;
		_tmp38_ = _tmp37_;
		gtk_box_pack_start (_tmp35_, _tmp38_, TRUE, TRUE, (guint) 0);
		_g_object_unref0 (_tmp38_);
		_tmp39_ = buttons_holder;
		_tmp40_ = self->priv->next;
		gtk_box_pack_start (_tmp39_, (GtkWidget*) _tmp40_, FALSE, FALSE, (guint) 0);
		_tmp41_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
		_tmp42_ = buttons_holder;
		gtk_box_pack_end (_tmp41_, (GtkWidget*) _tmp42_, TRUE, TRUE, (guint) 0);
	}
	_tmp43_ = theme_selector_dialog_list_themes (self);
	_data3_->themes = _tmp43_;
	_tmp44_ = self->priv->settings;
	_tmp45_ = g_settings_get_string (_tmp44_, "theme");
	current_theme = _tmp45_;
	_data3_->current_index = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp46_ = FALSE;
			_tmp46_ = TRUE;
			while (TRUE) {
				gint _tmp48_ = 0;
				GList* _tmp49_ = NULL;
				guint _tmp50_ = 0U;
				gchar* theme = NULL;
				GList* _tmp51_ = NULL;
				gint _tmp52_ = 0;
				gconstpointer _tmp53_ = NULL;
				gchar* _tmp54_ = NULL;
				const gchar* _tmp55_ = NULL;
				const gchar* _tmp56_ = NULL;
				if (!_tmp46_) {
					gint _tmp47_ = 0;
					_tmp47_ = i;
					i = _tmp47_ + 1;
				}
				_tmp46_ = FALSE;
				_tmp48_ = i;
				_tmp49_ = _data3_->themes;
				_tmp50_ = g_list_length (_tmp49_);
				if (!(((guint) _tmp48_) < _tmp50_)) {
					break;
				}
				_tmp51_ = _data3_->themes;
				_tmp52_ = i;
				_tmp53_ = g_list_nth_data (_tmp51_, (guint) _tmp52_);
				_tmp54_ = g_strdup ((const gchar*) _tmp53_);
				theme = _tmp54_;
				_tmp55_ = current_theme;
				_tmp56_ = theme;
				if (g_strcmp0 (_tmp55_, _tmp56_) == 0) {
					gint _tmp57_ = 0;
					_tmp57_ = i;
					_data3_->current_index = _tmp57_;
				}
				_g_free0 (theme);
			}
		}
	}
	_tmp58_ = self->priv->next;
	g_signal_connect_data (_tmp58_, "clicked", (GCallback) ___lambda16__gtk_button_clicked, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	_tmp59_ = self->priv->previous;
	g_signal_connect_data (_tmp59_, "clicked", (GCallback) ___lambda17__gtk_button_clicked, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	gtk_widget_set_size_request ((GtkWidget*) self, 420, 400);
	_tmp60_ = _data3_->themes;
	_tmp61_ = _data3_->current_index;
	theme_selector_dialog_update_sensitivities (self, _tmp60_, _tmp61_);
	gtk_widget_show_all ((GtkWidget*) self);
	_tmp62_ = _data3_->minefield;
	minefield_view_refresh (_tmp62_);
	_g_free0 (current_theme);
	_g_object_unref0 (buttons_holder);
	_g_free0 (desktop);
	block3_data_unref (_data3_);
	_data3_ = NULL;
	return self;
}


ThemeSelectorDialog* theme_selector_dialog_new (GtkWindow* parent) {
	return theme_selector_dialog_construct (TYPE_THEME_SELECTOR_DIALOG, parent);
}


static void theme_selector_dialog_switch_theme_preview (ThemeSelectorDialog* self, gint to_index, GList* themes) {
	GSettings* _tmp0_ = NULL;
	GList* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gconstpointer _tmp3_ = NULL;
	GSettings* _tmp4_ = NULL;
	GdkWindow* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = themes;
	_tmp2_ = to_index;
	_tmp3_ = g_list_nth_data (_tmp1_, (guint) _tmp2_);
	g_settings_set_string (_tmp0_, "theme", (const gchar*) _tmp3_);
	_tmp4_ = self->priv->settings;
	g_settings_apply (_tmp4_);
	gtk_widget_queue_draw ((GtkWidget*) self);
	_tmp5_ = gtk_widget_get_window ((GtkWidget*) self);
	gdk_window_invalidate_rect (_tmp5_, NULL, TRUE);
	gtk_window_present ((GtkWindow*) self);
}


static void theme_selector_dialog_update_sensitivities (ThemeSelectorDialog* self, GList* themes, gint current_index) {
	GtkButton* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GList* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	GtkButton* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->next;
	_tmp1_ = current_index;
	_tmp2_ = themes;
	_tmp3_ = g_list_length (_tmp2_);
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, ((guint) _tmp1_) < (_tmp3_ - 1));
	_tmp4_ = self->priv->previous;
	_tmp5_ = current_index;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, _tmp5_ > 0);
}


static void theme_selector_dialog_reveal_nonmines (ThemeSelectorDialog* self, MinefieldView* view) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (view != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gint _tmp2_ = 0;
				if (!_tmp0_) {
					gint _tmp1_ = 0;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = i;
				if (!(_tmp2_ < 7)) {
					break;
				}
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp3_ = FALSE;
						_tmp3_ = TRUE;
						while (TRUE) {
							gint _tmp5_ = 0;
							MinefieldView* _tmp6_ = NULL;
							Minefield* _tmp7_ = NULL;
							Minefield* _tmp8_ = NULL;
							gint _tmp9_ = 0;
							gint _tmp10_ = 0;
							gboolean _tmp11_ = FALSE;
							if (!_tmp3_) {
								gint _tmp4_ = 0;
								_tmp4_ = j;
								j = _tmp4_ + 1;
							}
							_tmp3_ = FALSE;
							_tmp5_ = j;
							if (!(_tmp5_ < 6)) {
								break;
							}
							_tmp6_ = view;
							_tmp7_ = minefield_view_get_minefield (_tmp6_);
							_tmp8_ = _tmp7_;
							_tmp9_ = i;
							_tmp10_ = j;
							_tmp11_ = minefield_has_mine (_tmp8_, (guint) _tmp9_, (guint) _tmp10_);
							if (!_tmp11_) {
								MinefieldView* _tmp12_ = NULL;
								Minefield* _tmp13_ = NULL;
								Minefield* _tmp14_ = NULL;
								gint _tmp15_ = 0;
								gint _tmp16_ = 0;
								MinefieldView* _tmp17_ = NULL;
								Minefield* _tmp18_ = NULL;
								Minefield* _tmp19_ = NULL;
								gint _tmp20_ = 0;
								gint _tmp21_ = 0;
								_tmp12_ = view;
								_tmp13_ = minefield_view_get_minefield (_tmp12_);
								_tmp14_ = _tmp13_;
								_tmp15_ = i;
								_tmp16_ = j;
								minefield_clear_mine (_tmp14_, (guint) _tmp15_, (guint) _tmp16_);
								_tmp17_ = view;
								_tmp18_ = minefield_view_get_minefield (_tmp17_);
								_tmp19_ = _tmp18_;
								_tmp20_ = i;
								_tmp21_ = j;
								minefield_multi_release (_tmp19_, (guint) _tmp20_, (guint) _tmp21_);
							} else {
								MinefieldView* _tmp22_ = NULL;
								gint _tmp23_ = 0;
								gint _tmp24_ = 0;
								_tmp22_ = view;
								_tmp23_ = i;
								_tmp24_ = j;
								minefield_view_toggle_mark (_tmp22_, (guint) _tmp23_, (guint) _tmp24_);
							}
						}
					}
				}
			}
		}
	}
}


static void theme_selector_dialog_class_init (ThemeSelectorDialogClass * klass) {
	theme_selector_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ThemeSelectorDialogPrivate));
	G_OBJECT_CLASS (klass)->finalize = theme_selector_dialog_finalize;
}


static void theme_selector_dialog_instance_init (ThemeSelectorDialog * self) {
	GSettings* _tmp0_ = NULL;
	self->priv = THEME_SELECTOR_DIALOG_GET_PRIVATE (self);
	_tmp0_ = g_settings_new ("org.gnome.mines");
	self->priv->settings = _tmp0_;
}


static void theme_selector_dialog_finalize (GObject* obj) {
	ThemeSelectorDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_THEME_SELECTOR_DIALOG, ThemeSelectorDialog);
	_g_object_unref0 (self->priv->previous);
	_g_object_unref0 (self->priv->next);
	_g_object_unref0 (self->priv->settings);
	G_OBJECT_CLASS (theme_selector_dialog_parent_class)->finalize (obj);
}


GType theme_selector_dialog_get_type (void) {
	static volatile gsize theme_selector_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&theme_selector_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ThemeSelectorDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) theme_selector_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ThemeSelectorDialog), 0, (GInstanceInitFunc) theme_selector_dialog_instance_init, NULL };
		GType theme_selector_dialog_type_id;
		theme_selector_dialog_type_id = g_type_register_static (gtk_dialog_get_type (), "ThemeSelectorDialog", &g_define_type_info, 0);
		g_once_init_leave (&theme_selector_dialog_type_id__volatile, theme_selector_dialog_type_id);
	}
	return theme_selector_dialog_type_id__volatile;
}



