/* board-view-gtk.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from board-view-gtk.vala, do not modify */

/*
 * Copyright (C) 2018 Robert Roth
 *
 * 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 <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>

#define BOARD_VIEW_GTK_MIN_TOGGLE_SIZE 48
#define BOARD_VIEW_size 5
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_BOARD_VIEW (board_view_get_type ())
#define BOARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOARD_VIEW, BoardView))
#define IS_BOARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOARD_VIEW))
#define BOARD_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_BOARD_VIEW, BoardViewIface))

typedef struct _BoardView BoardView;
typedef struct _BoardViewIface BoardViewIface;

#define TYPE_PUZZLE_GENERATOR (puzzle_generator_get_type ())
#define PUZZLE_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PUZZLE_GENERATOR, PuzzleGenerator))
#define PUZZLE_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PUZZLE_GENERATOR, PuzzleGeneratorClass))
#define IS_PUZZLE_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PUZZLE_GENERATOR))
#define IS_PUZZLE_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PUZZLE_GENERATOR))
#define PUZZLE_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PUZZLE_GENERATOR, PuzzleGeneratorClass))

typedef struct _PuzzleGenerator PuzzleGenerator;
typedef struct _PuzzleGeneratorClass PuzzleGeneratorClass;

#define TYPE_BOARD_VIEW_GTK (board_view_gtk_get_type ())
#define BOARD_VIEW_GTK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOARD_VIEW_GTK, BoardViewGtk))
#define BOARD_VIEW_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOARD_VIEW_GTK, BoardViewGtkClass))
#define IS_BOARD_VIEW_GTK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOARD_VIEW_GTK))
#define IS_BOARD_VIEW_GTK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOARD_VIEW_GTK))
#define BOARD_VIEW_GTK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOARD_VIEW_GTK, BoardViewGtkClass))

typedef struct _BoardViewGtk BoardViewGtk;
typedef struct _BoardViewGtkClass BoardViewGtkClass;
typedef struct _BoardViewGtkPrivate BoardViewGtkPrivate;
enum  {
	BOARD_VIEW_GTK_0_PROPERTY,
	BOARD_VIEW_GTK_NUM_PROPERTIES
};
static GParamSpec* board_view_gtk_properties[BOARD_VIEW_GTK_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _BoardViewIface {
	GTypeInterface parent_iface;
	PuzzleGenerator* (*get_puzzle_generator) (BoardView* self);
	void (*clear_level) (BoardView* self);
	void (*toggle_light) (BoardView* self, gint x, gint y, gboolean user_initiated);
	gboolean (*is_light_active) (BoardView* self, gint x, gint y);
	GObject* (*get_light_at) (BoardView* self, gint x, gint y);
};

struct _BoardViewGtk {
	GtkGrid parent_instance;
	BoardViewGtkPrivate * priv;
};

struct _BoardViewGtkClass {
	GtkGridClass parent_class;
};

struct _BoardViewGtkPrivate {
	PuzzleGenerator* puzzle_generator;
	GtkToggleButton** lights;
	gint lights_length1;
	gint lights_length2;
};

static gint BoardViewGtk_private_offset;
static gpointer board_view_gtk_parent_class = NULL;
static BoardViewIface * board_view_gtk_board_view_parent_iface = NULL;

VALA_EXTERN GType puzzle_generator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PuzzleGenerator, g_object_unref)
VALA_EXTERN GType board_view_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoardView, g_object_unref)
VALA_EXTERN GType board_view_gtk_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoardViewGtk, g_object_unref)
VALA_EXTERN void board_view_gtk_set_light (BoardViewGtk* self,
                               GtkToggleButton* toggle,
                               gboolean val);
VALA_EXTERN void board_view_handle_toggle (BoardView* self,
                               GObject* light);
static void _board_view_handle_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                          gpointer self);
VALA_EXTERN void board_view_gtk_invert_light (BoardViewGtk* self,
                                  gint x,
                                  gint y);
static void board_view_gtk_real_toggle_light (BoardView* base,
                                       gint x,
                                       gint y,
                                       gboolean clicked);
static void board_view_gtk_real_clear_level (BoardView* base);
static PuzzleGenerator* board_view_gtk_real_get_puzzle_generator (BoardView* base);
static gboolean board_view_gtk_real_is_light_active (BoardView* base,
                                              gint x,
                                              gint y);
static GObject* board_view_gtk_real_get_light_at (BoardView* base,
                                           gint x,
                                           gint y);
VALA_EXTERN BoardViewGtk* board_view_gtk_new (void);
VALA_EXTERN BoardViewGtk* board_view_gtk_construct (GType object_type);
static GObject * board_view_gtk_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
VALA_EXTERN PuzzleGenerator* puzzle_generator_new (gint size);
VALA_EXTERN PuzzleGenerator* puzzle_generator_construct (GType object_type,
                                             gint size);
static void _board_view_gtk___lambda4_ (BoardViewGtk* self);
static void __board_view_gtk___lambda4__board_view_completed (BoardView* _sender,
                                                       gpointer self);
VALA_EXTERN void board_view_toggle_light (BoardView* self,
                              gint x,
                              gint y,
                              gboolean user_initiated);
VALA_EXTERN void board_view_clear_level (BoardView* self);
VALA_EXTERN PuzzleGenerator* board_view_get_puzzle_generator (BoardView* self);
VALA_EXTERN gboolean board_view_is_light_active (BoardView* self,
                                     gint x,
                                     gint y);
VALA_EXTERN GObject* board_view_get_light_at (BoardView* self,
                                  gint x,
                                  gint y);
static void board_view_gtk_finalize (GObject * obj);
static GType board_view_gtk_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
board_view_gtk_get_instance_private (BoardViewGtk* self)
{
	return G_STRUCT_MEMBER_P (self, BoardViewGtk_private_offset);
}

static void
_board_view_handle_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                     gpointer self)
{
	board_view_handle_toggle ((BoardView*) self, _sender);
}

void
board_view_gtk_set_light (BoardViewGtk* self,
                          GtkToggleButton* toggle,
                          gboolean val)
{
	guint _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (toggle != NULL);
	g_signal_parse_name ("toggled", gtk_toggle_button_get_type (), &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (toggle, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _board_view_handle_toggle_gtk_toggle_button_toggled, (BoardView*) self);
	gtk_toggle_button_set_active (toggle, val);
	g_signal_connect_object (toggle, "toggled", (GCallback) _board_view_handle_toggle_gtk_toggle_button_toggled, (BoardView*) self, 0);
}

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

void
board_view_gtk_invert_light (BoardViewGtk* self,
                             gint x,
                             gint y)
{
	GtkToggleButton* toggle = NULL;
	GtkToggleButton** _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	GtkToggleButton* _tmp1_;
	GtkToggleButton* _tmp2_;
	gboolean active = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->lights;
	_tmp0__length1 = self->priv->lights_length1;
	_tmp0__length2 = self->priv->lights_length2;
	_tmp1_ = _tmp0_[(x * _tmp0__length2) + y];
	_tmp2_ = _g_object_ref0 (_tmp1_);
	toggle = _tmp2_;
	active = gtk_toggle_button_get_active (toggle);
	board_view_gtk_set_light (self, toggle, !active);
	_g_object_unref0 (toggle);
}

static void
board_view_gtk_real_toggle_light (BoardView* base,
                                  gint x,
                                  gint y,
                                  gboolean clicked)
{
	BoardViewGtk * self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	self = (BoardViewGtk*) base;
	if (x >= BOARD_VIEW_size) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = y >= BOARD_VIEW_size;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = x < 0;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = y < 0;
	}
	if (_tmp0_) {
		return;
	}
	if ((((gint) x) + 1) < BOARD_VIEW_size) {
		board_view_gtk_invert_light (self, x + 1, y);
	}
	if ((((gint) x) - 1) >= 0) {
		board_view_gtk_invert_light (self, x - 1, y);
	}
	if ((((gint) y) + 1) < BOARD_VIEW_size) {
		board_view_gtk_invert_light (self, x, y + 1);
	}
	if ((((gint) y) - 1) >= 0) {
		board_view_gtk_invert_light (self, x, y - 1);
	}
	if (!clicked) {
		board_view_gtk_invert_light (self, x, y);
	}
}

static void
board_view_gtk_real_clear_level (BoardView* base)
{
	BoardViewGtk * self;
	self = (BoardViewGtk*) base;
	{
		gint x = 0;
		x = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = x;
					x = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(x < BOARD_VIEW_size)) {
					break;
				}
				{
					gint y = 0;
					y = 0;
					{
						gboolean _tmp2_ = FALSE;
						_tmp2_ = TRUE;
						while (TRUE) {
							GtkToggleButton** _tmp4_;
							gint _tmp4__length1;
							gint _tmp4__length2;
							GtkToggleButton* _tmp5_;
							if (!_tmp2_) {
								gint _tmp3_;
								_tmp3_ = y;
								y = _tmp3_ + 1;
							}
							_tmp2_ = FALSE;
							if (!(y < BOARD_VIEW_size)) {
								break;
							}
							_tmp4_ = self->priv->lights;
							_tmp4__length1 = self->priv->lights_length1;
							_tmp4__length2 = self->priv->lights_length2;
							_tmp5_ = _tmp4_[(x * _tmp4__length2) + y];
							board_view_gtk_set_light (self, _tmp5_, FALSE);
						}
					}
				}
			}
		}
	}
}

static PuzzleGenerator*
board_view_gtk_real_get_puzzle_generator (BoardView* base)
{
	BoardViewGtk * self;
	PuzzleGenerator* _tmp0_;
	PuzzleGenerator* _tmp1_;
	PuzzleGenerator* result;
	self = (BoardViewGtk*) base;
	_tmp0_ = self->priv->puzzle_generator;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static gboolean
board_view_gtk_real_is_light_active (BoardView* base,
                                     gint x,
                                     gint y)
{
	BoardViewGtk * self;
	GtkToggleButton** _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	GtkToggleButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	self = (BoardViewGtk*) base;
	_tmp0_ = self->priv->lights;
	_tmp0__length1 = self->priv->lights_length1;
	_tmp0__length2 = self->priv->lights_length2;
	_tmp1_ = _tmp0_[(x * _tmp0__length2) + y];
	_tmp2_ = gtk_toggle_button_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

static GObject*
board_view_gtk_real_get_light_at (BoardView* base,
                                  gint x,
                                  gint y)
{
	BoardViewGtk * self;
	GtkToggleButton** _tmp0_;
	gint _tmp0__length1;
	gint _tmp0__length2;
	GtkToggleButton* _tmp1_;
	GObject* _tmp2_;
	GObject* result;
	self = (BoardViewGtk*) base;
	_tmp0_ = self->priv->lights;
	_tmp0__length1 = self->priv->lights_length1;
	_tmp0__length2 = self->priv->lights_length2;
	_tmp1_ = _tmp0_[(x * _tmp0__length2) + y];
	_tmp2_ = _g_object_ref0 ((GObject*) _tmp1_);
	result = _tmp2_;
	return result;
}

BoardViewGtk*
board_view_gtk_construct (GType object_type)
{
	BoardViewGtk * self = NULL;
	self = (BoardViewGtk*) g_object_new (object_type, NULL);
	return self;
}

BoardViewGtk*
board_view_gtk_new (void)
{
	return board_view_gtk_construct (TYPE_BOARD_VIEW_GTK);
}

static void
_board_view_gtk___lambda4_ (BoardViewGtk* self)
{
	gtk_widget_set_sensitive ((GtkWidget*) self, FALSE);
}

static void
__board_view_gtk___lambda4__board_view_completed (BoardView* _sender,
                                                  gpointer self)
{
	_board_view_gtk___lambda4_ ((BoardViewGtk*) self);
}

static GObject *
board_view_gtk_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BoardViewGtk * self;
	PuzzleGenerator* _tmp0_;
	GtkToggleButton** _tmp1_;
	parent_class = G_OBJECT_CLASS (board_view_gtk_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOARD_VIEW_GTK, BoardViewGtk);
	gtk_widget_add_css_class ((GtkWidget*) self, "grid");
	gtk_grid_set_row_homogeneous ((GtkGrid*) self, TRUE);
	gtk_grid_set_column_homogeneous ((GtkGrid*) self, TRUE);
	gtk_widget_set_margin_start ((GtkWidget*) self, 2);
	gtk_widget_set_margin_end ((GtkWidget*) self, 2);
	gtk_widget_set_margin_top ((GtkWidget*) self, 2);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 2);
	gtk_grid_set_row_spacing ((GtkGrid*) self, 2);
	gtk_grid_set_column_spacing ((GtkGrid*) self, 2);
	gtk_widget_set_size_request ((GtkWidget*) self, BOARD_VIEW_size * BOARD_VIEW_GTK_MIN_TOGGLE_SIZE, BOARD_VIEW_size * BOARD_VIEW_GTK_MIN_TOGGLE_SIZE);
	_tmp0_ = puzzle_generator_new (BOARD_VIEW_size);
	_g_object_unref0 (self->priv->puzzle_generator);
	self->priv->puzzle_generator = _tmp0_;
	_tmp1_ = g_new0 (GtkToggleButton*, (BOARD_VIEW_size * BOARD_VIEW_size) + 1);
	self->priv->lights = (_vala_array_free (self->priv->lights, self->priv->lights_length1 * self->priv->lights_length2, (GDestroyNotify) g_object_unref), NULL);
	self->priv->lights = _tmp1_;
	self->priv->lights_length1 = BOARD_VIEW_size;
	self->priv->lights_length2 = BOARD_VIEW_size;
	{
		gint x = 0;
		x = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = x;
					x = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(x < BOARD_VIEW_size)) {
					break;
				}
				{
					gint y = 0;
					y = 0;
					{
						gboolean _tmp4_ = FALSE;
						_tmp4_ = TRUE;
						while (TRUE) {
							GtkToggleButton** _tmp6_;
							gint _tmp6__length1;
							gint _tmp6__length2;
							GtkToggleButton* _tmp7_;
							GtkToggleButton** _tmp8_;
							gint _tmp8__length1;
							gint _tmp8__length2;
							GtkToggleButton* _tmp9_;
							GtkToggleButton** _tmp10_;
							gint _tmp10__length1;
							gint _tmp10__length2;
							GtkToggleButton* _tmp11_;
							if (!_tmp4_) {
								gint _tmp5_;
								_tmp5_ = y;
								y = _tmp5_ + 1;
							}
							_tmp4_ = FALSE;
							if (!(y < BOARD_VIEW_size)) {
								break;
							}
							_tmp6_ = self->priv->lights;
							_tmp6__length1 = self->priv->lights_length1;
							_tmp6__length2 = self->priv->lights_length2;
							_tmp7_ = (GtkToggleButton*) gtk_toggle_button_new ();
							g_object_ref_sink (_tmp7_);
							_g_object_unref0 (_tmp6_[(x * _tmp6__length2) + y]);
							_tmp6_[(x * _tmp6__length2) + y] = _tmp7_;
							_tmp8_ = self->priv->lights;
							_tmp8__length1 = self->priv->lights_length1;
							_tmp8__length2 = self->priv->lights_length2;
							_tmp9_ = _tmp8_[(x * _tmp8__length2) + y];
							g_signal_connect_object (_tmp9_, "toggled", (GCallback) _board_view_handle_toggle_gtk_toggle_button_toggled, (BoardView*) self, 0);
							_tmp10_ = self->priv->lights;
							_tmp10__length1 = self->priv->lights_length1;
							_tmp10__length2 = self->priv->lights_length2;
							_tmp11_ = _tmp10_[(x * _tmp10__length2) + y];
							gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp11_, x, y, 1, 1);
						}
					}
				}
			}
		}
	}
	g_signal_connect_object ((BoardView*) self, "completed", (GCallback) __board_view_gtk___lambda4__board_view_completed, self, 0);
	return obj;
}

static void
board_view_gtk_class_init (BoardViewGtkClass * klass,
                           gpointer klass_data)
{
	board_view_gtk_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoardViewGtk_private_offset);
	G_OBJECT_CLASS (klass)->constructor = board_view_gtk_constructor;
	G_OBJECT_CLASS (klass)->finalize = board_view_gtk_finalize;
}

static void
board_view_gtk_board_view_interface_init (BoardViewIface * iface,
                                          gpointer iface_data)
{
	board_view_gtk_board_view_parent_iface = g_type_interface_peek_parent (iface);
	iface->toggle_light = (void (*) (BoardView*, gint, gint, gboolean)) board_view_gtk_real_toggle_light;
	iface->clear_level = (void (*) (BoardView*)) board_view_gtk_real_clear_level;
	iface->get_puzzle_generator = (PuzzleGenerator* (*) (BoardView*)) board_view_gtk_real_get_puzzle_generator;
	iface->is_light_active = (gboolean (*) (BoardView*, gint, gint)) board_view_gtk_real_is_light_active;
	iface->get_light_at = (GObject* (*) (BoardView*, gint, gint)) board_view_gtk_real_get_light_at;
}

static void
board_view_gtk_instance_init (BoardViewGtk * self,
                              gpointer klass)
{
	self->priv = board_view_gtk_get_instance_private (self);
}

static void
board_view_gtk_finalize (GObject * obj)
{
	BoardViewGtk * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOARD_VIEW_GTK, BoardViewGtk);
	_g_object_unref0 (self->priv->puzzle_generator);
	self->priv->lights = (_vala_array_free (self->priv->lights, self->priv->lights_length1 * self->priv->lights_length2, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (board_view_gtk_parent_class)->finalize (obj);
}

static GType
board_view_gtk_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoardViewGtkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) board_view_gtk_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoardViewGtk), 0, (GInstanceInitFunc) board_view_gtk_instance_init, NULL };
	static const GInterfaceInfo board_view_info = { (GInterfaceInitFunc) board_view_gtk_board_view_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType board_view_gtk_type_id;
	board_view_gtk_type_id = g_type_register_static (gtk_grid_get_type (), "BoardViewGtk", &g_define_type_info, 0);
	g_type_add_interface_static (board_view_gtk_type_id, TYPE_BOARD_VIEW, &board_view_info);
	BoardViewGtk_private_offset = g_type_add_instance_private (board_view_gtk_type_id, sizeof (BoardViewGtkPrivate));
	return board_view_gtk_type_id;
}

GType
board_view_gtk_get_type (void)
{
	static volatile gsize board_view_gtk_type_id__once = 0;
	if (g_once_init_enter (&board_view_gtk_type_id__once)) {
		GType board_view_gtk_type_id;
		board_view_gtk_type_id = board_view_gtk_get_type_once ();
		g_once_init_leave (&board_view_gtk_type_id__once, board_view_gtk_type_id);
	}
	return board_view_gtk_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

