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

/* SPDX-License-Identifier: GPL-3.0-or-later*/

#include "graphs.h"
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <string.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  {
	GRAPHS_DATA_0_PROPERTY,
	GRAPHS_DATA_SETTINGS_PROPERTY,
	GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY,
	GRAPHS_DATA_CAN_UNDO_PROPERTY,
	GRAPHS_DATA_CAN_REDO_PROPERTY,
	GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY,
	GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY,
	GRAPHS_DATA_FILE_PROPERTY,
	GRAPHS_DATA_UNSAVED_PROPERTY,
	GRAPHS_DATA_NUM_PROPERTIES
};
static GParamSpec* graphs_data_properties[GRAPHS_DATA_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	GRAPHS_DATA_ADD_HISTORY_STATE_REQUEST_SIGNAL,
	GRAPHS_DATA_SAVED_SIGNAL,
	GRAPHS_DATA_NUM_SIGNALS
};
static guint graphs_data_signals[GRAPHS_DATA_NUM_SIGNALS] = {0};

struct _GraphsDataPrivate {
	GSettings* _settings;
	GraphsFigureSettings* _figure_settings;
	gboolean _can_undo;
	gboolean _can_redo;
	gboolean _can_view_back;
	gboolean _can_view_forward;
	GFile* _file;
	gboolean _unsaved;
	gboolean* _used_positions;
	gint _used_positions_length1;
	gint __used_positions_size_;
};

static gint GraphsData_private_offset;
static gpointer graphs_data_parent_class = NULL;

static gboolean* _vala_array_dup3 (gboolean* self,
                            gssize length);
static void graphs_data_finalize (GObject * obj);
static GType graphs_data_get_type_once (void);
static void _vala_graphs_data_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec);
static void _vala_graphs_data_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
graphs_data_get_instance_private (GraphsData* self)
{
	return G_STRUCT_MEMBER_P (self, GraphsData_private_offset);
}

static gboolean*
_vala_array_dup3 (gboolean* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (gboolean));
	}
	return NULL;
}

gboolean*
graphs_data_get_used_positions (GraphsData* self,
                                gint* result_length1)
{
	gboolean* _tmp0_;
	gint _tmp0__length1;
	gboolean* _tmp1_;
	gint _tmp1__length1;
	gboolean* _tmp2_;
	gint _tmp2__length1;
	gboolean* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_used_positions;
	_tmp0__length1 = self->priv->_used_positions_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

void
graphs_data_set_used_positions (GraphsData* self,
                                gboolean a,
                                gboolean b,
                                gboolean c,
                                gboolean d)
{
	gboolean* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_new0 (gboolean, 4);
	_tmp0_[0] = a;
	_tmp0_[1] = b;
	_tmp0_[2] = c;
	_tmp0_[3] = d;
	self->priv->_used_positions = (g_free (self->priv->_used_positions), NULL);
	self->priv->_used_positions = _tmp0_;
	self->priv->_used_positions_length1 = 4;
	self->priv->__used_positions_size_ = self->priv->_used_positions_length1;
}

GraphsData*
graphs_data_construct (GType object_type)
{
	GraphsData * self = NULL;
	self = (GraphsData*) g_object_new (object_type, NULL);
	return self;
}

GraphsData*
graphs_data_new (void)
{
	return graphs_data_construct (GRAPHS_TYPE_DATA);
}

GSettings*
graphs_data_get_settings (GraphsData* self)
{
	GSettings* result;
	GSettings* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_settings;
	result = _tmp0_;
	return result;
}

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

void
graphs_data_set_settings (GraphsData* self,
                          GSettings* value)
{
	GSettings* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_settings (self);
	if (old_value != value) {
		GSettings* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_settings);
		self->priv->_settings = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_SETTINGS_PROPERTY]);
	}
}

GraphsFigureSettings*
graphs_data_get_figure_settings (GraphsData* self)
{
	GraphsFigureSettings* result;
	GraphsFigureSettings* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_figure_settings;
	result = _tmp0_;
	return result;
}

void
graphs_data_set_figure_settings (GraphsData* self,
                                 GraphsFigureSettings* value)
{
	GraphsFigureSettings* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_figure_settings (self);
	if (old_value != value) {
		GraphsFigureSettings* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_figure_settings);
		self->priv->_figure_settings = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY]);
	}
}

gboolean
graphs_data_get_can_undo (GraphsData* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_undo;
	return result;
}

void
graphs_data_set_can_undo (GraphsData* self,
                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_can_undo (self);
	if (old_value != value) {
		self->priv->_can_undo = value;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_CAN_UNDO_PROPERTY]);
	}
}

gboolean
graphs_data_get_can_redo (GraphsData* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_redo;
	return result;
}

void
graphs_data_set_can_redo (GraphsData* self,
                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_can_redo (self);
	if (old_value != value) {
		self->priv->_can_redo = value;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_CAN_REDO_PROPERTY]);
	}
}

gboolean
graphs_data_get_can_view_back (GraphsData* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_view_back;
	return result;
}

void
graphs_data_set_can_view_back (GraphsData* self,
                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_can_view_back (self);
	if (old_value != value) {
		self->priv->_can_view_back = value;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY]);
	}
}

gboolean
graphs_data_get_can_view_forward (GraphsData* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_can_view_forward;
	return result;
}

void
graphs_data_set_can_view_forward (GraphsData* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_can_view_forward (self);
	if (old_value != value) {
		self->priv->_can_view_forward = value;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY]);
	}
}

GFile*
graphs_data_get_file (GraphsData* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}

void
graphs_data_set_file (GraphsData* self,
                      GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_file (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_file);
		self->priv->_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_FILE_PROPERTY]);
	}
}

gboolean
graphs_data_get_unsaved (GraphsData* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_unsaved;
	return result;
}

void
graphs_data_set_unsaved (GraphsData* self,
                         gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = graphs_data_get_unsaved (self);
	if (old_value != value) {
		self->priv->_unsaved = value;
		g_object_notify_by_pspec ((GObject *) self, graphs_data_properties[GRAPHS_DATA_UNSAVED_PROPERTY]);
	}
}

static void
graphs_data_class_init (GraphsDataClass * klass,
                        gpointer klass_data)
{
	graphs_data_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GraphsData_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_graphs_data_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_graphs_data_set_property;
	G_OBJECT_CLASS (klass)->finalize = graphs_data_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_SETTINGS_PROPERTY, graphs_data_properties[GRAPHS_DATA_SETTINGS_PROPERTY] = g_param_spec_object ("settings", "settings", "settings", g_settings_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY, graphs_data_properties[GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY] = g_param_spec_object ("figure-settings", "figure-settings", "figure-settings", GRAPHS_TYPE_FIGURE_SETTINGS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_CAN_UNDO_PROPERTY, graphs_data_properties[GRAPHS_DATA_CAN_UNDO_PROPERTY] = g_param_spec_boolean ("can-undo", "can-undo", "can-undo", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_CAN_REDO_PROPERTY, graphs_data_properties[GRAPHS_DATA_CAN_REDO_PROPERTY] = g_param_spec_boolean ("can-redo", "can-redo", "can-redo", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY, graphs_data_properties[GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY] = g_param_spec_boolean ("can-view-back", "can-view-back", "can-view-back", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY, graphs_data_properties[GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY] = g_param_spec_boolean ("can-view-forward", "can-view-forward", "can-view-forward", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_FILE_PROPERTY, graphs_data_properties[GRAPHS_DATA_FILE_PROPERTY] = g_param_spec_object ("file", "file", "file", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GRAPHS_DATA_UNSAVED_PROPERTY, graphs_data_properties[GRAPHS_DATA_UNSAVED_PROPERTY] = g_param_spec_boolean ("unsaved", "unsaved", "unsaved", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	graphs_data_signals[GRAPHS_DATA_ADD_HISTORY_STATE_REQUEST_SIGNAL] = g_signal_new ("add-history-state-request", GRAPHS_TYPE_DATA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	graphs_data_signals[GRAPHS_DATA_SAVED_SIGNAL] = g_signal_new ("saved", GRAPHS_TYPE_DATA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
graphs_data_instance_init (GraphsData * self,
                           gpointer klass)
{
	self->priv = graphs_data_get_instance_private (self);
	self->priv->_can_undo = FALSE;
	self->priv->_can_redo = FALSE;
	self->priv->_can_view_back = FALSE;
	self->priv->_can_view_forward = FALSE;
	self->priv->_unsaved = FALSE;
}

static void
graphs_data_finalize (GObject * obj)
{
	GraphsData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GRAPHS_TYPE_DATA, GraphsData);
	_g_object_unref0 (self->priv->_settings);
	_g_object_unref0 (self->priv->_figure_settings);
	_g_object_unref0 (self->priv->_file);
	self->priv->_used_positions = (g_free (self->priv->_used_positions), NULL);
	G_OBJECT_CLASS (graphs_data_parent_class)->finalize (obj);
}

/**
     * Data class
     */
static GType
graphs_data_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GraphsDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) graphs_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GraphsData), 0, (GInstanceInitFunc) graphs_data_instance_init, NULL };
	GType graphs_data_type_id;
	graphs_data_type_id = g_type_register_static (G_TYPE_OBJECT, "GraphsData", &g_define_type_info, 0);
	GraphsData_private_offset = g_type_add_instance_private (graphs_data_type_id, sizeof (GraphsDataPrivate));
	return graphs_data_type_id;
}

GType
graphs_data_get_type (void)
{
	static volatile gsize graphs_data_type_id__once = 0;
	if (g_once_init_enter (&graphs_data_type_id__once)) {
		GType graphs_data_type_id;
		graphs_data_type_id = graphs_data_get_type_once ();
		g_once_init_leave (&graphs_data_type_id__once, graphs_data_type_id);
	}
	return graphs_data_type_id__once;
}

static void
_vala_graphs_data_get_property (GObject * object,
                                guint property_id,
                                GValue * value,
                                GParamSpec * pspec)
{
	GraphsData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_DATA, GraphsData);
	switch (property_id) {
		case GRAPHS_DATA_SETTINGS_PROPERTY:
		g_value_set_object (value, graphs_data_get_settings (self));
		break;
		case GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY:
		g_value_set_object (value, graphs_data_get_figure_settings (self));
		break;
		case GRAPHS_DATA_CAN_UNDO_PROPERTY:
		g_value_set_boolean (value, graphs_data_get_can_undo (self));
		break;
		case GRAPHS_DATA_CAN_REDO_PROPERTY:
		g_value_set_boolean (value, graphs_data_get_can_redo (self));
		break;
		case GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY:
		g_value_set_boolean (value, graphs_data_get_can_view_back (self));
		break;
		case GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY:
		g_value_set_boolean (value, graphs_data_get_can_view_forward (self));
		break;
		case GRAPHS_DATA_FILE_PROPERTY:
		g_value_set_object (value, graphs_data_get_file (self));
		break;
		case GRAPHS_DATA_UNSAVED_PROPERTY:
		g_value_set_boolean (value, graphs_data_get_unsaved (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_graphs_data_set_property (GObject * object,
                                guint property_id,
                                const GValue * value,
                                GParamSpec * pspec)
{
	GraphsData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GRAPHS_TYPE_DATA, GraphsData);
	switch (property_id) {
		case GRAPHS_DATA_SETTINGS_PROPERTY:
		graphs_data_set_settings (self, g_value_get_object (value));
		break;
		case GRAPHS_DATA_FIGURE_SETTINGS_PROPERTY:
		graphs_data_set_figure_settings (self, g_value_get_object (value));
		break;
		case GRAPHS_DATA_CAN_UNDO_PROPERTY:
		graphs_data_set_can_undo (self, g_value_get_boolean (value));
		break;
		case GRAPHS_DATA_CAN_REDO_PROPERTY:
		graphs_data_set_can_redo (self, g_value_get_boolean (value));
		break;
		case GRAPHS_DATA_CAN_VIEW_BACK_PROPERTY:
		graphs_data_set_can_view_back (self, g_value_get_boolean (value));
		break;
		case GRAPHS_DATA_CAN_VIEW_FORWARD_PROPERTY:
		graphs_data_set_can_view_forward (self, g_value_get_boolean (value));
		break;
		case GRAPHS_DATA_FILE_PROPERTY:
		graphs_data_set_file (self, g_value_get_object (value));
		break;
		case GRAPHS_DATA_UNSAVED_PROPERTY:
		graphs_data_set_unsaved (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

