/* WacomTool.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from WacomTool.vala, do not modify */

/*
 * Copyright (c) 2019 elementary, Inc. (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 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 "wacom.h"
#include <glib.h>
#include <stdlib.h>
#include <string.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  {
	WACOM_BACKEND_WACOM_TOOL_0_PROPERTY,
	WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY,
	WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY,
	WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY,
	WACOM_BACKEND_WACOM_TOOL_NUM_PROPERTIES
};
static GParamSpec* wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _WacomBackendWacomToolPrivate {
	guint64 _id;
	guint64 _serial;
	gchar* _settings_path;
};

static gint WacomBackendWacomTool_private_offset;
static gpointer wacom_backend_wacom_tool_parent_class = NULL;

static void wacom_backend_wacom_tool_finalize (GObject * obj);
static GType wacom_backend_wacom_tool_get_type_once (void);
static void _vala_wacom_backend_wacom_tool_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_wacom_backend_wacom_tool_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

GQuark
wacom_exception_quark (void)
{
	return g_quark_from_static_string ("wacom-exception-quark");
}

static GType
wacom_exception_get_type_once (void)
{
	static const GEnumValue values[] = {{WACOM_EXCEPTION_LIBWACOM_ERROR, "WACOM_EXCEPTION_LIBWACOM_ERROR", "libwacom-error"}, {0, NULL, NULL}};
	GType wacom_exception_type_id;
	wacom_exception_type_id = g_enum_register_static ("WacomException", values);
	return wacom_exception_type_id;
}

GType
wacom_exception_get_type (void)
{
	static volatile gsize wacom_exception_type_id__once = 0;
	if (g_once_init_enter (&wacom_exception_type_id__once)) {
		GType wacom_exception_type_id;
		wacom_exception_type_id = wacom_exception_get_type_once ();
		g_once_init_leave (&wacom_exception_type_id__once, wacom_exception_type_id);
	}
	return wacom_exception_type_id__once;
}

static inline gpointer
wacom_backend_wacom_tool_get_instance_private (WacomBackendWacomTool* self)
{
	return G_STRUCT_MEMBER_P (self, WacomBackendWacomTool_private_offset);
}

WacomBackendWacomTool*
wacom_backend_wacom_tool_construct (GType object_type,
                                    guint64 serial,
                                    guint64 id,
                                    const gchar* settings_path)
{
	WacomBackendWacomTool * self = NULL;
	g_return_val_if_fail (settings_path != NULL, NULL);
	self = (WacomBackendWacomTool*) g_object_new (object_type, "id", id, "serial", serial, "settings-path", settings_path, NULL);
	return self;
}

WacomBackendWacomTool*
wacom_backend_wacom_tool_new (guint64 serial,
                              guint64 id,
                              const gchar* settings_path)
{
	return wacom_backend_wacom_tool_construct (WACOM_BACKEND_TYPE_WACOM_TOOL, serial, id, settings_path);
}

guint64
wacom_backend_wacom_tool_get_id (WacomBackendWacomTool* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_id;
	return result;
}

static void
wacom_backend_wacom_tool_set_id (WacomBackendWacomTool* self,
                                 guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_wacom_tool_get_id (self);
	if (old_value != value) {
		self->priv->_id = value;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY]);
	}
}

guint64
wacom_backend_wacom_tool_get_serial (WacomBackendWacomTool* self)
{
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	result = self->priv->_serial;
	return result;
}

static void
wacom_backend_wacom_tool_set_serial (WacomBackendWacomTool* self,
                                     guint64 value)
{
	guint64 old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_wacom_tool_get_serial (self);
	if (old_value != value) {
		self->priv->_serial = value;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY]);
	}
}

const gchar*
wacom_backend_wacom_tool_get_settings_path (WacomBackendWacomTool* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_settings_path;
	result = _tmp0_;
	return result;
}

static void
wacom_backend_wacom_tool_set_settings_path (WacomBackendWacomTool* self,
                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_wacom_tool_get_settings_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_settings_path);
		self->priv->_settings_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY]);
	}
}

static void
wacom_backend_wacom_tool_class_init (WacomBackendWacomToolClass * klass,
                                     gpointer klass_data)
{
	wacom_backend_wacom_tool_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WacomBackendWacomTool_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wacom_backend_wacom_tool_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wacom_backend_wacom_tool_set_property;
	G_OBJECT_CLASS (klass)->finalize = wacom_backend_wacom_tool_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY] = g_param_spec_uint64 ("id", "id", "id", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY] = g_param_spec_uint64 ("serial", "serial", "serial", 0, G_MAXUINT64, (guint64) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY, wacom_backend_wacom_tool_properties[WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY] = g_param_spec_string ("settings-path", "settings-path", "settings-path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
wacom_backend_wacom_tool_instance_init (WacomBackendWacomTool * self,
                                        gpointer klass)
{
	self->priv = wacom_backend_wacom_tool_get_instance_private (self);
	self->priv->_id = (guint64) 0;
	self->priv->_serial = (guint64) 0;
}

static void
wacom_backend_wacom_tool_finalize (GObject * obj)
{
	WacomBackendWacomTool * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WACOM_BACKEND_TYPE_WACOM_TOOL, WacomBackendWacomTool);
	_g_free0 (self->priv->_settings_path);
	G_OBJECT_CLASS (wacom_backend_wacom_tool_parent_class)->finalize (obj);
}

static GType
wacom_backend_wacom_tool_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WacomBackendWacomToolClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wacom_backend_wacom_tool_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WacomBackendWacomTool), 0, (GInstanceInitFunc) wacom_backend_wacom_tool_instance_init, NULL };
	GType wacom_backend_wacom_tool_type_id;
	wacom_backend_wacom_tool_type_id = g_type_register_static (G_TYPE_OBJECT, "WacomBackendWacomTool", &g_define_type_info, 0);
	WacomBackendWacomTool_private_offset = g_type_add_instance_private (wacom_backend_wacom_tool_type_id, sizeof (WacomBackendWacomToolPrivate));
	return wacom_backend_wacom_tool_type_id;
}

GType
wacom_backend_wacom_tool_get_type (void)
{
	static volatile gsize wacom_backend_wacom_tool_type_id__once = 0;
	if (g_once_init_enter (&wacom_backend_wacom_tool_type_id__once)) {
		GType wacom_backend_wacom_tool_type_id;
		wacom_backend_wacom_tool_type_id = wacom_backend_wacom_tool_get_type_once ();
		g_once_init_leave (&wacom_backend_wacom_tool_type_id__once, wacom_backend_wacom_tool_type_id);
	}
	return wacom_backend_wacom_tool_type_id__once;
}

static void
_vala_wacom_backend_wacom_tool_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	WacomBackendWacomTool * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WACOM_BACKEND_TYPE_WACOM_TOOL, WacomBackendWacomTool);
	switch (property_id) {
		case WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY:
		g_value_set_uint64 (value, wacom_backend_wacom_tool_get_id (self));
		break;
		case WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY:
		g_value_set_uint64 (value, wacom_backend_wacom_tool_get_serial (self));
		break;
		case WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY:
		g_value_set_string (value, wacom_backend_wacom_tool_get_settings_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wacom_backend_wacom_tool_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	WacomBackendWacomTool * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WACOM_BACKEND_TYPE_WACOM_TOOL, WacomBackendWacomTool);
	switch (property_id) {
		case WACOM_BACKEND_WACOM_TOOL_ID_PROPERTY:
		wacom_backend_wacom_tool_set_id (self, g_value_get_uint64 (value));
		break;
		case WACOM_BACKEND_WACOM_TOOL_SERIAL_PROPERTY:
		wacom_backend_wacom_tool_set_serial (self, g_value_get_uint64 (value));
		break;
		case WACOM_BACKEND_WACOM_TOOL_SETTINGS_PATH_PROPERTY:
		wacom_backend_wacom_tool_set_settings_path (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

