/* projectoptions.c generated by valac 0.12.1.1-323029-dirty, the Vala compiler
 * generated from projectoptions.vala, do not modify */

/* projectoptions.vala
 *
 * Copyright (C) 2007-2010  Jürg Billeter
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 * 	Andrea Del Signore <sejerpz@tin.it>
 * 	Nicolas Joseph <nicolas.joseph@valaide.org>
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>


#define GEN_PROJECT_TYPE_PROJECT_OPTIONS (gen_project_project_options_get_type ())
#define GEN_PROJECT_PROJECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEN_PROJECT_TYPE_PROJECT_OPTIONS, GenProjectProjectOptions))
#define GEN_PROJECT_PROJECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEN_PROJECT_TYPE_PROJECT_OPTIONS, GenProjectProjectOptionsClass))
#define GEN_PROJECT_IS_PROJECT_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEN_PROJECT_TYPE_PROJECT_OPTIONS))
#define GEN_PROJECT_IS_PROJECT_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEN_PROJECT_TYPE_PROJECT_OPTIONS))
#define GEN_PROJECT_PROJECT_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEN_PROJECT_TYPE_PROJECT_OPTIONS, GenProjectProjectOptionsClass))

typedef struct _GenProjectProjectOptions GenProjectProjectOptions;
typedef struct _GenProjectProjectOptionsClass GenProjectProjectOptionsClass;
typedef struct _GenProjectProjectOptionsPrivate GenProjectProjectOptionsPrivate;

#define GEN_PROJECT_TYPE_TEMPLATE_DEFINITION (gen_project_template_definition_get_type ())
#define GEN_PROJECT_TEMPLATE_DEFINITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinition))
#define GEN_PROJECT_TEMPLATE_DEFINITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinitionClass))
#define GEN_PROJECT_IS_TEMPLATE_DEFINITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION))
#define GEN_PROJECT_IS_TEMPLATE_DEFINITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION))
#define GEN_PROJECT_TEMPLATE_DEFINITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEN_PROJECT_TYPE_TEMPLATE_DEFINITION, GenProjectTemplateDefinitionClass))

typedef struct _GenProjectTemplateDefinition GenProjectTemplateDefinition;
typedef struct _GenProjectTemplateDefinitionClass GenProjectTemplateDefinitionClass;

#define GEN_PROJECT_TYPE_PROJECT_LICENSE (gen_project_project_license_get_type ())
#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 _GenProjectParamSpecProjectOptions GenProjectParamSpecProjectOptions;

typedef enum  {
	GEN_PROJECT_PROJECT_LICENSE_GPL2,
	GEN_PROJECT_PROJECT_LICENSE_GPL3,
	GEN_PROJECT_PROJECT_LICENSE_LGPL2,
	GEN_PROJECT_PROJECT_LICENSE_LGPL3
} GenProjectProjectLicense;

struct _GenProjectProjectOptions {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GenProjectProjectOptionsPrivate * priv;
	GenProjectTemplateDefinition* template;
	gchar* path;
	gboolean version;
	gchar* author;
	gchar* email;
	gchar* name;
	gchar** files;
	gint files_length1;
	GenProjectProjectLicense license;
};

struct _GenProjectProjectOptionsClass {
	GTypeClass parent_class;
	void (*finalize) (GenProjectProjectOptions *self);
};

struct _GenProjectParamSpecProjectOptions {
	GParamSpec parent_instance;
};


static gpointer gen_project_project_options_parent_class = NULL;

gpointer gen_project_project_options_ref (gpointer instance);
void gen_project_project_options_unref (gpointer instance);
GParamSpec* gen_project_param_spec_project_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gen_project_value_set_project_options (GValue* value, gpointer v_object);
void gen_project_value_take_project_options (GValue* value, gpointer v_object);
gpointer gen_project_value_get_project_options (const GValue* value);
GType gen_project_project_options_get_type (void) G_GNUC_CONST;
GType gen_project_template_definition_get_type (void) G_GNUC_CONST;
GType gen_project_project_license_get_type (void) G_GNUC_CONST;
enum  {
	GEN_PROJECT_PROJECT_OPTIONS_DUMMY_PROPERTY
};
GenProjectProjectOptions* gen_project_project_options_new (void);
GenProjectProjectOptions* gen_project_project_options_construct (GType object_type);
static void gen_project_project_options_finalize (GenProjectProjectOptions* 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);


GenProjectProjectOptions* gen_project_project_options_construct (GType object_type) {
	GenProjectProjectOptions* self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	const gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	self = (GenProjectProjectOptions*) g_type_create_instance (object_type);
	self->license = GEN_PROJECT_PROJECT_LICENSE_LGPL2;
	_tmp0_ = g_getenv ("REAL_NAME");
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->author);
	self->author = _tmp1_;
	_tmp2_ = g_getenv ("EMAIL_ADDRESS");
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->email);
	self->email = _tmp3_;
	return self;
}


GenProjectProjectOptions* gen_project_project_options_new (void) {
	return gen_project_project_options_construct (GEN_PROJECT_TYPE_PROJECT_OPTIONS);
}


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


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


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


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


static gchar* gen_project_value_project_options_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		GenProjectProjectOptions* 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 = gen_project_project_options_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* gen_project_value_project_options_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	GenProjectProjectOptions** 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 = gen_project_project_options_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* gen_project_param_spec_project_options (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	GenProjectParamSpecProjectOptions* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GEN_PROJECT_TYPE_PROJECT_OPTIONS), 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 gen_project_value_get_project_options (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEN_PROJECT_TYPE_PROJECT_OPTIONS), NULL);
	return value->data[0].v_pointer;
}


void gen_project_value_set_project_options (GValue* value, gpointer v_object) {
	GenProjectProjectOptions* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEN_PROJECT_TYPE_PROJECT_OPTIONS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEN_PROJECT_TYPE_PROJECT_OPTIONS));
		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;
		gen_project_project_options_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gen_project_project_options_unref (old);
	}
}


void gen_project_value_take_project_options (GValue* value, gpointer v_object) {
	GenProjectProjectOptions* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEN_PROJECT_TYPE_PROJECT_OPTIONS));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEN_PROJECT_TYPE_PROJECT_OPTIONS));
		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) {
		gen_project_project_options_unref (old);
	}
}


static void gen_project_project_options_class_init (GenProjectProjectOptionsClass * klass) {
	gen_project_project_options_parent_class = g_type_class_peek_parent (klass);
	GEN_PROJECT_PROJECT_OPTIONS_CLASS (klass)->finalize = gen_project_project_options_finalize;
}


static void gen_project_project_options_instance_init (GenProjectProjectOptions * self) {
	self->ref_count = 1;
}


static void gen_project_project_options_finalize (GenProjectProjectOptions* obj) {
	GenProjectProjectOptions * self;
	self = GEN_PROJECT_PROJECT_OPTIONS (obj);
	_g_object_unref0 (self->template);
	_g_free0 (self->path);
	_g_free0 (self->author);
	_g_free0 (self->email);
	_g_free0 (self->name);
	self->files = (_vala_array_free (self->files, self->files_length1, (GDestroyNotify) g_free), NULL);
}


GType gen_project_project_options_get_type (void) {
	static volatile gsize gen_project_project_options_type_id__volatile = 0;
	if (g_once_init_enter (&gen_project_project_options_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { gen_project_value_project_options_init, gen_project_value_project_options_free_value, gen_project_value_project_options_copy_value, gen_project_value_project_options_peek_pointer, "p", gen_project_value_project_options_collect_value, "p", gen_project_value_project_options_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (GenProjectProjectOptionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gen_project_project_options_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GenProjectProjectOptions), 0, (GInstanceInitFunc) gen_project_project_options_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 gen_project_project_options_type_id;
		gen_project_project_options_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GenProjectProjectOptions", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&gen_project_project_options_type_id__volatile, gen_project_project_options_type_id);
	}
	return gen_project_project_options_type_id__volatile;
}


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


void gen_project_project_options_unref (gpointer instance) {
	GenProjectProjectOptions* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GEN_PROJECT_PROJECT_OPTIONS_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);
}



