/* gitg-ref-base.c generated by valac 0.56.19, the Vala compiler
 * generated from gitg-ref-base.vala, do not modify */

/*
 * This file is part of gitg
 *
 * Copyright (C) 2012 - Jesse van den Kieboom
 *
 * gitg 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.
 *
 * gitg 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 gitg. If not, see <http://www.gnu.org/licenses/>.
 */

#include "libgitg.h"
#include <glib.h>
#include <libgit2-glib/ggit.h>
#include <glib-object.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  {
	GITG_REF_BASE_0_PROPERTY,
	GITG_REF_BASE_D_PARSED_NAME_PROPERTY,
	GITG_REF_BASE_D_PUSHES_PROPERTY,
	GITG_REF_BASE_STATE_PROPERTY,
	GITG_REF_BASE_WORKING_PROPERTY,
	GITG_REF_BASE_NUM_PROPERTIES
};
static GParamSpec* gitg_ref_base_properties[GITG_REF_BASE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GitgRefBasePrivate {
	GitgParsedRefName* _d_parsed_name;
	GList* _d_pushes;
	GitgRefState _state;
	gboolean _working;
};

static gint GitgRefBase_private_offset;
static gpointer gitg_ref_base_parent_class = NULL;
static GitgRefIface * gitg_ref_base_gitg_ref_parent_iface = NULL;

static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static GitgRepository* gitg_ref_base_real_get_owner (GitgRef* base);
static void gitg_ref_base_finalize (GObject * obj);
static GType gitg_ref_base_get_type_once (void);
static void _vala_gitg_ref_base_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_gitg_ref_base_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);

static inline gpointer
gitg_ref_base_get_instance_private (GitgRefBase* self)
{
	return G_STRUCT_MEMBER_P (self, GitgRefBase_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static GitgRepository*
gitg_ref_base_real_get_owner (GitgRef* base)
{
	GitgRefBase * self;
	GgitRepository* _tmp0_;
	GitgRepository* result;
	self = (GitgRefBase*) base;
	_tmp0_ = ggit_ref_get_owner (G_TYPE_CHECK_INSTANCE_CAST (self, ggit_ref_get_type (), GgitRef));
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GITG_TYPE_REPOSITORY, GitgRepository);
	return result;
}

GitgRefBase*
gitg_ref_base_construct (GType object_type)
{
	GitgRefBase * self = NULL;
	self = (GitgRefBase*) g_object_new (object_type, NULL);
	return self;
}

GitgRefBase*
gitg_ref_base_new (void)
{
	return gitg_ref_base_construct (GITG_TYPE_REF_BASE);
}

static GitgParsedRefName*
gitg_ref_base_real_get_d_parsed_name (GitgRef* base)
{
	GitgParsedRefName* result;
	GitgRefBase* self;
	GitgParsedRefName* _tmp0_;
	self = (GitgRefBase*) base;
	_tmp0_ = self->priv->_d_parsed_name;
	result = _tmp0_;
	return result;
}

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

static void
gitg_ref_base_real_set_d_parsed_name (GitgRef* base,
                                      GitgParsedRefName* value)
{
	GitgRefBase* self;
	GitgParsedRefName* old_value;
	self = (GitgRefBase*) base;
	old_value = gitg_ref_base_real_get_d_parsed_name (base);
	if (old_value != value) {
		GitgParsedRefName* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_d_parsed_name);
		self->priv->_d_parsed_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_base_properties[GITG_REF_BASE_D_PARSED_NAME_PROPERTY]);
	}
}

static GList*
gitg_ref_base_real_get_d_pushes (GitgRef* base)
{
	GList* result;
	GitgRefBase* self;
	GList* _tmp0_;
	self = (GitgRefBase*) base;
	_tmp0_ = self->priv->_d_pushes;
	result = _tmp0_;
	return result;
}

static void
gitg_ref_base_real_set_d_pushes (GitgRef* base,
                                 GList* value)
{
	GitgRefBase* self;
	GList* old_value;
	self = (GitgRefBase*) base;
	old_value = gitg_ref_base_real_get_d_pushes (base);
	if (old_value != value) {
		GList* _tmp0_;
		_tmp0_ = value;
		value = NULL;
		(self->priv->_d_pushes == NULL) ? NULL : (self->priv->_d_pushes = (_g_list_free__g_object_unref0_ (self->priv->_d_pushes), NULL));
		self->priv->_d_pushes = _tmp0_;
		(value == NULL) ? NULL : (value = (_g_list_free__g_object_unref0_ (value), NULL));
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_base_properties[GITG_REF_BASE_D_PUSHES_PROPERTY]);
	}
}

static GitgRefState
gitg_ref_base_real_get_state (GitgRef* base)
{
	GitgRefState result;
	GitgRefBase* self;
	self = (GitgRefBase*) base;
	result = self->priv->_state;
	return result;
}

static void
gitg_ref_base_real_set_state (GitgRef* base,
                              GitgRefState value)
{
	GitgRefBase* self;
	GitgRefState old_value;
	self = (GitgRefBase*) base;
	old_value = gitg_ref_base_real_get_state (base);
	if (old_value != value) {
		self->priv->_state = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_base_properties[GITG_REF_BASE_STATE_PROPERTY]);
	}
}

static gboolean
gitg_ref_base_real_get_working (GitgRef* base)
{
	gboolean result;
	GitgRefBase* self;
	self = (GitgRefBase*) base;
	result = self->priv->_working;
	return result;
}

static void
gitg_ref_base_real_set_working (GitgRef* base,
                                gboolean value)
{
	GitgRefBase* self;
	gboolean old_value;
	self = (GitgRefBase*) base;
	old_value = gitg_ref_base_real_get_working (base);
	if (old_value != value) {
		self->priv->_working = value;
		g_object_notify_by_pspec ((GObject *) self, gitg_ref_base_properties[GITG_REF_BASE_WORKING_PROPERTY]);
	}
}

static void
gitg_ref_base_class_init (GitgRefBaseClass * klass,
                          gpointer klass_data)
{
	gitg_ref_base_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GitgRefBase_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gitg_ref_base_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gitg_ref_base_set_property;
	G_OBJECT_CLASS (klass)->finalize = gitg_ref_base_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_BASE_D_PARSED_NAME_PROPERTY, gitg_ref_base_properties[GITG_REF_BASE_D_PARSED_NAME_PROPERTY] = g_param_spec_object ("d-parsed-name", "d-parsed-name", "d-parsed-name", GITG_TYPE_PARSED_REF_NAME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_BASE_D_PUSHES_PROPERTY, gitg_ref_base_properties[GITG_REF_BASE_D_PUSHES_PROPERTY] = g_param_spec_pointer ("d-pushes", "d-pushes", "d-pushes", G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_BASE_STATE_PROPERTY, gitg_ref_base_properties[GITG_REF_BASE_STATE_PROPERTY] = g_param_spec_enum ("state", "state", "state", GITG_TYPE_REF_STATE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GITG_REF_BASE_WORKING_PROPERTY, gitg_ref_base_properties[GITG_REF_BASE_WORKING_PROPERTY] = g_param_spec_boolean ("working", "working", "working", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
gitg_ref_base_gitg_ref_interface_init (GitgRefIface * iface,
                                       gpointer iface_data)
{
	gitg_ref_base_gitg_ref_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_owner = (GitgRepository* (*) (GitgRef*)) gitg_ref_base_real_get_owner;
	iface->get_d_parsed_name = gitg_ref_base_real_get_d_parsed_name;
	iface->set_d_parsed_name = gitg_ref_base_real_set_d_parsed_name;
	iface->get_d_pushes = gitg_ref_base_real_get_d_pushes;
	iface->set_d_pushes = gitg_ref_base_real_set_d_pushes;
	iface->get_state = gitg_ref_base_real_get_state;
	iface->set_state = gitg_ref_base_real_set_state;
	iface->get_working = gitg_ref_base_real_get_working;
	iface->set_working = gitg_ref_base_real_set_working;
}

static void
gitg_ref_base_instance_init (GitgRefBase * self,
                             gpointer klass)
{
	self->priv = gitg_ref_base_get_instance_private (self);
}

static void
gitg_ref_base_finalize (GObject * obj)
{
	GitgRefBase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GITG_TYPE_REF_BASE, GitgRefBase);
	_g_object_unref0 (self->priv->_d_parsed_name);
	(self->priv->_d_pushes == NULL) ? NULL : (self->priv->_d_pushes = (_g_list_free__g_object_unref0_ (self->priv->_d_pushes), NULL));
	G_OBJECT_CLASS (gitg_ref_base_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
gitg_ref_base_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GitgRefBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gitg_ref_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GitgRefBase), 0, (GInstanceInitFunc) gitg_ref_base_instance_init, NULL };
	static const GInterfaceInfo gitg_ref_info = { (GInterfaceInitFunc) gitg_ref_base_gitg_ref_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gitg_ref_base_type_id;
	gitg_ref_base_type_id = g_type_register_static (ggit_ref_get_type (), "GitgRefBase", &g_define_type_info, 0);
	g_type_add_interface_static (gitg_ref_base_type_id, GITG_TYPE_REF, &gitg_ref_info);
	GitgRefBase_private_offset = g_type_add_instance_private (gitg_ref_base_type_id, sizeof (GitgRefBasePrivate));
	return gitg_ref_base_type_id;
}

GType
gitg_ref_base_get_type (void)
{
	static gsize gitg_ref_base_type_id__once = 0;
	if (g_once_init_enter (&gitg_ref_base_type_id__once)) {
		GType gitg_ref_base_type_id;
		gitg_ref_base_type_id = gitg_ref_base_get_type_once ();
		g_once_init_leave (&gitg_ref_base_type_id__once, gitg_ref_base_type_id);
	}
	return gitg_ref_base_type_id__once;
}

static void
_vala_gitg_ref_base_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	GitgRefBase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_REF_BASE, GitgRefBase);
	switch (property_id) {
		case GITG_REF_BASE_D_PARSED_NAME_PROPERTY:
		g_value_set_object (value, gitg_ref_get_d_parsed_name ((GitgRef*) self));
		break;
		case GITG_REF_BASE_D_PUSHES_PROPERTY:
		g_value_set_pointer (value, gitg_ref_get_d_pushes ((GitgRef*) self));
		break;
		case GITG_REF_BASE_STATE_PROPERTY:
		g_value_set_enum (value, gitg_ref_get_state ((GitgRef*) self));
		break;
		case GITG_REF_BASE_WORKING_PROPERTY:
		g_value_set_boolean (value, gitg_ref_get_working ((GitgRef*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gitg_ref_base_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	GitgRefBase * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GITG_TYPE_REF_BASE, GitgRefBase);
	switch (property_id) {
		case GITG_REF_BASE_D_PARSED_NAME_PROPERTY:
		gitg_ref_set_d_parsed_name ((GitgRef*) self, g_value_get_object (value));
		break;
		case GITG_REF_BASE_D_PUSHES_PROPERTY:
		gitg_ref_set_d_pushes ((GitgRef*) self, g_value_get_pointer (value));
		break;
		case GITG_REF_BASE_STATE_PROPERTY:
		gitg_ref_set_state ((GitgRef*) self, g_value_get_enum (value));
		break;
		case GITG_REF_BASE_WORKING_PROPERTY:
		gitg_ref_set_working ((GitgRef*) self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

