/* lightsoff.c generated by valac 0.14.1, the Vala compiler
 * generated from lightsoff.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <clutter/clutter.h>
#include <clutter-gtk/clutter-gtk.h>
#include <games-help.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <games-stock.h>
#include <games-runtime.h>
#include <gobject/gvaluecollector.h>


#define TYPE_LIGHTS_OFF (lights_off_get_type ())
#define LIGHTS_OFF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LIGHTS_OFF, LightsOff))
#define LIGHTS_OFF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LIGHTS_OFF, LightsOffClass))
#define IS_LIGHTS_OFF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LIGHTS_OFF))
#define IS_LIGHTS_OFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LIGHTS_OFF))
#define LIGHTS_OFF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LIGHTS_OFF, LightsOffClass))

typedef struct _LightsOff LightsOff;
typedef struct _LightsOffClass LightsOffClass;
typedef struct _LightsOffPrivate LightsOffPrivate;

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _lights_off_unref0(var) ((var == NULL) ? NULL : (var = (lights_off_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ParamSpecLightsOff ParamSpecLightsOff;

struct _LightsOff {
	GTypeInstance parent_instance;
	volatile int ref_count;
	LightsOffPrivate * priv;
};

struct _LightsOffClass {
	GTypeClass parent_class;
	void (*finalize) (LightsOff *self);
};

struct _LightsOffPrivate {
	GSettings* settings;
	GtkBuilder* ui;
	GtkWindow* window;
	GameView* game_view;
};

struct _ParamSpecLightsOff {
	GParamSpec parent_instance;
};


static gpointer lights_off_parent_class = NULL;

gpointer lights_off_ref (gpointer instance);
void lights_off_unref (gpointer instance);
GParamSpec* param_spec_lights_off (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_lights_off (GValue* value, gpointer v_object);
void value_take_lights_off (GValue* value, gpointer v_object);
gpointer value_get_lights_off (const GValue* value);
GType lights_off_get_type (void) G_GNUC_CONST;
GType game_view_get_type (void) G_GNUC_CONST;
#define LIGHTS_OFF_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_LIGHTS_OFF, LightsOffPrivate))
enum  {
	LIGHTS_OFF_DUMMY_PROPERTY
};
static LightsOff* lights_off_new (GError** error);
static LightsOff* lights_off_construct (GType object_type, GError** error);
static void _gtk_main_quit_gtk_widget_hide (GtkWidget* _sender, gpointer self);
static gboolean lights_off_key_release_event_cb (LightsOff* self, ClutterActor* actor, ClutterKeyEvent* event);
static gboolean _lights_off_key_release_event_cb_clutter_actor_key_release_event (ClutterActor* _sender, ClutterKeyEvent* event, gpointer self);
GameView* game_view_new (gint level);
GameView* game_view_construct (GType object_type, gint level);
static void lights_off_level_changed_cb (LightsOff* self, gint level);
static void _lights_off_level_changed_cb_game_view_level_changed (GameView* _sender, gint level, gpointer self);
void game_view_hide_cursor (GameView* self);
void game_view_move_cursor (GameView* self, gint x_step, gint y_step);
void game_view_activate_cursor (GameView* self);
void lights_off_show (LightsOff* self);
void G_MODULE_EXPORT new_game_cb (GtkWidget* widget, LightsOff* self);
void game_view_reset_game (GameView* self);
void G_MODULE_EXPORT quit_cb (GtkWidget* widget, LightsOff* self);
void G_MODULE_EXPORT help_cb (GtkWidget* widget, LightsOff* self);
void G_MODULE_EXPORT about_cb (GtkWidget* widget, LightsOff* self);
gint lights_off_main (gchar** args, int args_length1);
static void lights_off_finalize (LightsOff* 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 gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _gtk_main_quit_gtk_widget_hide (GtkWidget* _sender, gpointer self) {
	gtk_main_quit ();
}


static gboolean _lights_off_key_release_event_cb_clutter_actor_key_release_event (ClutterActor* _sender, ClutterKeyEvent* event, gpointer self) {
	gboolean result;
	result = lights_off_key_release_event_cb (self, _sender, event);
	return result;
}


static void _lights_off_level_changed_cb_game_view_level_changed (GameView* _sender, gint level, gpointer self) {
	lights_off_level_changed_cb (self, level);
}


static LightsOff* lights_off_construct (GType object_type, GError** error) {
	LightsOff* self = NULL;
	GSettings* _tmp0_;
	GtkBuilder* _tmp1_;
	GtkBuilder* _tmp2_;
	GtkBuilder* _tmp3_;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_ = NULL;
	GtkWindow* _tmp6_;
	GtkWindow* _tmp7_;
	GtkBuilder* _tmp8_;
	GObject* _tmp9_ = NULL;
	GtkBox* _tmp10_;
	GtkBox* box;
	GtkClutterEmbed* _tmp11_;
	GtkClutterEmbed* _tmp12_;
	GtkClutterEmbed* clutter_embed;
	GtkClutterEmbed* _tmp13_;
	GtkBox* _tmp14_;
	GtkClutterEmbed* _tmp15_;
	GtkClutterEmbed* _tmp16_;
	ClutterActor* _tmp17_ = NULL;
	ClutterStage* _tmp18_;
	ClutterStage* stage;
	ClutterStage* _tmp19_;
	ClutterStage* _tmp20_;
	ClutterColor _tmp21_ = {0};
	ClutterStage* _tmp22_;
	GSettings* _tmp23_;
	gint _tmp24_ = 0;
	GameView* _tmp25_;
	GameView* _tmp26_;
	GameView* _tmp27_;
	GameView* _tmp28_;
	ClutterStage* _tmp29_;
	GameView* _tmp30_;
	ClutterStage* _tmp31_;
	GameView* _tmp32_;
	gfloat _tmp33_;
	gfloat _tmp34_;
	GameView* _tmp35_;
	gfloat _tmp36_;
	gfloat _tmp37_;
	GtkClutterEmbed* _tmp38_;
	ClutterStage* _tmp39_;
	gfloat _tmp40_;
	gfloat _tmp41_;
	ClutterStage* _tmp42_;
	gfloat _tmp43_;
	gfloat _tmp44_;
	GError * _inner_error_ = NULL;
	self = (LightsOff*) g_type_create_instance (object_type);
	_tmp0_ = g_settings_new ("org.gnome.lightsoff");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp0_;
	_tmp1_ = gtk_builder_new ();
	_g_object_unref0 (self->priv->ui);
	self->priv->ui = _tmp1_;
	_tmp2_ = self->priv->ui;
	gtk_builder_add_from_file (_tmp2_, "data/lightsoff.ui", &_inner_error_);
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_lights_off_unref0 (self);
		return NULL;
	}
	_tmp3_ = self->priv->ui;
	gtk_builder_connect_signals (_tmp3_, self);
	_tmp4_ = self->priv->ui;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "game_window");
	_tmp6_ = _g_object_ref0 (GTK_WINDOW (_tmp5_));
	_g_object_unref0 (self->priv->window);
	self->priv->window = _tmp6_;
	_tmp7_ = self->priv->window;
	g_signal_connect ((GtkWidget*) _tmp7_, "hide", (GCallback) _gtk_main_quit_gtk_widget_hide, NULL);
	_tmp8_ = self->priv->ui;
	_tmp9_ = gtk_builder_get_object (_tmp8_, "game_vbox");
	_tmp10_ = _g_object_ref0 (GTK_BOX (_tmp9_));
	box = _tmp10_;
	_tmp11_ = (GtkClutterEmbed*) gtk_clutter_embed_new ();
	_tmp12_ = g_object_ref_sink (_tmp11_);
	clutter_embed = _tmp12_;
	_tmp13_ = clutter_embed;
	gtk_widget_show ((GtkWidget*) _tmp13_);
	_tmp14_ = box;
	_tmp15_ = clutter_embed;
	gtk_box_pack_start (_tmp14_, (GtkWidget*) _tmp15_, TRUE, TRUE, (guint) 0);
	_tmp16_ = clutter_embed;
	_tmp17_ = gtk_clutter_embed_get_stage (_tmp16_);
	_tmp18_ = _g_object_ref0 (CLUTTER_STAGE (_tmp17_));
	stage = _tmp18_;
	_tmp19_ = stage;
	g_signal_connect ((ClutterActor*) _tmp19_, "key-release-event", (GCallback) _lights_off_key_release_event_cb_clutter_actor_key_release_event, self);
	_tmp20_ = stage;
	clutter_color_from_string (&_tmp21_, "#000000");
	clutter_stage_set_color (_tmp20_, &_tmp21_);
	_tmp22_ = stage;
	clutter_stage_set_use_fog (_tmp22_, FALSE);
	_tmp23_ = self->priv->settings;
	_tmp24_ = g_settings_get_int (_tmp23_, "level");
	_tmp25_ = game_view_new (_tmp24_);
	_tmp26_ = g_object_ref_sink (_tmp25_);
	_g_object_unref0 (self->priv->game_view);
	self->priv->game_view = _tmp26_;
	_tmp27_ = self->priv->game_view;
	g_signal_connect (_tmp27_, "level-changed", (GCallback) _lights_off_level_changed_cb_game_view_level_changed, self);
	_tmp28_ = self->priv->game_view;
	clutter_actor_show ((ClutterActor*) _tmp28_);
	_tmp29_ = stage;
	_tmp30_ = self->priv->game_view;
	clutter_container_add_actor ((ClutterContainer*) _tmp29_, (ClutterActor*) _tmp30_);
	_tmp31_ = stage;
	_tmp32_ = self->priv->game_view;
	_tmp33_ = clutter_actor_get_width ((ClutterActor*) _tmp32_);
	_tmp34_ = _tmp33_;
	_tmp35_ = self->priv->game_view;
	_tmp36_ = clutter_actor_get_height ((ClutterActor*) _tmp35_);
	_tmp37_ = _tmp36_;
	clutter_actor_set_size ((ClutterActor*) _tmp31_, _tmp34_, _tmp37_);
	_tmp38_ = clutter_embed;
	_tmp39_ = stage;
	_tmp40_ = clutter_actor_get_width ((ClutterActor*) _tmp39_);
	_tmp41_ = _tmp40_;
	_tmp42_ = stage;
	_tmp43_ = clutter_actor_get_height ((ClutterActor*) _tmp42_);
	_tmp44_ = _tmp43_;
	gtk_widget_set_size_request ((GtkWidget*) _tmp38_, (gint) _tmp41_, (gint) _tmp44_);
	_g_object_unref0 (stage);
	_g_object_unref0 (clutter_embed);
	_g_object_unref0 (box);
	return self;
}


static LightsOff* lights_off_new (GError** error) {
	return lights_off_construct (TYPE_LIGHTS_OFF, error);
}


static void lights_off_level_changed_cb (LightsOff* self, gint level) {
	GSettings* _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp1_ = level;
	g_settings_set_int (_tmp0_, "level", _tmp1_);
}


static gboolean lights_off_key_release_event_cb (LightsOff* self, ClutterActor* actor, ClutterKeyEvent* event) {
	gboolean result = FALSE;
	ClutterKeyEvent _tmp0_;
	guint _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (actor != NULL, FALSE);
	g_return_val_if_fail (event != NULL, FALSE);
	_tmp0_ = *event;
	_tmp1_ = _tmp0_.keyval;
	switch (_tmp1_) {
		case CLUTTER_KEY_Escape:
		{
			GameView* _tmp2_;
			_tmp2_ = self->priv->game_view;
			game_view_hide_cursor (_tmp2_);
			result = TRUE;
			return result;
		}
		case CLUTTER_KEY_Down:
		{
			GameView* _tmp3_;
			_tmp3_ = self->priv->game_view;
			game_view_move_cursor (_tmp3_, 0, 1);
			result = TRUE;
			return result;
		}
		case CLUTTER_KEY_Up:
		{
			GameView* _tmp4_;
			_tmp4_ = self->priv->game_view;
			game_view_move_cursor (_tmp4_, 0, -1);
			result = TRUE;
			return result;
		}
		case CLUTTER_KEY_Left:
		{
			GameView* _tmp5_;
			_tmp5_ = self->priv->game_view;
			game_view_move_cursor (_tmp5_, -1, 0);
			result = TRUE;
			return result;
		}
		case CLUTTER_KEY_Right:
		{
			GameView* _tmp6_;
			_tmp6_ = self->priv->game_view;
			game_view_move_cursor (_tmp6_, 1, 0);
			result = TRUE;
			return result;
		}
		case CLUTTER_KEY_Return:
		{
			GameView* _tmp7_;
			_tmp7_ = self->priv->game_view;
			game_view_activate_cursor (_tmp7_);
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}


void lights_off_show (LightsOff* self) {
	GtkWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->window;
	gtk_widget_show ((GtkWidget*) _tmp0_);
}


void G_MODULE_EXPORT new_game_cb (GtkWidget* widget, LightsOff* self) {
	GameView* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->game_view;
	game_view_reset_game (_tmp0_);
}


void G_MODULE_EXPORT quit_cb (GtkWidget* widget, LightsOff* self) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	gtk_main_quit ();
}


void G_MODULE_EXPORT help_cb (GtkWidget* widget, LightsOff* self) {
	GtkWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = self->priv->window;
	games_help_display ((GtkWidget*) _tmp0_, "lightsoff", NULL);
}


void G_MODULE_EXPORT about_cb (GtkWidget* widget, LightsOff* self) {
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** authors;
	gint authors_length1;
	gint _authors_size_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_ = NULL;
	gchar** artists;
	gint artists_length1;
	gint _artists_size_;
	gchar* _tmp6_;
	gchar** _tmp7_ = NULL;
	gchar** documenters;
	gint documenters_length1;
	gint _documenters_size_;
	GtkWindow* _tmp8_;
	const gchar* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	const gchar* _tmp11_ = NULL;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_;
	const gchar* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = g_strdup ("Tim Horton");
	_tmp1_ = g_strdup ("Robert Ancell");
	_tmp2_ = g_new0 (gchar*, 3 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	_tmp2_[2] = NULL;
	authors = _tmp2_;
	authors_length1 = 3;
	_authors_size_ = authors_length1;
	_tmp3_ = g_strdup ("Tim Horton");
	_tmp4_ = g_strdup ("Ulisse Perusin");
	_tmp5_ = g_new0 (gchar*, 3 + 1);
	_tmp5_[0] = _tmp3_;
	_tmp5_[1] = _tmp4_;
	_tmp5_[2] = NULL;
	artists = _tmp5_;
	artists_length1 = 3;
	_artists_size_ = artists_length1;
	_tmp6_ = g_strdup ("Eric Baudais");
	_tmp7_ = g_new0 (gchar*, 2 + 1);
	_tmp7_[0] = _tmp6_;
	_tmp7_[1] = NULL;
	documenters = _tmp7_;
	documenters_length1 = 2;
	_documenters_size_ = documenters_length1;
	_tmp8_ = self->priv->window;
	_tmp9_ = _ ("Lights Off");
	_tmp10_ = _ ("Turn off all the lights\n\nLights Off is a part of GNOME Games.");
	_tmp11_ = _ ("Lights Off");
	_tmp12_ = games_get_license (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _ ("translator-credits");
	_tmp15_ = _ ("GNOME Games web site");
	gtk_show_about_dialog (_tmp8_, "program-name", _tmp9_, "version", VERSION, "comments", _tmp10_, "copyright", "Copyright \xa9 2009 Tim Horton", "license", _tmp13_, "wrap-license", TRUE, "authors", authors, "artists", artists, "documenters", documenters, "translator-credits", _tmp14_, "logo-icon-name", "gnome-lightsoff", "website", "http://www.gnome.org/projects/gnome-games", "website-label", _tmp15_, NULL, NULL);
	_g_free0 (_tmp13_);
	documenters = (_vala_array_free (documenters, documenters_length1, (GDestroyNotify) g_free), NULL);
	artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
	authors = (_vala_array_free (authors, authors_length1, (GDestroyNotify) g_free), NULL);
}


gint lights_off_main (gchar** args, int args_length1) {
	gint result = 0;
	ClutterInitError _tmp0_ = 0;
	LightsOff* app = NULL;
	GError * _inner_error_ = NULL;
	g_set_prgname ("lightsoff");
	_tmp0_ = gtk_clutter_init (&args_length1, &args);
	if (_tmp0_ != CLUTTER_INIT_SUCCESS) {
		g_warning ("lightsoff.vala:141: Failed to initialise Clutter");
		result = EXIT_FAILURE;
		return result;
	}
	games_runtime_init ("lightsoff");
	games_stock_init ();
	{
		LightsOff* _tmp1_;
		LightsOff* _tmp2_;
		LightsOff* _tmp3_;
		_tmp1_ = lights_off_new (&_inner_error_);
		_tmp2_ = _tmp1_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_lights_off_unref0 (app);
		app = _tmp2_;
		_tmp3_ = app;
		lights_off_show (_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_warning ("lightsoff.vala:156: Failed to create application: %s", _tmp5_);
		result = EXIT_FAILURE;
		_g_error_free0 (e);
		_lights_off_unref0 (app);
		return result;
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_lights_off_unref0 (app);
		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;
	}
	gtk_main ();
	games_runtime_shutdown ();
	result = EXIT_SUCCESS;
	_lights_off_unref0 (app);
	return result;
}


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


static void value_lights_off_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void value_lights_off_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		lights_off_unref (value->data[0].v_pointer);
	}
}


static void value_lights_off_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = lights_off_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer value_lights_off_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* value_lights_off_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		LightsOff* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = lights_off_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* value_lights_off_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	LightsOff** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = lights_off_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* param_spec_lights_off (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ParamSpecLightsOff* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_LIGHTS_OFF), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer value_get_lights_off (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_LIGHTS_OFF), NULL);
	return value->data[0].v_pointer;
}


void value_set_lights_off (GValue* value, gpointer v_object) {
	LightsOff* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_LIGHTS_OFF));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_LIGHTS_OFF));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		lights_off_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		lights_off_unref (old);
	}
}


void value_take_lights_off (GValue* value, gpointer v_object) {
	LightsOff* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_LIGHTS_OFF));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_LIGHTS_OFF));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		lights_off_unref (old);
	}
}


static void lights_off_class_init (LightsOffClass * klass) {
	lights_off_parent_class = g_type_class_peek_parent (klass);
	LIGHTS_OFF_CLASS (klass)->finalize = lights_off_finalize;
	g_type_class_add_private (klass, sizeof (LightsOffPrivate));
}


static void lights_off_instance_init (LightsOff * self) {
	self->priv = LIGHTS_OFF_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void lights_off_finalize (LightsOff* obj) {
	LightsOff * self;
	self = LIGHTS_OFF (obj);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->ui);
	_g_object_unref0 (self->priv->window);
	_g_object_unref0 (self->priv->game_view);
}


GType lights_off_get_type (void) {
	static volatile gsize lights_off_type_id__volatile = 0;
	if (g_once_init_enter (&lights_off_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { value_lights_off_init, value_lights_off_free_value, value_lights_off_copy_value, value_lights_off_peek_pointer, "p", value_lights_off_collect_value, "p", value_lights_off_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (LightsOffClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) lights_off_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LightsOff), 0, (GInstanceInitFunc) lights_off_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType lights_off_type_id;
		lights_off_type_id = g_type_register_fundamental (g_type_fundamental_next (), "LightsOff", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&lights_off_type_id__volatile, lights_off_type_id);
	}
	return lights_off_type_id__volatile;
}


gpointer lights_off_ref (gpointer instance) {
	LightsOff* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void lights_off_unref (gpointer instance) {
	LightsOff* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		LIGHTS_OFF_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


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



