/* rygel-configuration.c generated by valac 0.56.19, the Vala compiler
 * generated from rygel-configuration.vala, do not modify */

/*
 * Copyright (C) 2008,2009 Nokia Corporation.
 * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *         Krzesimir Nowak <krnowak@openismus.com>
 *         Jens Georg <jensg@openismus.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.1 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "rygel-core.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	RYGEL_CONFIGURATION_CONFIGURATION_CHANGED_SIGNAL,
	RYGEL_CONFIGURATION_SECTION_CHANGED_SIGNAL,
	RYGEL_CONFIGURATION_SETTING_CHANGED_SIGNAL,
	RYGEL_CONFIGURATION_NUM_SIGNALS
};
static guint rygel_configuration_signals[RYGEL_CONFIGURATION_NUM_SIGNALS] = {0};

static void g_cclosure_user_marshal_VOID__STRING_ENUM (GClosure * closure,
                                                GValue * return_value,
                                                guint n_param_values,
                                                const GValue * param_values,
                                                gpointer invocation_hint,
                                                gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static GType rygel_configuration_get_type_once (void);

GQuark
rygel_configuration_error_quark (void)
{
	return g_quark_from_static_string ("rygel-configuration-error-quark");
}

 G_GNUC_NO_INLINE static GType
rygel_configuration_error_get_type_once (void)
{
	static const GEnumValue values[] = {{RYGEL_CONFIGURATION_ERROR_NO_VALUE_SET, "RYGEL_CONFIGURATION_ERROR_NO_VALUE_SET", "no-value-set"}, {RYGEL_CONFIGURATION_ERROR_VALUE_OUT_OF_RANGE, "RYGEL_CONFIGURATION_ERROR_VALUE_OUT_OF_RANGE", "value-out-of-range"}, {0, NULL, NULL}};
	GType rygel_configuration_error_type_id;
	rygel_configuration_error_type_id = g_enum_register_static ("RygelConfigurationError", values);
	return rygel_configuration_error_type_id;
}

GType
rygel_configuration_error_get_type (void)
{
	static volatile gsize rygel_configuration_error_type_id__once = 0;
	if (g_once_init_enter (&rygel_configuration_error_type_id__once)) {
		GType rygel_configuration_error_type_id;
		rygel_configuration_error_type_id = rygel_configuration_error_get_type_once ();
		g_once_init_leave (&rygel_configuration_error_type_id__once, rygel_configuration_error_type_id);
	}
	return rygel_configuration_error_type_id__once;
}

 G_GNUC_NO_INLINE static GType
rygel_configuration_entry_get_type_once (void)
{
	static const GEnumValue values[] = {{RYGEL_CONFIGURATION_ENTRY_INTERFACE, "RYGEL_CONFIGURATION_ENTRY_INTERFACE", "interface"}, {RYGEL_CONFIGURATION_ENTRY_PORT, "RYGEL_CONFIGURATION_ENTRY_PORT", "port"}, {RYGEL_CONFIGURATION_ENTRY_TRANSCODING, "RYGEL_CONFIGURATION_ENTRY_TRANSCODING", "transcoding"}, {RYGEL_CONFIGURATION_ENTRY_ALLOW_UPLOAD, "RYGEL_CONFIGURATION_ENTRY_ALLOW_UPLOAD", "allow-upload"}, {RYGEL_CONFIGURATION_ENTRY_ALLOW_DELETION, "RYGEL_CONFIGURATION_ENTRY_ALLOW_DELETION", "allow-deletion"}, {RYGEL_CONFIGURATION_ENTRY_LOG_LEVELS, "RYGEL_CONFIGURATION_ENTRY_LOG_LEVELS", "log-levels"}, {RYGEL_CONFIGURATION_ENTRY_PLUGIN_PATH, "RYGEL_CONFIGURATION_ENTRY_PLUGIN_PATH", "plugin-path"}, {RYGEL_CONFIGURATION_ENTRY_VIDEO_UPLOAD_FOLDER, "RYGEL_CONFIGURATION_ENTRY_VIDEO_UPLOAD_FOLDER", "video-upload-folder"}, {RYGEL_CONFIGURATION_ENTRY_MUSIC_UPLOAD_FOLDER, "RYGEL_CONFIGURATION_ENTRY_MUSIC_UPLOAD_FOLDER", "music-upload-folder"}, {RYGEL_CONFIGURATION_ENTRY_PICTURE_UPLOAD_FOLDER, "RYGEL_CONFIGURATION_ENTRY_PICTURE_UPLOAD_FOLDER", "picture-upload-folder"}, {0, NULL, NULL}};
	GType rygel_configuration_entry_type_id;
	rygel_configuration_entry_type_id = g_enum_register_static ("RygelConfigurationEntry", values);
	return rygel_configuration_entry_type_id;
}

GType
rygel_configuration_entry_get_type (void)
{
	static volatile gsize rygel_configuration_entry_type_id__once = 0;
	if (g_once_init_enter (&rygel_configuration_entry_type_id__once)) {
		GType rygel_configuration_entry_type_id;
		rygel_configuration_entry_type_id = rygel_configuration_entry_get_type_once ();
		g_once_init_leave (&rygel_configuration_entry_type_id__once, rygel_configuration_entry_type_id);
	}
	return rygel_configuration_entry_type_id__once;
}

 G_GNUC_NO_INLINE static GType
rygel_section_entry_get_type_once (void)
{
	static const GEnumValue values[] = {{RYGEL_SECTION_ENTRY_TITLE, "RYGEL_SECTION_ENTRY_TITLE", "title"}, {RYGEL_SECTION_ENTRY_ENABLED, "RYGEL_SECTION_ENTRY_ENABLED", "enabled"}, {0, NULL, NULL}};
	GType rygel_section_entry_type_id;
	rygel_section_entry_type_id = g_enum_register_static ("RygelSectionEntry", values);
	return rygel_section_entry_type_id;
}

GType
rygel_section_entry_get_type (void)
{
	static volatile gsize rygel_section_entry_type_id__once = 0;
	if (g_once_init_enter (&rygel_section_entry_type_id__once)) {
		GType rygel_section_entry_type_id;
		rygel_section_entry_type_id = rygel_section_entry_get_type_once ();
		g_once_init_leave (&rygel_section_entry_type_id__once, rygel_section_entry_type_id);
	}
	return rygel_section_entry_type_id__once;
}

gchar*
rygel_configuration_get_interface (RygelConfiguration* self,
                                   GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_interface) {
		return _iface_->get_interface (self, error);
	}
	return NULL;
}

gchar**
rygel_configuration_get_interfaces (RygelConfiguration* self,
                                    GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_interfaces) {
		return _iface_->get_interfaces (self, error);
	}
	return NULL;
}

gint
rygel_configuration_get_port (RygelConfiguration* self,
                              GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, -1);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_port) {
		return _iface_->get_port (self, error);
	}
	return -1;
}

gboolean
rygel_configuration_get_transcoding (RygelConfiguration* self,
                                     GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_transcoding) {
		return _iface_->get_transcoding (self, error);
	}
	return FALSE;
}

gboolean
rygel_configuration_get_allow_upload (RygelConfiguration* self,
                                      GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_allow_upload) {
		return _iface_->get_allow_upload (self, error);
	}
	return FALSE;
}

gboolean
rygel_configuration_get_allow_deletion (RygelConfiguration* self,
                                        GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_allow_deletion) {
		return _iface_->get_allow_deletion (self, error);
	}
	return FALSE;
}

gchar*
rygel_configuration_get_log_levels (RygelConfiguration* self,
                                    GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_log_levels) {
		return _iface_->get_log_levels (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_plugin_path (RygelConfiguration* self,
                                     GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_plugin_path) {
		return _iface_->get_plugin_path (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_engine_path (RygelConfiguration* self,
                                     GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_engine_path) {
		return _iface_->get_engine_path (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_media_engine (RygelConfiguration* self,
                                      GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_media_engine) {
		return _iface_->get_media_engine (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_video_upload_folder (RygelConfiguration* self,
                                             GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_video_upload_folder) {
		return _iface_->get_video_upload_folder (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_music_upload_folder (RygelConfiguration* self,
                                             GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_music_upload_folder) {
		return _iface_->get_music_upload_folder (self, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_picture_upload_folder (RygelConfiguration* self,
                                               GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_picture_upload_folder) {
		return _iface_->get_picture_upload_folder (self, error);
	}
	return NULL;
}

gboolean
rygel_configuration_get_enabled (RygelConfiguration* self,
                                 const gchar* section,
                                 GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_enabled) {
		return _iface_->get_enabled (self, section, error);
	}
	return FALSE;
}

gchar*
rygel_configuration_get_title (RygelConfiguration* self,
                               const gchar* section,
                               GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_title) {
		return _iface_->get_title (self, section, error);
	}
	return NULL;
}

gchar*
rygel_configuration_get_string (RygelConfiguration* self,
                                const gchar* section,
                                const gchar* key,
                                GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_string) {
		return _iface_->get_string (self, section, key, error);
	}
	return NULL;
}

GeeArrayList*
rygel_configuration_get_string_list (RygelConfiguration* self,
                                     const gchar* section,
                                     const gchar* key,
                                     GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_string_list) {
		return _iface_->get_string_list (self, section, key, error);
	}
	return NULL;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

GeeArrayList*
rygel_configuration_get_string_list_with_default (RygelConfiguration* self,
                                                  const gchar* section,
                                                  const gchar* key,
                                                  GeeArrayList* _default_)
{
	GError* _inner_error0_ = NULL;
	GeeArrayList* result;
	g_return_val_if_fail (section != NULL, NULL);
	g_return_val_if_fail (key != NULL, NULL);
	g_return_val_if_fail (_default_ != NULL, NULL);
	{
		GeeArrayList* _result_ = NULL;
		GeeArrayList* _tmp0_;
		gboolean _tmp1_ = FALSE;
		GeeArrayList* _tmp2_;
		_tmp0_ = rygel_configuration_get_string_list (self, section, key, &_inner_error0_);
		_result_ = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _result_;
		if (_tmp2_ == NULL) {
			_tmp1_ = TRUE;
		} else {
			GeeArrayList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			_tmp3_ = _result_;
			_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_tmp1_ = _tmp5_ == 0;
		}
		if (_tmp1_) {
			GeeArrayList* _tmp6_;
			_tmp6_ = _g_object_ref0 (_default_);
			result = _tmp6_;
			_g_object_unref0 (_result_);
			return result;
		}
		result = _result_;
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GeeArrayList* _tmp7_;
		g_clear_error (&_inner_error0_);
		_tmp7_ = _g_object_ref0 (_default_);
		result = _tmp7_;
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

gint
rygel_configuration_get_int (RygelConfiguration* self,
                             const gchar* section,
                             const gchar* key,
                             gint min,
                             gint max,
                             GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, -1);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_int) {
		return _iface_->get_int (self, section, key, min, max, error);
	}
	return -1;
}

GeeArrayList*
rygel_configuration_get_int_list (RygelConfiguration* self,
                                  const gchar* section,
                                  const gchar* key,
                                  GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_int_list) {
		return _iface_->get_int_list (self, section, key, error);
	}
	return NULL;
}

gboolean
rygel_configuration_get_bool (RygelConfiguration* self,
                              const gchar* section,
                              const gchar* key,
                              GError** error)
{
	RygelConfigurationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = RYGEL_CONFIGURATION_GET_INTERFACE (self);
	if (_iface_->get_bool) {
		return _iface_->get_bool (self, section, key, error);
	}
	return FALSE;
}

static void
g_cclosure_user_marshal_VOID__STRING_ENUM (GClosure * closure,
                                           GValue * return_value,
                                           guint n_param_values,
                                           const GValue * param_values,
                                           gpointer invocation_hint,
                                           gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_ENUM) (gpointer data1, const char* arg_1, gint arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_ENUM callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_ENUM) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_enum (param_values + 2), data2);
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), data2);
}

static void
rygel_configuration_default_init (RygelConfigurationIface * iface,
                                  gpointer iface_data)
{
	/**
	     * Emitted when any of known configuration settings has
	     * changed. RygelConfigurationEntry lists known configuration
	     * settings.
	     */
	rygel_configuration_signals[RYGEL_CONFIGURATION_CONFIGURATION_CHANGED_SIGNAL] = g_signal_new ("configuration-changed", RYGEL_TYPE_CONFIGURATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, RYGEL_TYPE_CONFIGURATION_ENTRY);
	/**
	     * Emitted when any of section settings has
	     * changed. RygelSectionEntry lists known section settings.
	     */
	rygel_configuration_signals[RYGEL_CONFIGURATION_SECTION_CHANGED_SIGNAL] = g_signal_new ("section-changed", RYGEL_TYPE_CONFIGURATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_ENUM, G_TYPE_NONE, 2, G_TYPE_STRING, RYGEL_TYPE_SECTION_ENTRY);
	/**
	     * Emitted when some custom setting has changed. That happens when
	     * changed setting does fit into neither configuration_changed nor
	     * section_changed signal.
	     */
	rygel_configuration_signals[RYGEL_CONFIGURATION_SETTING_CHANGED_SIGNAL] = g_signal_new ("setting-changed", RYGEL_TYPE_CONFIGURATION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
}

/**
 * Interface for dealing with Rygel configuration.
 */
 G_GNUC_NO_INLINE static GType
rygel_configuration_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelConfigurationIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_configuration_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType rygel_configuration_type_id;
	rygel_configuration_type_id = g_type_register_static (G_TYPE_INTERFACE, "RygelConfiguration", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (rygel_configuration_type_id, G_TYPE_OBJECT);
	return rygel_configuration_type_id;
}

GType
rygel_configuration_get_type (void)
{
	static volatile gsize rygel_configuration_type_id__once = 0;
	if (g_once_init_enter (&rygel_configuration_type_id__once)) {
		GType rygel_configuration_type_id;
		rygel_configuration_type_id = rygel_configuration_get_type_once ();
		g_once_init_leave (&rygel_configuration_type_id__once, rygel_configuration_type_id);
	}
	return rygel_configuration_type_id__once;
}

