/* shell-config.c generated by valac 0.16.1, the Vala compiler
 * generated from shell-config.vala, do not modify */

/*
 * shell-config.vala - This file is part of the Geany MultiTerm plugin
 *
 * Copyright (c) 2012 Matthew Brush <matt@geany.org>.
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

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

#define _multi_term_config_unref0(var) ((var == NULL) ? NULL : (var = (multi_term_config_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 _MultiTermParamSpecShellConfig MultiTermParamSpecShellConfig;

struct _MultiTermShellConfigPrivate {
	gchar* _section;
};

struct _MultiTermParamSpecShellConfig {
	GParamSpec parent_instance;
};


static gpointer multi_term_shell_config_parent_class = NULL;

#define MULTI_TERM_SHELL_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MULTI_TERM_TYPE_SHELL_CONFIG, MultiTermShellConfigPrivate))
enum  {
	MULTI_TERM_SHELL_CONFIG_DUMMY_PROPERTY
};
#define MULTI_TERM_SHELL_CONFIG_warning_tmpl "Unable to read value for '%s' key: %s"
MultiTermConfig* multi_term_shell_config_get_cfg (MultiTermShellConfig* self);
GKeyFile* multi_term_shell_config_get_kf (MultiTermShellConfig* self);
static void multi_term_shell_config_finalize (MultiTermShellConfig* obj);


static gpointer _multi_term_config_ref0 (gpointer self) {
	return self ? multi_term_config_ref (self) : NULL;
}


MultiTermShellConfig* multi_term_shell_config_construct (GType object_type, MultiTermConfig* cfg, const gchar* section) {
	MultiTermShellConfig* self = NULL;
	MultiTermConfig* _tmp0_;
	MultiTermConfig* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (cfg != NULL, NULL);
	g_return_val_if_fail (section != NULL, NULL);
	self = (MultiTermShellConfig*) g_type_create_instance (object_type);
	_tmp0_ = cfg;
	_tmp1_ = _multi_term_config_ref0 (_tmp0_);
	_multi_term_config_unref0 (self->_cfg);
	self->_cfg = _tmp1_;
	_tmp2_ = section;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->_section);
	self->priv->_section = _tmp3_;
	return self;
}


MultiTermShellConfig* multi_term_shell_config_new (MultiTermConfig* cfg, const gchar* section) {
	return multi_term_shell_config_construct (MULTI_TERM_TYPE_SHELL_CONFIG, cfg, section);
}


MultiTermConfig* multi_term_shell_config_get_cfg (MultiTermShellConfig* self) {
	MultiTermConfig* result;
	MultiTermConfig* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_cfg;
	result = _tmp0_;
	return result;
}


GKeyFile* multi_term_shell_config_get_kf (MultiTermShellConfig* self) {
	GKeyFile* result;
	MultiTermConfig* _tmp0_;
	MultiTermConfig* _tmp1_;
	GKeyFile* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = multi_term_shell_config_get_cfg (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->kf;
	result = _tmp2_;
	return result;
}


const gchar* multi_term_shell_config_get_section (MultiTermShellConfig* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_section;
	result = _tmp0_;
	return result;
}


gchar* multi_term_shell_config_get_name (MultiTermShellConfig* self) {
	gchar* result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_string (_tmp1_, _tmp2_, "name", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch7_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally7;
	__catch7_g_key_file_error:
	{
		GError* err = NULL;
		gchar* _tmp5_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = g_strdup ("Default");
		result = _tmp5_;
		_g_error_free0 (err);
		return result;
	}
	__finally7:
	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 NULL;
}


void multi_term_shell_config_set_name (MultiTermShellConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "name", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


gchar* multi_term_shell_config_get_command (MultiTermShellConfig* self) {
	gchar* result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_string (_tmp1_, _tmp2_, "command", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch8_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally8;
	__catch8_g_key_file_error:
	{
		GError* err = NULL;
		gchar* _tmp5_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = g_strdup ("sh");
		result = _tmp5_;
		_g_error_free0 (err);
		return result;
	}
	__finally8:
	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 NULL;
}


void multi_term_shell_config_set_command (MultiTermShellConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "command", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


gboolean multi_term_shell_config_get_track_title (MultiTermShellConfig* self) {
	gboolean result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_boolean (_tmp1_, _tmp2_, "track_title", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch9_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 FALSE;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally9;
	__catch9_g_key_file_error:
	{
		GError* err = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		result = TRUE;
		_g_error_free0 (err);
		return result;
	}
	__finally9:
	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 FALSE;
}


void multi_term_shell_config_set_track_title (MultiTermShellConfig* self, gboolean value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_boolean (_tmp1_, _tmp2_, "track_title", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


gchar* multi_term_shell_config_get_background_color (MultiTermShellConfig* self) {
	gchar* result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_string (_tmp1_, _tmp2_, "bg_color", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch10_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally10;
	__catch10_g_key_file_error:
	{
		GError* err = NULL;
		gchar* _tmp5_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = g_strdup ("#ffffff");
		result = _tmp5_;
		_g_error_free0 (err);
		return result;
	}
	__finally10:
	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 NULL;
}


void multi_term_shell_config_set_background_color (MultiTermShellConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "bg_color", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


gchar* multi_term_shell_config_get_foreground_color (MultiTermShellConfig* self) {
	gchar* result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_string (_tmp1_, _tmp2_, "fg_color", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch11_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally11;
	__catch11_g_key_file_error:
	{
		GError* err = NULL;
		gchar* _tmp5_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = g_strdup ("#000000");
		result = _tmp5_;
		_g_error_free0 (err);
		return result;
	}
	__finally11:
	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 NULL;
}


void multi_term_shell_config_set_foreground_color (MultiTermShellConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "fg_color", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


gchar* multi_term_shell_config_get_font (MultiTermShellConfig* self) {
	gchar* result;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	{
		GKeyFile* _tmp0_;
		GKeyFile* _tmp1_;
		const gchar* _tmp2_;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		_tmp0_ = multi_term_shell_config_get_kf (self);
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->_section;
		_tmp3_ = g_key_file_get_string (_tmp1_, _tmp2_, "font", &_inner_error_);
		_tmp4_ = _tmp3_;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch12_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected 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 NULL;
		}
		result = _tmp4_;
		return result;
	}
	goto __finally12;
	__catch12_g_key_file_error:
	{
		GError* err = NULL;
		gchar* _tmp5_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = g_strdup ("Monospace 9");
		result = _tmp5_;
		_g_error_free0 (err);
		return result;
	}
	__finally12:
	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 NULL;
}


void multi_term_shell_config_set_font (MultiTermShellConfig* self, const gchar* value) {
	GKeyFile* _tmp0_;
	GKeyFile* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	MultiTermConfig* _tmp4_;
	MultiTermConfig* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = multi_term_shell_config_get_kf (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_section;
	_tmp3_ = value;
	g_key_file_set_string (_tmp1_, _tmp2_, "font", _tmp3_);
	_tmp4_ = multi_term_shell_config_get_cfg (self);
	_tmp5_ = _tmp4_;
	multi_term_config_store_eventually (_tmp5_);
}


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


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


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


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


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


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


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


void multi_term_value_set_shell_config (GValue* value, gpointer v_object) {
	MultiTermShellConfig* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MULTI_TERM_TYPE_SHELL_CONFIG));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MULTI_TERM_TYPE_SHELL_CONFIG));
		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;
		multi_term_shell_config_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		multi_term_shell_config_unref (old);
	}
}


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


static void multi_term_shell_config_class_init (MultiTermShellConfigClass * klass) {
	multi_term_shell_config_parent_class = g_type_class_peek_parent (klass);
	MULTI_TERM_SHELL_CONFIG_CLASS (klass)->finalize = multi_term_shell_config_finalize;
	g_type_class_add_private (klass, sizeof (MultiTermShellConfigPrivate));
}


static void multi_term_shell_config_instance_init (MultiTermShellConfig * self) {
	self->priv = MULTI_TERM_SHELL_CONFIG_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void multi_term_shell_config_finalize (MultiTermShellConfig* obj) {
	MultiTermShellConfig * self;
	self = MULTI_TERM_SHELL_CONFIG (obj);
	_multi_term_config_unref0 (self->_cfg);
	_g_free0 (self->priv->_section);
}


GType multi_term_shell_config_get_type (void) {
	static volatile gsize multi_term_shell_config_type_id__volatile = 0;
	if (g_once_init_enter (&multi_term_shell_config_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { multi_term_value_shell_config_init, multi_term_value_shell_config_free_value, multi_term_value_shell_config_copy_value, multi_term_value_shell_config_peek_pointer, "p", multi_term_value_shell_config_collect_value, "p", multi_term_value_shell_config_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (MultiTermShellConfigClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) multi_term_shell_config_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MultiTermShellConfig), 0, (GInstanceInitFunc) multi_term_shell_config_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 multi_term_shell_config_type_id;
		multi_term_shell_config_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MultiTermShellConfig", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&multi_term_shell_config_type_id__volatile, multi_term_shell_config_type_id);
	}
	return multi_term_shell_config_type_id__volatile;
}


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


void multi_term_shell_config_unref (gpointer instance) {
	MultiTermShellConfig* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		MULTI_TERM_SHELL_CONFIG_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



