/* Device.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Device.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 <stdlib.h>
#include <string.h>
#include <glib.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_DEVICE_0_PROPERTY,
	WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY,
	WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY,
	WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY,
	WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY,
	WACOM_BACKEND_DEVICE_NUM_PROPERTIES
};
static GParamSpec* wacom_backend_device_properties[WACOM_BACKEND_DEVICE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _WacomBackendDevicePrivate {
	gchar* _device_file;
	gchar* _vendor_id;
	gchar* _product_id;
	WacomBackendDeviceDeviceType _dev_type;
};

static gint WacomBackendDevice_private_offset;
static gpointer wacom_backend_device_parent_class = NULL;

static void wacom_backend_device_finalize (GObject * obj);
static GType wacom_backend_device_get_type_once (void);
static void _vala_wacom_backend_device_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_wacom_backend_device_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
wacom_backend_device_get_instance_private (WacomBackendDevice* self)
{
	return G_STRUCT_MEMBER_P (self, WacomBackendDevice_private_offset);
}

static GType
wacom_backend_device_device_type_get_type_once (void)
{
	static const GFlagsValue values[] = {{WACOM_BACKEND_DEVICE_DEVICE_TYPE_MOUSE, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_MOUSE", "mouse"}, {WACOM_BACKEND_DEVICE_DEVICE_TYPE_KEYBOARD, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_KEYBOARD", "keyboard"}, {WACOM_BACKEND_DEVICE_DEVICE_TYPE_TOUCHPAD, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_TOUCHPAD", "touchpad"}, {WACOM_BACKEND_DEVICE_DEVICE_TYPE_TABLET, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_TABLET", "tablet"}, {WACOM_BACKEND_DEVICE_DEVICE_TYPE_TOUCHSCREEN, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_TOUCHSCREEN", "touchscreen"}, {WACOM_BACKEND_DEVICE_DEVICE_TYPE_PAD, "WACOM_BACKEND_DEVICE_DEVICE_TYPE_PAD", "pad"}, {0, NULL, NULL}};
	GType wacom_backend_device_device_type_type_id;
	wacom_backend_device_device_type_type_id = g_flags_register_static ("WacomBackendDeviceDeviceType", values);
	return wacom_backend_device_device_type_type_id;
}

GType
wacom_backend_device_device_type_get_type (void)
{
	static volatile gsize wacom_backend_device_device_type_type_id__once = 0;
	if (g_once_init_enter (&wacom_backend_device_device_type_type_id__once)) {
		GType wacom_backend_device_device_type_type_id;
		wacom_backend_device_device_type_type_id = wacom_backend_device_device_type_get_type_once ();
		g_once_init_leave (&wacom_backend_device_device_type_type_id__once, wacom_backend_device_device_type_type_id);
	}
	return wacom_backend_device_device_type_type_id__once;
}

WacomBackendDevice*
wacom_backend_device_construct (GType object_type)
{
	WacomBackendDevice * self = NULL;
	self = (WacomBackendDevice*) g_object_new (object_type, NULL);
	return self;
}

WacomBackendDevice*
wacom_backend_device_new (void)
{
	return wacom_backend_device_construct (WACOM_BACKEND_TYPE_DEVICE);
}

const gchar*
wacom_backend_device_get_device_file (WacomBackendDevice* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_device_file;
	result = _tmp0_;
	return result;
}

void
wacom_backend_device_set_device_file (WacomBackendDevice* self,
                                      const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_device_get_device_file (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_device_file);
		self->priv->_device_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY]);
	}
}

const gchar*
wacom_backend_device_get_vendor_id (WacomBackendDevice* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_vendor_id;
	result = _tmp0_;
	return result;
}

void
wacom_backend_device_set_vendor_id (WacomBackendDevice* self,
                                    const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_device_get_vendor_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_vendor_id);
		self->priv->_vendor_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY]);
	}
}

const gchar*
wacom_backend_device_get_product_id (WacomBackendDevice* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_product_id;
	result = _tmp0_;
	return result;
}

void
wacom_backend_device_set_product_id (WacomBackendDevice* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_device_get_product_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_product_id);
		self->priv->_product_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY]);
	}
}

WacomBackendDeviceDeviceType
wacom_backend_device_get_dev_type (WacomBackendDevice* self)
{
	WacomBackendDeviceDeviceType result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_dev_type;
	return result;
}

void
wacom_backend_device_set_dev_type (WacomBackendDevice* self,
                                   WacomBackendDeviceDeviceType value)
{
	WacomBackendDeviceDeviceType old_value;
	g_return_if_fail (self != NULL);
	old_value = wacom_backend_device_get_dev_type (self);
	if (old_value != value) {
		self->priv->_dev_type = value;
		g_object_notify_by_pspec ((GObject *) self, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY]);
	}
}

static void
wacom_backend_device_class_init (WacomBackendDeviceClass * klass,
                                 gpointer klass_data)
{
	wacom_backend_device_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WacomBackendDevice_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_wacom_backend_device_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_wacom_backend_device_set_property;
	G_OBJECT_CLASS (klass)->finalize = wacom_backend_device_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY] = g_param_spec_string ("device-file", "device-file", "device-file", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY] = g_param_spec_string ("vendor-id", "vendor-id", "vendor-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY] = g_param_spec_string ("product-id", "product-id", "product-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY, wacom_backend_device_properties[WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY] = g_param_spec_flags ("dev-type", "dev-type", "dev-type", WACOM_BACKEND_DEVICE_TYPE_DEVICE_TYPE, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
wacom_backend_device_instance_init (WacomBackendDevice * self,
                                    gpointer klass)
{
	self->priv = wacom_backend_device_get_instance_private (self);
}

static void
wacom_backend_device_finalize (GObject * obj)
{
	WacomBackendDevice * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WACOM_BACKEND_TYPE_DEVICE, WacomBackendDevice);
	_g_free0 (self->priv->_device_file);
	_g_free0 (self->priv->_vendor_id);
	_g_free0 (self->priv->_product_id);
	G_OBJECT_CLASS (wacom_backend_device_parent_class)->finalize (obj);
}

static GType
wacom_backend_device_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WacomBackendDeviceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wacom_backend_device_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WacomBackendDevice), 0, (GInstanceInitFunc) wacom_backend_device_instance_init, NULL };
	GType wacom_backend_device_type_id;
	wacom_backend_device_type_id = g_type_register_static (G_TYPE_OBJECT, "WacomBackendDevice", &g_define_type_info, 0);
	WacomBackendDevice_private_offset = g_type_add_instance_private (wacom_backend_device_type_id, sizeof (WacomBackendDevicePrivate));
	return wacom_backend_device_type_id;
}

GType
wacom_backend_device_get_type (void)
{
	static volatile gsize wacom_backend_device_type_id__once = 0;
	if (g_once_init_enter (&wacom_backend_device_type_id__once)) {
		GType wacom_backend_device_type_id;
		wacom_backend_device_type_id = wacom_backend_device_get_type_once ();
		g_once_init_leave (&wacom_backend_device_type_id__once, wacom_backend_device_type_id);
	}
	return wacom_backend_device_type_id__once;
}

static void
_vala_wacom_backend_device_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	WacomBackendDevice * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WACOM_BACKEND_TYPE_DEVICE, WacomBackendDevice);
	switch (property_id) {
		case WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY:
		g_value_set_string (value, wacom_backend_device_get_device_file (self));
		break;
		case WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY:
		g_value_set_string (value, wacom_backend_device_get_vendor_id (self));
		break;
		case WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY:
		g_value_set_string (value, wacom_backend_device_get_product_id (self));
		break;
		case WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY:
		g_value_set_flags (value, wacom_backend_device_get_dev_type (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_wacom_backend_device_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	WacomBackendDevice * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, WACOM_BACKEND_TYPE_DEVICE, WacomBackendDevice);
	switch (property_id) {
		case WACOM_BACKEND_DEVICE_DEVICE_FILE_PROPERTY:
		wacom_backend_device_set_device_file (self, g_value_get_string (value));
		break;
		case WACOM_BACKEND_DEVICE_VENDOR_ID_PROPERTY:
		wacom_backend_device_set_vendor_id (self, g_value_get_string (value));
		break;
		case WACOM_BACKEND_DEVICE_PRODUCT_ID_PROPERTY:
		wacom_backend_device_set_product_id (self, g_value_get_string (value));
		break;
		case WACOM_BACKEND_DEVICE_DEV_TYPE_PROPERTY:
		wacom_backend_device_set_dev_type (self, g_value_get_flags (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

