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

/*
 * Copyright (C) 2012-2014 Daiki Ueno <ueno@gnu.org>
 * Copyright (C) 2012-2014 Red Hat, Inc.
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


#define KKC_TYPE_SEGMENT (kkc_segment_get_type ())
#define KKC_SEGMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KKC_TYPE_SEGMENT, KkcSegment))
#define KKC_SEGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KKC_TYPE_SEGMENT, KkcSegmentClass))
#define KKC_IS_SEGMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KKC_TYPE_SEGMENT))
#define KKC_IS_SEGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KKC_TYPE_SEGMENT))
#define KKC_SEGMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KKC_TYPE_SEGMENT, KkcSegmentClass))

typedef struct _KkcSegment KkcSegment;
typedef struct _KkcSegmentClass KkcSegmentClass;
typedef struct _KkcSegmentPrivate KkcSegmentPrivate;
enum  {
	KKC_SEGMENT_0_PROPERTY,
	KKC_SEGMENT_INPUT_PROPERTY,
	KKC_SEGMENT_OUTPUT_PROPERTY,
	KKC_SEGMENT_NUM_PROPERTIES
};
static GParamSpec* kkc_segment_properties[KKC_SEGMENT_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _KkcSegment {
	GObject parent_instance;
	KkcSegmentPrivate * priv;
	KkcSegment* next;
};

struct _KkcSegmentClass {
	GObjectClass parent_class;
};

struct _KkcSegmentPrivate {
	gchar* _input;
	gchar* _output;
};


static gpointer kkc_segment_parent_class = NULL;

GType kkc_segment_get_type (void) G_GNUC_CONST;
#define KKC_SEGMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), KKC_TYPE_SEGMENT, KkcSegmentPrivate))
KkcSegment* kkc_segment_new (const gchar* input, const gchar* output);
KkcSegment* kkc_segment_construct (GType object_type, const gchar* input, const gchar* output);
void kkc_segment_set_input (KkcSegment* self, const gchar* value);
void kkc_segment_set_output (KkcSegment* self, const gchar* value);
const gchar* kkc_segment_get_input (KkcSegment* self);
const gchar* kkc_segment_get_output (KkcSegment* self);
static void kkc_segment_finalize (GObject * obj);
static void _vala_kkc_segment_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_kkc_segment_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


KkcSegment* kkc_segment_construct (GType object_type, const gchar* input, const gchar* output) {
	KkcSegment * self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (input != NULL, NULL);
	g_return_val_if_fail (output != NULL, NULL);
	self = (KkcSegment*) g_object_new (object_type, NULL);
	_tmp0_ = input;
	kkc_segment_set_input (self, _tmp0_);
	_tmp1_ = output;
	kkc_segment_set_output (self, _tmp1_);
	return self;
}


KkcSegment* kkc_segment_new (const gchar* input, const gchar* output) {
	return kkc_segment_construct (KKC_TYPE_SEGMENT, input, output);
}


const gchar* kkc_segment_get_input (KkcSegment* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_input;
	result = _tmp0_;
	return result;
}


void kkc_segment_set_input (KkcSegment* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, kkc_segment_get_input (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_input);
		self->priv->_input = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, kkc_segment_properties[KKC_SEGMENT_INPUT_PROPERTY]);
	}
}


const gchar* kkc_segment_get_output (KkcSegment* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_output;
	result = _tmp0_;
	return result;
}


void kkc_segment_set_output (KkcSegment* self, const gchar* value) {
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, kkc_segment_get_output (self)) != 0) {
		const gchar* _tmp0_;
		gchar* _tmp1_;
		_tmp0_ = value;
		_tmp1_ = g_strdup (_tmp0_);
		_g_free0 (self->priv->_output);
		self->priv->_output = _tmp1_;
		g_object_notify_by_pspec ((GObject *) self, kkc_segment_properties[KKC_SEGMENT_OUTPUT_PROPERTY]);
	}
}


static void kkc_segment_class_init (KkcSegmentClass * klass) {
	kkc_segment_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (KkcSegmentPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_kkc_segment_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_kkc_segment_set_property;
	G_OBJECT_CLASS (klass)->finalize = kkc_segment_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), KKC_SEGMENT_INPUT_PROPERTY, kkc_segment_properties[KKC_SEGMENT_INPUT_PROPERTY] = g_param_spec_string ("input", "input", "input", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), KKC_SEGMENT_OUTPUT_PROPERTY, kkc_segment_properties[KKC_SEGMENT_OUTPUT_PROPERTY] = g_param_spec_string ("output", "output", "output", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void kkc_segment_instance_init (KkcSegment * self) {
	self->priv = KKC_SEGMENT_GET_PRIVATE (self);
}


static void kkc_segment_finalize (GObject * obj) {
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KKC_TYPE_SEGMENT, KkcSegment);
	_g_free0 (self->priv->_input);
	_g_free0 (self->priv->_output);
	_g_object_unref0 (self->next);
	G_OBJECT_CLASS (kkc_segment_parent_class)->finalize (obj);
}


GType kkc_segment_get_type (void) {
	static volatile gsize kkc_segment_type_id__volatile = 0;
	if (g_once_init_enter (&kkc_segment_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (KkcSegmentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kkc_segment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KkcSegment), 0, (GInstanceInitFunc) kkc_segment_instance_init, NULL };
		GType kkc_segment_type_id;
		kkc_segment_type_id = g_type_register_static (G_TYPE_OBJECT, "KkcSegment", &g_define_type_info, 0);
		g_once_init_leave (&kkc_segment_type_id__volatile, kkc_segment_type_id);
	}
	return kkc_segment_type_id__volatile;
}


static void _vala_kkc_segment_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KKC_TYPE_SEGMENT, KkcSegment);
	switch (property_id) {
		case KKC_SEGMENT_INPUT_PROPERTY:
		g_value_set_string (value, kkc_segment_get_input (self));
		break;
		case KKC_SEGMENT_OUTPUT_PROPERTY:
		g_value_set_string (value, kkc_segment_get_output (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_kkc_segment_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	KkcSegment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, KKC_TYPE_SEGMENT, KkcSegment);
	switch (property_id) {
		case KKC_SEGMENT_INPUT_PROPERTY:
		kkc_segment_set_input (self, g_value_get_string (value));
		break;
		case KKC_SEGMENT_OUTPUT_PROPERTY:
		kkc_segment_set_output (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



