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

/*
 *  vtgsourcebookmark.vala - Vala developer toys for GEdit
 *  
 *  Copyright (C) 2008 - Andrea Del Signore <sejerpz@tin.it>
 *  
 *  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.
 *   
 *  This program 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 General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

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


#define VTG_TYPE_SOURCE_BOOKMARK (vtg_source_bookmark_get_type ())
#define VTG_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmark))
#define VTG_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))
#define VTG_IS_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_IS_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_SOURCE_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))

typedef struct _VtgSourceBookmark VtgSourceBookmark;
typedef struct _VtgSourceBookmarkClass VtgSourceBookmarkClass;
typedef struct _VtgSourceBookmarkPrivate VtgSourceBookmarkPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _VtgParamSpecSourceBookmark VtgParamSpecSourceBookmark;

struct _VtgSourceBookmark {
	GTypeInstance parent_instance;
	volatile int ref_count;
	VtgSourceBookmarkPrivate * priv;
	gchar* uri;
	gint line;
	gint column;
};

struct _VtgSourceBookmarkClass {
	GTypeClass parent_class;
	void (*finalize) (VtgSourceBookmark *self);
};

struct _VtgParamSpecSourceBookmark {
	GParamSpec parent_instance;
};


static gpointer vtg_source_bookmark_parent_class = NULL;
static GType vtg_source_bookmark_type_id = 0;

gpointer vtg_source_bookmark_ref (gpointer instance);
void vtg_source_bookmark_unref (gpointer instance);
GParamSpec* vtg_param_spec_source_bookmark (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vtg_value_set_source_bookmark (GValue* value, gpointer v_object);
void vtg_value_take_source_bookmark (GValue* value, gpointer v_object);
gpointer vtg_value_get_source_bookmark (const GValue* value);
GType vtg_source_bookmark_get_type (void) G_GNUC_CONST;
GType vtg_source_bookmark_register_type (GTypeModule * module);
enum  {
	VTG_SOURCE_BOOKMARK_DUMMY_PROPERTY
};
VtgSourceBookmark* vtg_source_bookmark_new (void);
VtgSourceBookmark* vtg_source_bookmark_construct (GType object_type);
static void vtg_source_bookmark_finalize (VtgSourceBookmark* obj);


VtgSourceBookmark* vtg_source_bookmark_construct (GType object_type) {
	VtgSourceBookmark* self = NULL;
	self = (VtgSourceBookmark*) g_type_create_instance (object_type);
	return self;
}


VtgSourceBookmark* vtg_source_bookmark_new (void) {
	return vtg_source_bookmark_construct (VTG_TYPE_SOURCE_BOOKMARK);
}


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


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


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


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


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


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


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


void vtg_value_set_source_bookmark (GValue* value, gpointer v_object) {
	VtgSourceBookmark* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VTG_TYPE_SOURCE_BOOKMARK));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VTG_TYPE_SOURCE_BOOKMARK));
		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;
		vtg_source_bookmark_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		vtg_source_bookmark_unref (old);
	}
}


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


static void vtg_source_bookmark_class_init (VtgSourceBookmarkClass * klass) {
	vtg_source_bookmark_parent_class = g_type_class_peek_parent (klass);
	VTG_SOURCE_BOOKMARK_CLASS (klass)->finalize = vtg_source_bookmark_finalize;
}


static void vtg_source_bookmark_instance_init (VtgSourceBookmark * self) {
	self->uri = NULL;
	self->line = 0;
	self->column = 0;
	self->ref_count = 1;
}


static void vtg_source_bookmark_finalize (VtgSourceBookmark* obj) {
	VtgSourceBookmark * self;
	self = VTG_SOURCE_BOOKMARK (obj);
	_g_free0 (self->uri);
}


GType vtg_source_bookmark_get_type (void) {
	return vtg_source_bookmark_type_id;
}


GType vtg_source_bookmark_register_type (GTypeModule * module) {
	static const GTypeValueTable g_define_type_value_table = { vtg_value_source_bookmark_init, vtg_value_source_bookmark_free_value, vtg_value_source_bookmark_copy_value, vtg_value_source_bookmark_peek_pointer, "p", vtg_value_source_bookmark_collect_value, "p", vtg_value_source_bookmark_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (VtgSourceBookmarkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vtg_source_bookmark_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VtgSourceBookmark), 0, (GInstanceInitFunc) vtg_source_bookmark_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) };
	vtg_source_bookmark_type_id = g_type_register_fundamental (g_type_fundamental_next (), "VtgSourceBookmark", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return vtg_source_bookmark_type_id;
}


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


void vtg_source_bookmark_unref (gpointer instance) {
	VtgSourceBookmark* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		VTG_SOURCE_BOOKMARK_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



