/* rygel-writable-user-config.c generated by valac 0.17.4.16-52707, the Vala compiler
 * generated from rygel-writable-user-config.vala, do not modify */

/*
 * Copyright (C) 2008-2011 Nokia Corporation.
 * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser 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 <glib.h>
#include <glib-object.h>
#include <rygel-core.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include <config.h>


#define RYGEL_TYPE_WRITABLE_USER_CONFIG (rygel_writable_user_config_get_type ())
#define RYGEL_WRITABLE_USER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_WRITABLE_USER_CONFIG, RygelWritableUserConfig))
#define RYGEL_WRITABLE_USER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_WRITABLE_USER_CONFIG, RygelWritableUserConfigClass))
#define RYGEL_IS_WRITABLE_USER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_WRITABLE_USER_CONFIG))
#define RYGEL_IS_WRITABLE_USER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_WRITABLE_USER_CONFIG))
#define RYGEL_WRITABLE_USER_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_WRITABLE_USER_CONFIG, RygelWritableUserConfigClass))

typedef struct _RygelWritableUserConfig RygelWritableUserConfig;
typedef struct _RygelWritableUserConfigClass RygelWritableUserConfigClass;
typedef struct _RygelWritableUserConfigPrivate RygelWritableUserConfigPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _RygelWritableUserConfig {
	RygelUserConfig parent_instance;
	RygelWritableUserConfigPrivate * priv;
};

struct _RygelWritableUserConfigClass {
	RygelUserConfigClass parent_class;
};

struct _RygelWritableUserConfigPrivate {
	gchar* user_config;
};


static gpointer rygel_writable_user_config_parent_class = NULL;

GType rygel_writable_user_config_get_type (void) G_GNUC_CONST;
#define RYGEL_WRITABLE_USER_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_WRITABLE_USER_CONFIG, RygelWritableUserConfigPrivate))
enum  {
	RYGEL_WRITABLE_USER_CONFIG_DUMMY_PROPERTY
};
#define RYGEL_WRITABLE_USER_CONFIG_RYGEL_SERVICE "org.gnome.Rygel1"
#define RYGEL_WRITABLE_USER_CONFIG_RYGEL_PATH "/org/gnome/Rygel1"
#define RYGEL_WRITABLE_USER_CONFIG_RYGEL_INTERFACE "org.gnome.Rygel1"
RygelWritableUserConfig* rygel_writable_user_config_new (GError** error);
RygelWritableUserConfig* rygel_writable_user_config_construct (GType object_type, GError** error);
gboolean rygel_writable_user_config_is_upnp_enabled (RygelWritableUserConfig* self);
void rygel_writable_user_config_set_upnp_enabled (RygelWritableUserConfig* self, gboolean value);
static void rygel_writable_user_config_enable_upnp (RygelWritableUserConfig* self, gboolean enable);
void rygel_writable_user_config_set_interface (RygelWritableUserConfig* self, const gchar* value);
void rygel_writable_user_config_set_string (RygelWritableUserConfig* self, const gchar* section, const gchar* key, const gchar* value);
void rygel_writable_user_config_set_port (RygelWritableUserConfig* self, gint value);
void rygel_writable_user_config_set_int (RygelWritableUserConfig* self, const gchar* section, const gchar* key, gint value);
void rygel_writable_user_config_set_transcoding (RygelWritableUserConfig* self, gboolean value);
void rygel_writable_user_config_set_bool (RygelWritableUserConfig* self, const gchar* section, const gchar* key, gboolean value);
void rygel_writable_user_config_set_mp3_transcoder (RygelWritableUserConfig* self, gboolean value);
void rygel_writable_user_config_set_mp2ts_transcoder (RygelWritableUserConfig* self, gboolean value);
void rygel_writable_user_config_set_lpcm_transcoder (RygelWritableUserConfig* self, gboolean value);
void rygel_writable_user_config_set_wmv_transcoder (RygelWritableUserConfig* self, gboolean value);
void rygel_writable_user_config_set_allow_upload (RygelWritableUserConfig* self, gboolean value, GError** error);
void rygel_writable_user_config_set_allow_deletion (RygelWritableUserConfig* self, gboolean value, GError** error);
void rygel_writable_user_config_save (RygelWritableUserConfig* self);
void rygel_writable_user_config_set_string_list (RygelWritableUserConfig* self, const gchar* section, const gchar* key, GeeArrayList* str_list);
static void rygel_writable_user_config_ensure_dir_exists (RygelWritableUserConfig* self, const gchar* dir_path, GError** error);
static void rygel_writable_user_config_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


RygelWritableUserConfig* rygel_writable_user_config_construct (GType object_type, GError** error) {
	RygelWritableUserConfig * self = NULL;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* path;
	gchar* _tmp2_;
	GError * _inner_error_ = NULL;
#line 36 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = g_get_user_config_dir ();
#line 36 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = g_build_filename (_tmp0_, RYGEL_USER_CONFIG_CONFIG_FILE, NULL);
#line 36 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	path = _tmp1_;
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	self = (RygelWritableUserConfig*) rygel_user_config_construct (object_type, path, &_inner_error_);
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_inner_error_ != NULL) {
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_propagate_error (error, _inner_error_);
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (path);
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_object_unref0 (self);
#line 39 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return NULL;
#line 129 "rygel-writable-user-config.c"
	}
#line 41 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = g_strdup (path);
#line 41 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (self->priv->user_config);
#line 41 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	self->priv->user_config = _tmp2_;
#line 35 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (path);
#line 35 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	return self;
#line 141 "rygel-writable-user-config.c"
}


RygelWritableUserConfig* rygel_writable_user_config_new (GError** error) {
#line 35 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	return rygel_writable_user_config_construct (RYGEL_TYPE_WRITABLE_USER_CONFIG, error);
#line 148 "rygel-writable-user-config.c"
}


gboolean rygel_writable_user_config_is_upnp_enabled (RygelWritableUserConfig* self) {
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
#line 44 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 157 "rygel-writable-user-config.c"
	{
		const gchar* _tmp0_;
		GFile* _tmp1_ = NULL;
		GFile* file;
		GFile* _tmp2_;
		gboolean _tmp3_ = FALSE;
#line 46 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp0_ = self->priv->user_config;
#line 46 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp1_ = g_file_new_for_path (_tmp0_);
#line 46 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		file = _tmp1_;
#line 47 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp2_ = file;
#line 47 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp3_ = g_file_query_exists (_tmp2_, NULL);
#line 47 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_tmp3_) {
#line 176 "rygel-writable-user-config.c"
			gboolean _tmp4_ = FALSE;
			gboolean _tmp5_;
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp4_ = rygel_configuration_get_upnp_enabled ((RygelConfiguration*) self, &_inner_error_);
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp5_ = _tmp4_;
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (_inner_error_ != NULL) {
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_object_unref0 (file);
#line 187 "rygel-writable-user-config.c"
				goto __catch2_g_error;
			}
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			result = _tmp5_;
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_object_unref0 (file);
#line 48 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			return result;
#line 196 "rygel-writable-user-config.c"
		}
#line 51 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		result = FALSE;
#line 51 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_object_unref0 (file);
#line 51 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return result;
#line 204 "rygel-writable-user-config.c"
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* _error_ = NULL;
#line 45 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_error_ = _inner_error_;
#line 45 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_inner_error_ = NULL;
#line 53 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		result = FALSE;
#line 53 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_error_free0 (_error_);
#line 53 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return result;
#line 220 "rygel-writable-user-config.c"
	}
	__finally2:
#line 45 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 45 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_clear_error (&_inner_error_);
#line 45 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	return FALSE;
#line 229 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_upnp_enabled (RygelWritableUserConfig* self, gboolean value) {
	gboolean enabled;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
#line 57 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 58 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	enabled = FALSE;
#line 60 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = rygel_writable_user_config_is_upnp_enabled (self);
#line 60 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	enabled = _tmp0_;
#line 62 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = value;
#line 62 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = enabled;
#line 62 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_tmp1_ != _tmp2_) {
#line 252 "rygel-writable-user-config.c"
		gboolean _tmp3_;
#line 63 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp3_ = value;
#line 63 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		rygel_writable_user_config_enable_upnp (self, _tmp3_);
#line 258 "rygel-writable-user-config.c"
	}
}


void rygel_writable_user_config_set_interface (RygelWritableUserConfig* self, const gchar* value) {
	gchar* iface = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp4_;
#line 67 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 70 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 70 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_tmp0_ != NULL) {
#line 273 "rygel-writable-user-config.c"
		const gchar* _tmp1_;
		gchar* _tmp2_;
#line 71 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp1_ = value;
#line 71 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp2_ = g_strdup (_tmp1_);
#line 71 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (iface);
#line 71 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		iface = _tmp2_;
#line 284 "rygel-writable-user-config.c"
	} else {
		gchar* _tmp3_;
#line 73 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp3_ = g_strdup ("");
#line 73 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (iface);
#line 73 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		iface = _tmp3_;
#line 293 "rygel-writable-user-config.c"
	}
#line 76 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp4_ = iface;
#line 76 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_string (self, "general", RYGEL_USER_CONFIG_IFACE_KEY, _tmp4_);
#line 67 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (iface);
#line 301 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_port (RygelWritableUserConfig* self, gint value) {
	gint _tmp0_;
#line 79 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 80 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 80 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_int (self, "general", RYGEL_USER_CONFIG_PORT_KEY, _tmp0_);
#line 313 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_transcoding (RygelWritableUserConfig* self, gboolean value) {
	gboolean _tmp0_;
#line 83 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 84 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 84 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_TRANSCODING_KEY, _tmp0_);
#line 325 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_mp3_transcoder (RygelWritableUserConfig* self, gboolean value) {
	gboolean _tmp0_;
#line 87 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 88 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 88 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_MP3_TRANSCODER_KEY, _tmp0_);
#line 337 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_mp2ts_transcoder (RygelWritableUserConfig* self, gboolean value) {
	gboolean _tmp0_;
#line 91 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 92 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 92 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_MP2TS_TRANSCODER_KEY, _tmp0_);
#line 349 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_lpcm_transcoder (RygelWritableUserConfig* self, gboolean value) {
	gboolean _tmp0_;
#line 95 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 96 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 96 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_LPCM_TRANSCODER_KEY, _tmp0_);
#line 361 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_wmv_transcoder (RygelWritableUserConfig* self, gboolean value) {
	gboolean _tmp0_;
#line 99 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 100 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 100 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_WMV_TRANSCODER_KEY, _tmp0_);
#line 373 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_allow_upload (RygelWritableUserConfig* self, gboolean value, GError** error) {
	gboolean _tmp0_;
#line 103 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 104 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 104 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_ALLOW_UPLOAD_KEY, _tmp0_);
#line 385 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_allow_deletion (RygelWritableUserConfig* self, gboolean value, GError** error) {
	gboolean _tmp0_;
#line 107 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 108 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = value;
#line 108 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_ALLOW_DELETION_KEY, _tmp0_);
#line 397 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_save (RygelWritableUserConfig* self) {
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* path;
	gsize length = 0UL;
	GKeyFile* _tmp2_;
	gsize _tmp3_ = 0UL;
	gchar* _tmp4_ = NULL;
	gchar* data;
	GError * _inner_error_ = NULL;
#line 111 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 113 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = g_get_user_config_dir ();
#line 113 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = g_build_filename (_tmp0_, RYGEL_USER_CONFIG_CONFIG_FILE, NULL);
#line 113 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	path = _tmp1_;
#line 117 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = ((RygelUserConfig*) self)->key_file;
#line 117 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp4_ = g_key_file_to_data (_tmp2_, &_tmp3_, NULL);
#line 117 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	length = _tmp3_;
#line 117 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	data = _tmp4_;
#line 427 "rygel-writable-user-config.c"
	{
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_file_set_contents (path, data, (gssize) ((glong) length), &_inner_error_);
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_inner_error_ != NULL) {
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (_inner_error_->domain == G_FILE_ERROR) {
#line 435 "rygel-writable-user-config.c"
				goto __catch3_g_file_error;
			}
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (data);
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (path);
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			g_clear_error (&_inner_error_);
#line 120 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			return;
#line 448 "rygel-writable-user-config.c"
		}
	}
	goto __finally3;
	__catch3_g_file_error:
	{
		GError* err = NULL;
		const gchar* _tmp5_ = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		err = _inner_error_;
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_inner_error_ = NULL;
#line 122 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp5_ = _ ("Failed to save configuration data to file '%s': %s");
#line 122 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp6_ = err;
#line 122 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp7_ = _tmp6_->message;
#line 122 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_critical (_tmp5_, path, _tmp7_);
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_error_free0 (err);
#line 472 "rygel-writable-user-config.c"
	}
	__finally3:
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_inner_error_ != NULL) {
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (data);
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (path);
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_clear_error (&_inner_error_);
#line 119 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return;
#line 487 "rygel-writable-user-config.c"
	}
#line 111 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (data);
#line 111 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (path);
#line 493 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_string (RygelWritableUserConfig* self, const gchar* section, const gchar* key, const gchar* value) {
	GKeyFile* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
#line 128 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 128 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (section != NULL);
#line 128 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (key != NULL);
#line 128 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (value != NULL);
#line 131 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = ((RygelUserConfig*) self)->key_file;
#line 131 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = section;
#line 131 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = key;
#line 131 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp3_ = value;
#line 131 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_key_file_set_string (_tmp0_, _tmp1_, _tmp2_, _tmp3_);
#line 520 "rygel-writable-user-config.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	return self ? g_object_ref (self) : NULL;
#line 527 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_string_list (RygelWritableUserConfig* self, const gchar* section, const gchar* key, GeeArrayList* str_list) {
	GeeArrayList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** strings;
	gint strings_length1;
	gint _strings_size_;
	gint i;
	GKeyFile* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	gchar** _tmp24_;
	gint _tmp24__length1;
#line 134 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 134 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (section != NULL);
#line 134 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (key != NULL);
#line 134 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (str_list != NULL);
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = str_list;
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp0_);
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = _tmp1_;
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp3_ = g_new0 (gchar*, _tmp2_ + 1);
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	strings = _tmp3_;
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	strings_length1 = _tmp2_;
#line 138 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_strings_size_ = strings_length1;
#line 139 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	i = 0;
#line 569 "rygel-writable-user-config.c"
	{
		GeeArrayList* _tmp4_;
		GeeArrayList* _tmp5_;
		GeeArrayList* _str_list;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _str_size;
		gint _str_index;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp4_ = str_list;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp5_ = _g_object_ref0 (_tmp4_);
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_str_list = _tmp5_;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp6_ = _str_list;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp7_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp6_);
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp8_ = _tmp7_;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_str_size = _tmp8_;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_str_index = -1;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		while (TRUE) {
#line 597 "rygel-writable-user-config.c"
			gint _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			GeeArrayList* _tmp12_;
			gint _tmp13_;
			gpointer _tmp14_ = NULL;
			gchar* str;
			const gchar* _tmp15_;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp9_ = _str_index;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_str_index = _tmp9_ + 1;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp10_ = _str_index;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp11_ = _str_size;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (!(_tmp10_ < _tmp11_)) {
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				break;
#line 618 "rygel-writable-user-config.c"
			}
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp12_ = _str_list;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp13_ = _str_index;
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, _tmp13_);
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			str = (gchar*) _tmp14_;
#line 142 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp15_ = str;
#line 142 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (g_strcmp0 (_tmp15_, "") != 0) {
#line 632 "rygel-writable-user-config.c"
				gchar** _tmp16_;
				gint _tmp16__length1;
				gint _tmp17_;
				const gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp16_ = strings;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp16__length1 = strings_length1;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp17_ = i;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				i = _tmp17_ + 1;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp18_ = str;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp19_ = g_strdup (_tmp18_);
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (_tmp16_[_tmp17_]);
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp16_[_tmp17_] = _tmp19_;
#line 143 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp20_ = _tmp16_[_tmp17_];
#line 657 "rygel-writable-user-config.c"
			}
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (str);
#line 661 "rygel-writable-user-config.c"
		}
#line 141 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_object_unref0 (_str_list);
#line 665 "rygel-writable-user-config.c"
	}
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp21_ = ((RygelUserConfig*) self)->key_file;
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp22_ = section;
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp23_ = key;
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp24_ = strings;
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp24__length1 = strings_length1;
#line 147 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_key_file_set_string_list (_tmp21_, _tmp22_, _tmp23_, (const gchar* const*) _tmp24_, _tmp24__length1);
#line 134 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
#line 681 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_int (RygelWritableUserConfig* self, const gchar* section, const gchar* key, gint value) {
	GKeyFile* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
#line 150 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 150 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (section != NULL);
#line 150 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (key != NULL);
#line 153 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = ((RygelUserConfig*) self)->key_file;
#line 153 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = section;
#line 153 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = key;
#line 153 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp3_ = value;
#line 153 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_key_file_set_integer (_tmp0_, _tmp1_, _tmp2_, _tmp3_);
#line 706 "rygel-writable-user-config.c"
}


void rygel_writable_user_config_set_bool (RygelWritableUserConfig* self, const gchar* section, const gchar* key, gboolean value) {
	GKeyFile* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
#line 156 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 156 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (section != NULL);
#line 156 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (key != NULL);
#line 159 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = ((RygelUserConfig*) self)->key_file;
#line 159 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = section;
#line 159 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp2_ = key;
#line 159 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp3_ = value;
#line 159 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_key_file_set_boolean (_tmp0_, _tmp1_, _tmp2_, _tmp3_);
#line 731 "rygel-writable-user-config.c"
}


static void rygel_writable_user_config_enable_upnp (RygelWritableUserConfig* self, gboolean enable) {
	GError * _inner_error_ = NULL;
#line 162 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 739 "rygel-writable-user-config.c"
	{
		const gchar* _tmp0_ = NULL;
		gchar* _tmp1_;
		gchar* config_dir;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		gchar* _tmp4_ = NULL;
		gchar* dest_dir;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_ = NULL;
		gchar* dest_path;
		const gchar* _tmp8_;
		GFile* _tmp9_ = NULL;
		GFile* dest;
		gboolean _tmp10_;
#line 164 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp0_ = g_get_user_config_dir ();
#line 164 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp1_ = g_strdup (_tmp0_);
#line 164 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		config_dir = _tmp1_;
#line 165 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp2_ = config_dir;
#line 165 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		rygel_writable_user_config_ensure_dir_exists (self, _tmp2_, &_inner_error_);
#line 165 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_inner_error_ != NULL) {
#line 165 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (config_dir);
#line 770 "rygel-writable-user-config.c"
			goto __catch4_g_error;
		}
#line 166 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp3_ = config_dir;
#line 166 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp4_ = g_build_filename (_tmp3_, "autostart", NULL);
#line 166 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		dest_dir = _tmp4_;
#line 167 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp5_ = dest_dir;
#line 167 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		rygel_writable_user_config_ensure_dir_exists (self, _tmp5_, &_inner_error_);
#line 167 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_inner_error_ != NULL) {
#line 167 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (dest_dir);
#line 167 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (config_dir);
#line 789 "rygel-writable-user-config.c"
			goto __catch4_g_error;
		}
#line 169 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp6_ = dest_dir;
#line 169 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp7_ = g_build_filename (_tmp6_, "rygel.desktop", NULL);
#line 169 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		dest_path = _tmp7_;
#line 170 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp8_ = dest_path;
#line 170 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp9_ = g_file_new_for_path (_tmp8_);
#line 170 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		dest = _tmp9_;
#line 172 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp10_ = enable;
#line 172 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_tmp10_) {
#line 808 "rygel-writable-user-config.c"
			gchar* _tmp11_ = NULL;
			gchar* source_path;
#line 174 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, RYGEL_DBUS_INTERFACE_SERVICE_NAME, G_BUS_NAME_WATCHER_FLAGS_AUTO_START, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, NULL)));
#line 179 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp11_ = g_build_filename (DESKTOP_DIR, "rygel.desktop", NULL);
#line 179 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			source_path = _tmp11_;
#line 817 "rygel-writable-user-config.c"
			{
				GFile* _tmp12_;
				const gchar* _tmp13_;
#line 182 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp12_ = dest;
#line 182 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp13_ = source_path;
#line 182 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				g_file_make_symbolic_link (_tmp12_, _tmp13_, NULL, &_inner_error_);
#line 182 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				if (_inner_error_ != NULL) {
#line 182 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					if (g_error_matches (_inner_error_, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
#line 831 "rygel-writable-user-config.c"
						goto __catch5_g_io_error_exists;
					}
					goto __finally5;
				}
			}
			goto __finally5;
			__catch5_g_io_error_exists:
			{
				GError* err = NULL;
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				err = _inner_error_;
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_inner_error_ = NULL;
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_error_free0 (err);
#line 847 "rygel-writable-user-config.c"
			}
			__finally5:
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (_inner_error_ != NULL) {
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (source_path);
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_object_unref0 (dest);
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (dest_path);
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (dest_dir);
#line 181 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (config_dir);
#line 862 "rygel-writable-user-config.c"
				goto __catch4_g_error;
			}
#line 185 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_UPNP_ENABLED_KEY, TRUE);
#line 172 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (source_path);
#line 869 "rygel-writable-user-config.c"
		} else {
			gboolean _tmp15_ = FALSE;
			{
				GFile* _tmp14_;
#line 190 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp14_ = dest;
#line 190 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				g_file_delete (_tmp14_, NULL, &_inner_error_);
#line 190 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				if (_inner_error_ != NULL) {
#line 190 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					if (g_error_matches (_inner_error_, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
#line 882 "rygel-writable-user-config.c"
						goto __catch6_g_io_error_not_found;
					}
					goto __finally6;
				}
			}
			goto __finally6;
			__catch6_g_io_error_not_found:
			{
				GError* err = NULL;
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				err = _inner_error_;
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_inner_error_ = NULL;
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_error_free0 (err);
#line 898 "rygel-writable-user-config.c"
			}
			__finally6:
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (_inner_error_ != NULL) {
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_object_unref0 (dest);
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (dest_path);
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (dest_dir);
#line 189 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_free0 (config_dir);
#line 911 "rygel-writable-user-config.c"
				goto __catch4_g_error;
			}
#line 193 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			rygel_writable_user_config_set_bool (self, "general", RYGEL_USER_CONFIG_UPNP_ENABLED_KEY, FALSE);
#line 195 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp15_ = rygel_writable_user_config_is_upnp_enabled (self);
#line 195 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (_tmp15_) {
#line 920 "rygel-writable-user-config.c"
				RygelDBusInterface* _tmp16_ = NULL;
				RygelDBusInterface* rygel_proxy;
				RygelDBusInterface* _tmp17_;
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp16_ = g_initable_new (RYGEL_TYPE_DBUS_INTERFACE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", RYGEL_DBUS_INTERFACE_SERVICE_NAME, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", RYGEL_DBUS_INTERFACE_OBJECT_PATH, "g-interface-name", "org.gnome.Rygel1", NULL);
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				rygel_proxy = (RygelDBusInterface*) _tmp16_;
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				if (_inner_error_ != NULL) {
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_object_unref0 (dest);
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (dest_path);
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (dest_dir);
#line 197 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (config_dir);
#line 938 "rygel-writable-user-config.c"
					goto __catch4_g_error;
				}
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_tmp17_ = rygel_proxy;
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				rygel_dbus_interface_shutdown (_tmp17_, &_inner_error_);
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				if (_inner_error_ != NULL) {
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_object_unref0 (rygel_proxy);
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_object_unref0 (dest);
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (dest_path);
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (dest_dir);
#line 203 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
					_g_free0 (config_dir);
#line 957 "rygel-writable-user-config.c"
					goto __catch4_g_error;
				}
#line 195 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
				_g_object_unref0 (rygel_proxy);
#line 962 "rygel-writable-user-config.c"
			}
		}
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_object_unref0 (dest);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (dest_path);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (dest_dir);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (config_dir);
#line 973 "rygel-writable-user-config.c"
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError* err = NULL;
		gchar* message = NULL;
		gboolean _tmp18_;
		const gchar* _tmp23_;
		GError* _tmp24_;
		const gchar* _tmp25_;
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		err = _inner_error_;
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_inner_error_ = NULL;
#line 209 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp18_ = enable;
#line 209 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_tmp18_) {
#line 992 "rygel-writable-user-config.c"
			const gchar* _tmp19_ = NULL;
			gchar* _tmp20_;
#line 210 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp19_ = _ ("Failed to start Rygel service: %s");
#line 210 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp20_ = g_strdup (_tmp19_);
#line 210 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (message);
#line 210 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			message = _tmp20_;
#line 1003 "rygel-writable-user-config.c"
		} else {
			const gchar* _tmp21_ = NULL;
			gchar* _tmp22_;
#line 212 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp21_ = _ ("Failed to stop Rygel service: %s");
#line 212 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_tmp22_ = g_strdup (_tmp21_);
#line 212 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			_g_free0 (message);
#line 212 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			message = _tmp22_;
#line 1015 "rygel-writable-user-config.c"
		}
#line 215 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp23_ = message;
#line 215 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp24_ = err;
#line 215 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_tmp25_ = _tmp24_->message;
#line 215 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_warning (_tmp23_, _tmp25_);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_free0 (message);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_error_free0 (err);
#line 1029 "rygel-writable-user-config.c"
	}
	__finally4:
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_inner_error_ != NULL) {
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_clear_error (&_inner_error_);
#line 163 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return;
#line 1040 "rygel-writable-user-config.c"
	}
}


static void rygel_writable_user_config_ensure_dir_exists (RygelWritableUserConfig* self, const gchar* dir_path, GError** error) {
	const gchar* _tmp0_;
	GFile* _tmp1_ = NULL;
	GFile* dir;
	GError * _inner_error_ = NULL;
#line 219 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (self != NULL);
#line 219 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_return_if_fail (dir_path != NULL);
#line 220 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp0_ = dir_path;
#line 220 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_tmp1_ = g_file_new_for_path (_tmp0_);
#line 220 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	dir = _tmp1_;
#line 1060 "rygel-writable-user-config.c"
	{
#line 223 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_file_make_directory (dir, NULL, &_inner_error_);
#line 223 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		if (_inner_error_ != NULL) {
#line 223 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
			if (g_error_matches (_inner_error_, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
#line 1068 "rygel-writable-user-config.c"
				goto __catch7_g_io_error_exists;
			}
			goto __finally7;
		}
	}
	goto __finally7;
	__catch7_g_io_error_exists:
	{
		GError* err = NULL;
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		err = _inner_error_;
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_inner_error_ = NULL;
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_error_free0 (err);
#line 1084 "rygel-writable-user-config.c"
	}
	__finally7:
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	if (_inner_error_ != NULL) {
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		g_propagate_error (error, _inner_error_);
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		_g_object_unref0 (dir);
#line 222 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
		return;
#line 1095 "rygel-writable-user-config.c"
	}
#line 219 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_object_unref0 (dir);
#line 1099 "rygel-writable-user-config.c"
}


static void rygel_writable_user_config_class_init (RygelWritableUserConfigClass * klass) {
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	rygel_writable_user_config_parent_class = g_type_class_peek_parent (klass);
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	g_type_class_add_private (klass, sizeof (RygelWritableUserConfigPrivate));
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	G_OBJECT_CLASS (klass)->finalize = rygel_writable_user_config_finalize;
#line 1110 "rygel-writable-user-config.c"
}


static void rygel_writable_user_config_instance_init (RygelWritableUserConfig * self) {
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	self->priv = RYGEL_WRITABLE_USER_CONFIG_GET_PRIVATE (self);
#line 1117 "rygel-writable-user-config.c"
}


static void rygel_writable_user_config_finalize (GObject* obj) {
	RygelWritableUserConfig * self;
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_WRITABLE_USER_CONFIG, RygelWritableUserConfig);
#line 33 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	_g_free0 (self->priv->user_config);
#line 28 "/home/jens/Source/rygel/src/ui/rygel-writable-user-config.vala"
	G_OBJECT_CLASS (rygel_writable_user_config_parent_class)->finalize (obj);
#line 1129 "rygel-writable-user-config.c"
}


/**
 * Manages the user configuration for Rygel.
 */
GType rygel_writable_user_config_get_type (void) {
	static volatile gsize rygel_writable_user_config_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_writable_user_config_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelWritableUserConfigClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_writable_user_config_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelWritableUserConfig), 0, (GInstanceInitFunc) rygel_writable_user_config_instance_init, NULL };
		GType rygel_writable_user_config_type_id;
		rygel_writable_user_config_type_id = g_type_register_static (RYGEL_TYPE_USER_CONFIG, "RygelWritableUserConfig", &g_define_type_info, 0);
		g_once_init_leave (&rygel_writable_user_config_type_id__volatile, rygel_writable_user_config_type_id);
	}
	return rygel_writable_user_config_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



