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

/*
* Copyright 2020 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 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, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
*/

#include "applications.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  {
	PERMISSIONS_BACKEND_PERMISSION_SETTINGS_0_PROPERTY,
	PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY,
	PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY,
	PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY,
	PERMISSIONS_BACKEND_PERMISSION_SETTINGS_NUM_PROPERTIES
};
static GParamSpec* permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _PermissionsBackendPermissionSettingsPrivate {
	gchar* _context;
	gboolean _standard;
	gboolean _enabled;
};

static gint PermissionsBackendPermissionSettings_private_offset;
static gpointer permissions_backend_permission_settings_parent_class = NULL;

static void permissions_backend_permission_settings_finalize (GObject * obj);
static GType permissions_backend_permission_settings_get_type_once (void);
static void _vala_permissions_backend_permission_settings_get_property (GObject * object,
                                                                 guint property_id,
                                                                 GValue * value,
                                                                 GParamSpec * pspec);
static void _vala_permissions_backend_permission_settings_set_property (GObject * object,
                                                                 guint property_id,
                                                                 const GValue * value,
                                                                 GParamSpec * pspec);

static inline gpointer
permissions_backend_permission_settings_get_instance_private (PermissionsBackendPermissionSettings* self)
{
	return G_STRUCT_MEMBER_P (self, PermissionsBackendPermissionSettings_private_offset);
}

PermissionsBackendPermissionSettings*
permissions_backend_permission_settings_construct (GType object_type,
                                                   const gchar* context,
                                                   gboolean standard)
{
	PermissionsBackendPermissionSettings * self = NULL;
	g_return_val_if_fail (context != NULL, NULL);
	self = (PermissionsBackendPermissionSettings*) g_object_new (object_type, "context", context, "standard", standard, NULL);
	permissions_backend_permission_settings_set_enabled (self, standard);
	return self;
}

PermissionsBackendPermissionSettings*
permissions_backend_permission_settings_new (const gchar* context,
                                             gboolean standard)
{
	return permissions_backend_permission_settings_construct (PERMISSIONS_BACKEND_TYPE_PERMISSION_SETTINGS, context, standard);
}

const gchar*
permissions_backend_permission_settings_get_context (PermissionsBackendPermissionSettings* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_context;
	result = _tmp0_;
	return result;
}

static void
permissions_backend_permission_settings_set_context (PermissionsBackendPermissionSettings* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = permissions_backend_permission_settings_get_context (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_context);
		self->priv->_context = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY]);
	}
}

gboolean
permissions_backend_permission_settings_get_standard (PermissionsBackendPermissionSettings* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_standard;
	return result;
}

void
permissions_backend_permission_settings_set_standard (PermissionsBackendPermissionSettings* self,
                                                      gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = permissions_backend_permission_settings_get_standard (self);
	if (old_value != value) {
		self->priv->_standard = value;
		g_object_notify_by_pspec ((GObject *) self, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY]);
	}
}

gboolean
permissions_backend_permission_settings_get_enabled (PermissionsBackendPermissionSettings* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_enabled;
	return result;
}

void
permissions_backend_permission_settings_set_enabled (PermissionsBackendPermissionSettings* self,
                                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = permissions_backend_permission_settings_get_enabled (self);
	if (old_value != value) {
		self->priv->_enabled = value;
		g_object_notify_by_pspec ((GObject *) self, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY]);
	}
}

static void
permissions_backend_permission_settings_class_init (PermissionsBackendPermissionSettingsClass * klass,
                                                    gpointer klass_data)
{
	permissions_backend_permission_settings_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PermissionsBackendPermissionSettings_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_permissions_backend_permission_settings_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_permissions_backend_permission_settings_set_property;
	G_OBJECT_CLASS (klass)->finalize = permissions_backend_permission_settings_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY] = g_param_spec_string ("context", "context", "context", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY] = g_param_spec_boolean ("standard", "standard", "standard", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY, permissions_backend_permission_settings_properties[PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
permissions_backend_permission_settings_instance_init (PermissionsBackendPermissionSettings * self,
                                                       gpointer klass)
{
	self->priv = permissions_backend_permission_settings_get_instance_private (self);
}

static void
permissions_backend_permission_settings_finalize (GObject * obj)
{
	PermissionsBackendPermissionSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PERMISSIONS_BACKEND_TYPE_PERMISSION_SETTINGS, PermissionsBackendPermissionSettings);
	_g_free0 (self->priv->_context);
	G_OBJECT_CLASS (permissions_backend_permission_settings_parent_class)->finalize (obj);
}

static GType
permissions_backend_permission_settings_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PermissionsBackendPermissionSettingsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) permissions_backend_permission_settings_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PermissionsBackendPermissionSettings), 0, (GInstanceInitFunc) permissions_backend_permission_settings_instance_init, NULL };
	GType permissions_backend_permission_settings_type_id;
	permissions_backend_permission_settings_type_id = g_type_register_static (G_TYPE_OBJECT, "PermissionsBackendPermissionSettings", &g_define_type_info, 0);
	PermissionsBackendPermissionSettings_private_offset = g_type_add_instance_private (permissions_backend_permission_settings_type_id, sizeof (PermissionsBackendPermissionSettingsPrivate));
	return permissions_backend_permission_settings_type_id;
}

GType
permissions_backend_permission_settings_get_type (void)
{
	static volatile gsize permissions_backend_permission_settings_type_id__once = 0;
	if (g_once_init_enter (&permissions_backend_permission_settings_type_id__once)) {
		GType permissions_backend_permission_settings_type_id;
		permissions_backend_permission_settings_type_id = permissions_backend_permission_settings_get_type_once ();
		g_once_init_leave (&permissions_backend_permission_settings_type_id__once, permissions_backend_permission_settings_type_id);
	}
	return permissions_backend_permission_settings_type_id__once;
}

static void
_vala_permissions_backend_permission_settings_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec)
{
	PermissionsBackendPermissionSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PERMISSIONS_BACKEND_TYPE_PERMISSION_SETTINGS, PermissionsBackendPermissionSettings);
	switch (property_id) {
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY:
		g_value_set_string (value, permissions_backend_permission_settings_get_context (self));
		break;
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY:
		g_value_set_boolean (value, permissions_backend_permission_settings_get_standard (self));
		break;
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY:
		g_value_set_boolean (value, permissions_backend_permission_settings_get_enabled (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_permissions_backend_permission_settings_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec)
{
	PermissionsBackendPermissionSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PERMISSIONS_BACKEND_TYPE_PERMISSION_SETTINGS, PermissionsBackendPermissionSettings);
	switch (property_id) {
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_CONTEXT_PROPERTY:
		permissions_backend_permission_settings_set_context (self, g_value_get_string (value));
		break;
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_STANDARD_PROPERTY:
		permissions_backend_permission_settings_set_standard (self, g_value_get_boolean (value));
		break;
		case PERMISSIONS_BACKEND_PERMISSION_SETTINGS_ENABLED_PROPERTY:
		permissions_backend_permission_settings_set_enabled (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

