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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

#include "deja.h"
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.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  {
	DEJA_DUP_FILTERED_SETTINGS_0_PROPERTY,
	DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY,
	DEJA_DUP_FILTERED_SETTINGS_NUM_PROPERTIES
};
static GParamSpec* deja_dup_filtered_settings_properties[DEJA_DUP_FILTERED_SETTINGS_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _DejaDupFilteredSettingsPrivate {
	gboolean _read_only;
};

static gint DejaDupFilteredSettings_private_offset;
static gpointer deja_dup_filtered_settings_parent_class = NULL;

static void deja_dup_filtered_settings_finalize (GObject * obj);
static GType deja_dup_filtered_settings_get_type_once (void);
static void _vala_deja_dup_filtered_settings_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_deja_dup_filtered_settings_set_property (GObject * object,
                                                    guint property_id,
                                                    const GValue * value,
                                                    GParamSpec * pspec);

static inline gpointer
deja_dup_filtered_settings_get_instance_private (DejaDupFilteredSettings* self)
{
	return G_STRUCT_MEMBER_P (self, DejaDupFilteredSettings_private_offset);
}

DejaDupFilteredSettings*
deja_dup_filtered_settings_construct (GType object_type,
                                      const gchar* schema,
                                      gboolean ro)
{
	DejaDupFilteredSettings * self = NULL;
	gchar* full_schema = NULL;
	gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp6_;
	_tmp0_ = g_strdup (APPLICATION_ID);
	full_schema = _tmp0_;
	if (schema != NULL) {
		_tmp1_ = g_strcmp0 (schema, "") != 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = full_schema;
		_tmp3_ = g_strconcat (".", schema, NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strconcat (_tmp2_, _tmp4_, NULL);
		_g_free0 (full_schema);
		full_schema = _tmp5_;
		_g_free0 (_tmp4_);
	}
	_tmp6_ = full_schema;
	self = (DejaDupFilteredSettings*) g_object_new (object_type, "schema-id", _tmp6_, "read-only", ro, NULL);
	if (ro) {
		g_settings_delay ((GSettings*) self);
	}
	_g_free0 (full_schema);
	return self;
}

DejaDupFilteredSettings*
deja_dup_filtered_settings_new (const gchar* schema,
                                gboolean ro)
{
	return deja_dup_filtered_settings_construct (DEJA_DUP_TYPE_FILTERED_SETTINGS, schema, ro);
}

void
deja_dup_filtered_settings_apply (DejaDupFilteredSettings* self)
{
	gboolean _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_read_only;
	if (!_tmp0_) {
		g_settings_apply (G_TYPE_CHECK_INSTANCE_CAST (self, g_settings_get_type (), GSettings));
	}
}

void
deja_dup_filtered_settings_set_string (DejaDupFilteredSettings* self,
                                       const gchar* k,
                                       const gchar* v)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	g_return_if_fail (v != NULL);
	_tmp0_ = g_settings_get_string ((GSettings*) self, k);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strcmp0 (_tmp1_, v) != 0;
	_g_free0 (_tmp1_);
	if (_tmp2_) {
		g_settings_set_string (G_TYPE_CHECK_INSTANCE_CAST (self, g_settings_get_type (), GSettings), k, v);
	}
}

void
deja_dup_filtered_settings_set_boolean (DejaDupFilteredSettings* self,
                                        const gchar* k,
                                        gboolean v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	if (g_settings_get_boolean ((GSettings*) self, k) != v) {
		g_settings_set_boolean (G_TYPE_CHECK_INSTANCE_CAST (self, g_settings_get_type (), GSettings), k, v);
	}
}

void
deja_dup_filtered_settings_set_int (DejaDupFilteredSettings* self,
                                    const gchar* k,
                                    gint v)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	if (g_settings_get_int ((GSettings*) self, k) != v) {
		g_settings_set_int (G_TYPE_CHECK_INSTANCE_CAST (self, g_settings_get_type (), GSettings), k, v);
	}
}

void
deja_dup_filtered_settings_set_value (DejaDupFilteredSettings* self,
                                      const gchar* k,
                                      GVariant* v)
{
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	g_return_if_fail (v != NULL);
	_tmp0_ = g_settings_get_value ((GSettings*) self, k);
	_tmp1_ = _tmp0_;
	_tmp2_ = !g_variant_equal (_tmp1_, v);
	_g_variant_unref0 (_tmp1_);
	if (_tmp2_) {
		g_settings_set_value (G_TYPE_CHECK_INSTANCE_CAST (self, g_settings_get_type (), GSettings), k, v);
	}
}

gchar*
deja_dup_filtered_settings_get_uri (DejaDupFilteredSettings* self,
                                    const gchar* k)
{
	gchar* val = NULL;
	gchar* _tmp0_;
	gchar* _result_ = NULL;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (k != NULL, NULL);
	_tmp0_ = g_settings_get_string ((GSettings*) self, k);
	val = _tmp0_;
	_tmp1_ = val;
	_tmp2_ = deja_dup_parse_keywords (_tmp1_);
	_result_ = _tmp2_;
	_tmp3_ = _result_;
	if (_tmp3_ == NULL) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("");
		result = _tmp4_;
		_g_free0 (_result_);
		_g_free0 (val);
		return result;
	} else {
		result = _result_;
		_g_free0 (val);
		return result;
	}
}

GFile**
deja_dup_filtered_settings_get_file_list (DejaDupFilteredSettings* self,
                                          const gchar* k,
                                          gint* result_length1)
{
	GVariant* val = NULL;
	GVariant* _tmp0_;
	gsize _tmp1_ = 0;
	const gchar** _tmp2_;
	const gchar** _tmp3_;
	gint _tmp3__length1;
	gint _tmp4_ = 0;
	GFile** _tmp5_;
	GFile** _tmp6_;
	gint _tmp6__length1;
	GFile** _tmp7_;
	gint _tmp7__length1;
	GFile** result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (k != NULL, NULL);
	_tmp0_ = g_settings_get_value ((GSettings*) self, k);
	val = _tmp0_;
	_tmp2_ = g_variant_get_strv (val, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	_tmp5_ = deja_dup_parse_dir_list (_tmp3_, (gint) _tmp1_, &_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = _tmp4_;
	_tmp3_ = (g_free (_tmp3_), NULL);
	_tmp7_ = _tmp6_;
	_tmp7__length1 = _tmp6__length1;
	if (result_length1) {
		*result_length1 = _tmp7__length1;
	}
	result = _tmp7_;
	_g_variant_unref0 (val);
	return result;
}

gboolean
deja_dup_filtered_settings_get_read_only (DejaDupFilteredSettings* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_read_only;
	return result;
}

static void
deja_dup_filtered_settings_set_read_only (DejaDupFilteredSettings* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = deja_dup_filtered_settings_get_read_only (self);
	if (old_value != value) {
		self->priv->_read_only = value;
		g_object_notify_by_pspec ((GObject *) self, deja_dup_filtered_settings_properties[DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY]);
	}
}

static void
deja_dup_filtered_settings_class_init (DejaDupFilteredSettingsClass * klass,
                                       gpointer klass_data)
{
	deja_dup_filtered_settings_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DejaDupFilteredSettings_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_deja_dup_filtered_settings_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_deja_dup_filtered_settings_set_property;
	G_OBJECT_CLASS (klass)->finalize = deja_dup_filtered_settings_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY, deja_dup_filtered_settings_properties[DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY] = g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
deja_dup_filtered_settings_instance_init (DejaDupFilteredSettings * self,
                                          gpointer klass)
{
	self->priv = deja_dup_filtered_settings_get_instance_private (self);
}

static void
deja_dup_filtered_settings_finalize (GObject * obj)
{
	DejaDupFilteredSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettings);
	G_OBJECT_CLASS (deja_dup_filtered_settings_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
deja_dup_filtered_settings_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DejaDupFilteredSettingsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_filtered_settings_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupFilteredSettings), 0, (GInstanceInitFunc) deja_dup_filtered_settings_instance_init, NULL };
	GType deja_dup_filtered_settings_type_id;
	deja_dup_filtered_settings_type_id = g_type_register_static (g_settings_get_type (), "DejaDupFilteredSettings", &g_define_type_info, 0);
	DejaDupFilteredSettings_private_offset = g_type_add_instance_private (deja_dup_filtered_settings_type_id, sizeof (DejaDupFilteredSettingsPrivate));
	return deja_dup_filtered_settings_type_id;
}

GType
deja_dup_filtered_settings_get_type (void)
{
	static gsize deja_dup_filtered_settings_type_id__once = 0;
	if (g_once_init_enter (&deja_dup_filtered_settings_type_id__once)) {
		GType deja_dup_filtered_settings_type_id;
		deja_dup_filtered_settings_type_id = deja_dup_filtered_settings_get_type_once ();
		g_once_init_leave (&deja_dup_filtered_settings_type_id__once, deja_dup_filtered_settings_type_id);
	}
	return deja_dup_filtered_settings_type_id__once;
}

static void
_vala_deja_dup_filtered_settings_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	DejaDupFilteredSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettings);
	switch (property_id) {
		case DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY:
		g_value_set_boolean (value, deja_dup_filtered_settings_get_read_only (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_deja_dup_filtered_settings_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec)
{
	DejaDupFilteredSettings * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettings);
	switch (property_id) {
		case DEJA_DUP_FILTERED_SETTINGS_READ_ONLY_PROPERTY:
		deja_dup_filtered_settings_set_read_only (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

