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

/*-
 * Copyright (c) 2017-2018 elementary LLC. (https://elementary.io)
 *
 * 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 "codecore.h"
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	SCRATCH_SERVICES_CTAGS_SYMBOL_0_PROPERTY,
	SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY,
	SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY,
	SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY,
	SCRATCH_SERVICES_CTAGS_SYMBOL_NUM_PROPERTIES
};
static GParamSpec* scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ScratchServicesCtagsSymbolPrivate {
	ScratchServicesDocument* _doc;
	ScratchServicesSymbolType _symbol_type;
	gint _line;
};

static gint ScratchServicesCtagsSymbol_private_offset;
static gpointer scratch_services_ctags_symbol_parent_class = NULL;
static ScratchServicesSymbolItemIface * scratch_services_ctags_symbol_scratch_services_symbol_item_parent_iface = NULL;

static void scratch_services_ctags_symbol_finalize (GObject * obj);
static GType scratch_services_ctags_symbol_get_type_once (void);
static void _vala_scratch_services_ctags_symbol_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_scratch_services_ctags_symbol_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);

static inline gpointer
scratch_services_ctags_symbol_get_instance_private (ScratchServicesCtagsSymbol* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchServicesCtagsSymbol_private_offset);
}

ScratchServicesCtagsSymbol*
scratch_services_ctags_symbol_construct (GType object_type,
                                         ScratchServicesDocument* doc,
                                         const gchar* name,
                                         gint line,
                                         GIcon* _icon,
                                         ScratchServicesSymbolType* s_type)
{
	ScratchServicesCtagsSymbol * self = NULL;
	g_return_val_if_fail (doc != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (ScratchServicesCtagsSymbol*) g_object_new (object_type, "doc", doc, "name", name, "line", line, NULL);
	code_widgets_source_list_item_set_icon ((CodeWidgetsSourceListItem*) self, _icon);
	if (s_type != NULL) {
		scratch_services_symbol_item_set_symbol_type ((ScratchServicesSymbolItem*) self, *s_type);
	}
	return self;
}

ScratchServicesCtagsSymbol*
scratch_services_ctags_symbol_new (ScratchServicesDocument* doc,
                                   const gchar* name,
                                   gint line,
                                   GIcon* _icon,
                                   ScratchServicesSymbolType* s_type)
{
	return scratch_services_ctags_symbol_construct (SCRATCH_SERVICES_TYPE_CTAGS_SYMBOL, doc, name, line, _icon, s_type);
}

ScratchServicesDocument*
scratch_services_ctags_symbol_get_doc (ScratchServicesCtagsSymbol* self)
{
	ScratchServicesDocument* result;
	ScratchServicesDocument* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_doc;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
scratch_services_ctags_symbol_set_doc (ScratchServicesCtagsSymbol* self,
                                       ScratchServicesDocument* value)
{
	ScratchServicesDocument* old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_services_ctags_symbol_get_doc (self);
	if (old_value != value) {
		ScratchServicesDocument* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_doc);
		self->priv->_doc = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY]);
	}
}

static ScratchServicesSymbolType
scratch_services_ctags_symbol_real_get_symbol_type (ScratchServicesSymbolItem* base)
{
	ScratchServicesSymbolType result;
	ScratchServicesCtagsSymbol* self;
	self = (ScratchServicesCtagsSymbol*) base;
	result = self->priv->_symbol_type;
	return result;
}

static void
scratch_services_ctags_symbol_real_set_symbol_type (ScratchServicesSymbolItem* base,
                                                    ScratchServicesSymbolType value)
{
	ScratchServicesCtagsSymbol* self;
	ScratchServicesSymbolType old_value;
	self = (ScratchServicesCtagsSymbol*) base;
	old_value = scratch_services_ctags_symbol_real_get_symbol_type (base);
	if (old_value != value) {
		self->priv->_symbol_type = value;
		g_object_notify_by_pspec ((GObject *) self, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY]);
	}
}

gint
scratch_services_ctags_symbol_get_line (ScratchServicesCtagsSymbol* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_line;
	return result;
}

void
scratch_services_ctags_symbol_set_line (ScratchServicesCtagsSymbol* self,
                                        gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_services_ctags_symbol_get_line (self);
	if (old_value != value) {
		self->priv->_line = value;
		g_object_notify_by_pspec ((GObject *) self, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY]);
	}
}

static void
scratch_services_ctags_symbol_class_init (ScratchServicesCtagsSymbolClass * klass,
                                          gpointer klass_data)
{
	scratch_services_ctags_symbol_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchServicesCtagsSymbol_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_services_ctags_symbol_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_scratch_services_ctags_symbol_set_property;
	G_OBJECT_CLASS (klass)->finalize = scratch_services_ctags_symbol_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY] = g_param_spec_object ("doc", "doc", "doc", SCRATCH_SERVICES_TYPE_DOCUMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY] = g_param_spec_enum ("symbol-type", "symbol-type", "symbol-type", SCRATCH_SERVICES_TYPE_SYMBOL_TYPE, SCRATCH_SERVICES_SYMBOL_TYPE_OTHER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY, scratch_services_ctags_symbol_properties[SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY] = g_param_spec_int ("line", "line", "line", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
scratch_services_ctags_symbol_scratch_services_symbol_item_interface_init (ScratchServicesSymbolItemIface * iface,
                                                                           gpointer iface_data)
{
	scratch_services_ctags_symbol_scratch_services_symbol_item_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_symbol_type = scratch_services_ctags_symbol_real_get_symbol_type;
	iface->set_symbol_type = scratch_services_ctags_symbol_real_set_symbol_type;
}

static void
scratch_services_ctags_symbol_instance_init (ScratchServicesCtagsSymbol * self,
                                             gpointer klass)
{
	self->priv = scratch_services_ctags_symbol_get_instance_private (self);
	self->priv->_symbol_type = SCRATCH_SERVICES_SYMBOL_TYPE_OTHER;
}

static void
scratch_services_ctags_symbol_finalize (GObject * obj)
{
	ScratchServicesCtagsSymbol * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_SERVICES_TYPE_CTAGS_SYMBOL, ScratchServicesCtagsSymbol);
	_g_object_unref0 (self->priv->_doc);
	G_OBJECT_CLASS (scratch_services_ctags_symbol_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
scratch_services_ctags_symbol_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchServicesCtagsSymbolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_services_ctags_symbol_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchServicesCtagsSymbol), 0, (GInstanceInitFunc) scratch_services_ctags_symbol_instance_init, NULL };
	static const GInterfaceInfo scratch_services_symbol_item_info = { (GInterfaceInitFunc) scratch_services_ctags_symbol_scratch_services_symbol_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType scratch_services_ctags_symbol_type_id;
	scratch_services_ctags_symbol_type_id = g_type_register_static (CODE_WIDGETS_SOURCE_LIST_TYPE_EXPANDABLE_ITEM, "ScratchServicesCtagsSymbol", &g_define_type_info, G_TYPE_FLAG_NONE);
	g_type_add_interface_static (scratch_services_ctags_symbol_type_id, SCRATCH_SERVICES_TYPE_SYMBOL_ITEM, &scratch_services_symbol_item_info);
	ScratchServicesCtagsSymbol_private_offset = g_type_add_instance_private (scratch_services_ctags_symbol_type_id, sizeof (ScratchServicesCtagsSymbolPrivate));
	return scratch_services_ctags_symbol_type_id;
}

GType
scratch_services_ctags_symbol_get_type (void)
{
	static gsize scratch_services_ctags_symbol_type_id__once = 0;
	if (g_once_init_enter (&scratch_services_ctags_symbol_type_id__once)) {
		GType scratch_services_ctags_symbol_type_id;
		scratch_services_ctags_symbol_type_id = scratch_services_ctags_symbol_get_type_once ();
		g_once_init_leave (&scratch_services_ctags_symbol_type_id__once, scratch_services_ctags_symbol_type_id);
	}
	return scratch_services_ctags_symbol_type_id__once;
}

static void
_vala_scratch_services_ctags_symbol_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	ScratchServicesCtagsSymbol * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_SERVICES_TYPE_CTAGS_SYMBOL, ScratchServicesCtagsSymbol);
	switch (property_id) {
		case SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY:
		g_value_set_object (value, scratch_services_ctags_symbol_get_doc (self));
		break;
		case SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY:
		g_value_set_enum (value, scratch_services_symbol_item_get_symbol_type ((ScratchServicesSymbolItem*) self));
		break;
		case SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY:
		g_value_set_int (value, scratch_services_ctags_symbol_get_line (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_scratch_services_ctags_symbol_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	ScratchServicesCtagsSymbol * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_SERVICES_TYPE_CTAGS_SYMBOL, ScratchServicesCtagsSymbol);
	switch (property_id) {
		case SCRATCH_SERVICES_CTAGS_SYMBOL_DOC_PROPERTY:
		scratch_services_ctags_symbol_set_doc (self, g_value_get_object (value));
		break;
		case SCRATCH_SERVICES_CTAGS_SYMBOL_SYMBOL_TYPE_PROPERTY:
		scratch_services_symbol_item_set_symbol_type ((ScratchServicesSymbolItem*) self, g_value_get_enum (value));
		break;
		case SCRATCH_SERVICES_CTAGS_SYMBOL_LINE_PROPERTY:
		scratch_services_ctags_symbol_set_line (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

