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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    For copyright information, see AUTHORS.

    Déjà Dup 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.

    Déjà Dup 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 Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>


#define DEJA_DUP_TYPE_FILTERED_SETTINGS (deja_dup_filtered_settings_get_type ())
#define DEJA_DUP_FILTERED_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettings))
#define DEJA_DUP_FILTERED_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettingsClass))
#define DEJA_DUP_IS_FILTERED_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_FILTERED_SETTINGS))
#define DEJA_DUP_IS_FILTERED_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_FILTERED_SETTINGS))
#define DEJA_DUP_FILTERED_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettingsClass))

typedef struct _DejaDupFilteredSettings DejaDupFilteredSettings;
typedef struct _DejaDupFilteredSettingsClass DejaDupFilteredSettingsClass;
typedef struct _DejaDupFilteredSettingsPrivate DejaDupFilteredSettingsPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _DejaDupFilteredSettings {
	GSettings parent_instance;
	DejaDupFilteredSettingsPrivate * priv;
};

struct _DejaDupFilteredSettingsClass {
	GSettingsClass parent_class;
};

struct _DejaDupFilteredSettingsPrivate {
	gboolean _read_only;
};


static gpointer deja_dup_filtered_settings_parent_class = NULL;

GType deja_dup_filtered_settings_get_type (void) G_GNUC_CONST;
#define DEJA_DUP_FILTERED_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DEJA_DUP_TYPE_FILTERED_SETTINGS, DejaDupFilteredSettingsPrivate))
enum  {
	DEJA_DUP_FILTERED_SETTINGS_DUMMY_PROPERTY,
	DEJA_DUP_FILTERED_SETTINGS_READ_ONLY
};
DejaDupFilteredSettings* deja_dup_filtered_settings_new (const gchar* schema, gboolean ro);
DejaDupFilteredSettings* deja_dup_filtered_settings_construct (GType object_type, const gchar* schema, gboolean ro);
void deja_dup_filtered_settings_apply (DejaDupFilteredSettings* self);
gboolean deja_dup_filtered_settings_get_read_only (DejaDupFilteredSettings* self);
void deja_dup_filtered_settings_set_string (DejaDupFilteredSettings* self, const gchar* k, const gchar* v);
void deja_dup_filtered_settings_set_boolean (DejaDupFilteredSettings* self, const gchar* k, gboolean v);
void deja_dup_filtered_settings_set_int (DejaDupFilteredSettings* self, const gchar* k, gint v);
void deja_dup_filtered_settings_set_value (DejaDupFilteredSettings* self, const gchar* k, GVariant* v);
gchar* deja_dup_filtered_settings_get_uri (DejaDupFilteredSettings* self, const gchar* k);
gchar* deja_dup_parse_keywords (const gchar* dir);
GFile** deja_dup_filtered_settings_get_file_list (DejaDupFilteredSettings* self, const gchar* k, int* result_length1);
GFile** deja_dup_parse_dir_list (const gchar** dirs, int dirs_length1, int* result_length1);
void deja_dup_filtered_settings_set_read_only (DejaDupFilteredSettings* self, gboolean value);
static void deja_dup_filtered_settings_finalize (GObject* obj);
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);


DejaDupFilteredSettings* deja_dup_filtered_settings_construct (GType object_type, const gchar* schema, gboolean ro) {
	DejaDupFilteredSettings * self = NULL;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (schema != NULL, NULL);
	_tmp0_ = schema;
	_tmp1_ = ro;
	self = (DejaDupFilteredSettings*) g_object_new (object_type, "schema-id", _tmp0_, "read-only", _tmp1_, NULL);
	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_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_read_only;
	if (!_tmp0_) {
		g_settings_apply (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_SETTINGS, GSettings));
	}
}


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


void deja_dup_filtered_settings_set_boolean (DejaDupFilteredSettings* self, const gchar* k, gboolean v) {
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	_tmp0_ = k;
	_tmp1_ = g_settings_get_boolean ((GSettings*) self, _tmp0_);
	_tmp2_ = v;
	if (_tmp1_ != _tmp2_) {
		const gchar* _tmp3_ = NULL;
		gboolean _tmp4_ = FALSE;
		_tmp3_ = k;
		_tmp4_ = v;
		g_settings_set_boolean (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_SETTINGS, GSettings), _tmp3_, _tmp4_);
	}
}


void deja_dup_filtered_settings_set_int (DejaDupFilteredSettings* self, const gchar* k, gint v) {
	const gchar* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	_tmp0_ = k;
	_tmp1_ = g_settings_get_int ((GSettings*) self, _tmp0_);
	_tmp2_ = v;
	if (_tmp1_ != _tmp2_) {
		const gchar* _tmp3_ = NULL;
		gint _tmp4_ = 0;
		_tmp3_ = k;
		_tmp4_ = v;
		g_settings_set_int (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_SETTINGS, GSettings), _tmp3_, _tmp4_);
	}
}


void deja_dup_filtered_settings_set_value (DejaDupFilteredSettings* self, const gchar* k, GVariant* v) {
	const gchar* _tmp0_ = NULL;
	GVariant* _tmp1_ = NULL;
	GVariant* _tmp2_ = NULL;
	GVariant* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (k != NULL);
	g_return_if_fail (v != NULL);
	_tmp0_ = k;
	_tmp1_ = g_settings_get_value ((GSettings*) self, _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = v;
	_tmp4_ = g_variant_equal (_tmp2_, _tmp3_);
	_tmp5_ = !_tmp4_;
	_g_variant_unref0 (_tmp2_);
	if (_tmp5_) {
		const gchar* _tmp6_ = NULL;
		GVariant* _tmp7_ = NULL;
		_tmp6_ = k;
		_tmp7_ = v;
		g_settings_set_value (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_SETTINGS, GSettings), _tmp6_, _tmp7_);
	}
}


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


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


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


void deja_dup_filtered_settings_set_read_only (DejaDupFilteredSettings* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_read_only = _tmp0_;
	g_object_notify ((GObject *) self, "read-only");
}


static void deja_dup_filtered_settings_class_init (DejaDupFilteredSettingsClass * klass) {
	deja_dup_filtered_settings_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DejaDupFilteredSettingsPrivate));
	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, g_param_spec_boolean ("read-only", "read-only", "read-only", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void deja_dup_filtered_settings_instance_init (DejaDupFilteredSettings * self) {
	self->priv = DEJA_DUP_FILTERED_SETTINGS_GET_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);
}


GType deja_dup_filtered_settings_get_type (void) {
	static volatile gsize deja_dup_filtered_settings_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_filtered_settings_type_id__volatile)) {
		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_TYPE_SETTINGS, "DejaDupFilteredSettings", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_filtered_settings_type_id__volatile, deja_dup_filtered_settings_type_id);
	}
	return deja_dup_filtered_settings_type_id__volatile;
}


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:
		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:
		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;
	}
}



