/* rygel-preferences-dialog.c generated by valac 0.20.1.2-ca5c2, the Vala compiler
 * generated from rygel-preferences-dialog.vala, do not modify */

/*
 * Copyright (C) 2009 Nokia Corporation.
 * Copyright (C) 2012 Openismus GmbH.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.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 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 <gtk/gtk.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
#include <rygel-core.h>


#define RYGEL_TYPE_PREFERENCES_DIALOG (rygel_preferences_dialog_get_type ())
#define RYGEL_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PREFERENCES_DIALOG, RygelPreferencesDialog))
#define RYGEL_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PREFERENCES_DIALOG, RygelPreferencesDialogClass))
#define RYGEL_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PREFERENCES_DIALOG))
#define RYGEL_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PREFERENCES_DIALOG))
#define RYGEL_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PREFERENCES_DIALOG, RygelPreferencesDialogClass))

typedef struct _RygelPreferencesDialog RygelPreferencesDialog;
typedef struct _RygelPreferencesDialogClass RygelPreferencesDialogClass;
typedef struct _RygelPreferencesDialogPrivate RygelPreferencesDialogPrivate;

#define RYGEL_TYPE_USER_CONFIG (rygel_user_config_get_type ())
#define RYGEL_USER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_USER_CONFIG, RygelUserConfig))
#define RYGEL_USER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_USER_CONFIG, RygelUserConfigClass))
#define RYGEL_IS_USER_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_USER_CONFIG))
#define RYGEL_IS_USER_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_USER_CONFIG))
#define RYGEL_USER_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_USER_CONFIG, RygelUserConfigClass))

typedef struct _RygelUserConfig RygelUserConfig;
typedef struct _RygelUserConfigClass RygelUserConfigClass;

#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;

#define RYGEL_TYPE_PREFERENCES_SECTION (rygel_preferences_section_get_type ())
#define RYGEL_PREFERENCES_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PREFERENCES_SECTION, RygelPreferencesSection))
#define RYGEL_PREFERENCES_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PREFERENCES_SECTION, RygelPreferencesSectionClass))
#define RYGEL_IS_PREFERENCES_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PREFERENCES_SECTION))
#define RYGEL_IS_PREFERENCES_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PREFERENCES_SECTION))
#define RYGEL_PREFERENCES_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PREFERENCES_SECTION, RygelPreferencesSectionClass))

typedef struct _RygelPreferencesSection RygelPreferencesSection;
typedef struct _RygelPreferencesSectionClass RygelPreferencesSectionClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define RYGEL_TYPE_NETWORK_PREF_SECTION (rygel_network_pref_section_get_type ())
#define RYGEL_NETWORK_PREF_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_NETWORK_PREF_SECTION, RygelNetworkPrefSection))
#define RYGEL_NETWORK_PREF_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_NETWORK_PREF_SECTION, RygelNetworkPrefSectionClass))
#define RYGEL_IS_NETWORK_PREF_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_NETWORK_PREF_SECTION))
#define RYGEL_IS_NETWORK_PREF_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_NETWORK_PREF_SECTION))
#define RYGEL_NETWORK_PREF_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_NETWORK_PREF_SECTION, RygelNetworkPrefSectionClass))

typedef struct _RygelNetworkPrefSection RygelNetworkPrefSection;
typedef struct _RygelNetworkPrefSectionClass RygelNetworkPrefSectionClass;

#define RYGEL_TYPE_MEDIA_PREF_SECTION (rygel_media_pref_section_get_type ())
#define RYGEL_MEDIA_PREF_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_PREF_SECTION, RygelMediaPrefSection))
#define RYGEL_MEDIA_PREF_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_PREF_SECTION, RygelMediaPrefSectionClass))
#define RYGEL_IS_MEDIA_PREF_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_PREF_SECTION))
#define RYGEL_IS_MEDIA_PREF_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_PREF_SECTION))
#define RYGEL_MEDIA_PREF_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_PREF_SECTION, RygelMediaPrefSectionClass))

typedef struct _RygelMediaPrefSection RygelMediaPrefSection;
typedef struct _RygelMediaPrefSectionClass RygelMediaPrefSectionClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _RygelPreferencesDialog {
	GObject parent_instance;
	RygelPreferencesDialogPrivate * priv;
};

struct _RygelPreferencesDialogClass {
	GObjectClass parent_class;
};

struct _RygelPreferencesDialogPrivate {
	RygelWritableUserConfig* config;
	GtkBuilder* builder;
	GtkDialog* dialog;
	GtkCheckButton* upnp_check;
	GeeArrayList* sections;
};


static gpointer rygel_preferences_dialog_parent_class = NULL;

GType rygel_preferences_dialog_get_type (void) G_GNUC_CONST;
GType rygel_user_config_get_type (void) G_GNUC_CONST;
GType rygel_writable_user_config_get_type (void) G_GNUC_CONST;
GType rygel_preferences_section_get_type (void) G_GNUC_CONST;
#define RYGEL_PREFERENCES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_PREFERENCES_DIALOG, RygelPreferencesDialogPrivate))
enum  {
	RYGEL_PREFERENCES_DIALOG_DUMMY_PROPERTY
};
#define RYGEL_PREFERENCES_DIALOG_UI_FILE DATA_DIR "/rygel-preferences.ui"
#define RYGEL_PREFERENCES_DIALOG_DIALOG "preferences-dialog"
#define RYGEL_PREFERENCES_DIALOG_ICON SMALL_ICON_DIR "/rygel.png"
#define RYGEL_PREFERENCES_DIALOG_UPNP_CHECKBUTTON "upnp-checkbutton"
RygelPreferencesDialog* rygel_preferences_dialog_new (GError** error);
RygelPreferencesDialog* rygel_preferences_dialog_construct (GType object_type, GError** error);
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);
RygelNetworkPrefSection* rygel_network_pref_section_new (GtkBuilder* builder, RygelWritableUserConfig* config, GError** error);
RygelNetworkPrefSection* rygel_network_pref_section_construct (GType object_type, GtkBuilder* builder, RygelWritableUserConfig* config, GError** error);
GType rygel_network_pref_section_get_type (void) G_GNUC_CONST;
RygelMediaPrefSection* rygel_media_pref_section_new (GtkBuilder* builder, RygelWritableUserConfig* config);
RygelMediaPrefSection* rygel_media_pref_section_construct (GType object_type, GtkBuilder* builder, RygelWritableUserConfig* config);
GType rygel_media_pref_section_get_type (void) G_GNUC_CONST;
static void rygel_preferences_dialog_on_upnp_check_button_toggled (RygelPreferencesDialog* self, GtkToggleButton* upnp_check);
static void _rygel_preferences_dialog_on_upnp_check_button_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
void rygel_preferences_dialog_run (RygelPreferencesDialog* self);
void rygel_writable_user_config_set_upnp_enabled (RygelWritableUserConfig* self, gboolean value);
void rygel_preferences_section_save (RygelPreferencesSection* self);
void rygel_writable_user_config_save (RygelWritableUserConfig* self);
gint rygel_preferences_dialog_main (gchar** args, int args_length1);
RygelUserConfig* rygel_user_config_get_default (GError** error);
void rygel_preferences_section_set_sensitivity (RygelPreferencesSection* self, gboolean sensitivity);
static void rygel_preferences_dialog_finalize (GObject* obj);


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


static void _rygel_preferences_dialog_on_upnp_check_button_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	rygel_preferences_dialog_on_upnp_check_button_toggled (self, _sender);
}


RygelPreferencesDialog* rygel_preferences_dialog_construct (GType object_type, GError** error) {
	RygelPreferencesDialog * self = NULL;
	RygelWritableUserConfig* _tmp0_;
	RygelWritableUserConfig* _tmp1_;
	GtkBuilder* _tmp2_;
	GtkBuilder* _tmp3_;
	GtkBuilder* _tmp4_;
	GObject* _tmp5_ = NULL;
	GtkWidget* _tmp6_;
	GtkWidget* toolbar;
	GtkWidget* _tmp7_;
	GtkStyleContext* _tmp8_ = NULL;
	GtkStyleContext* _tmp9_;
	GtkStyleContext* style_context;
	GtkStyleContext* _tmp10_;
	GtkStyleContext* _tmp11_;
	GtkBuilder* _tmp12_;
	GObject* _tmp13_ = NULL;
	GtkDialog* _tmp14_;
	GtkDialog* _tmp15_;
	GtkBuilder* _tmp16_;
	GObject* _tmp17_ = NULL;
	GtkCheckButton* _tmp18_;
	GtkCheckButton* _tmp19_;
	GtkDialog* _tmp20_;
	GtkCheckButton* _tmp21_;
	RygelWritableUserConfig* _tmp22_;
	gboolean _tmp23_ = FALSE;
	GeeArrayList* _tmp24_;
	GtkBuilder* _tmp25_;
	RygelWritableUserConfig* _tmp26_;
	RygelNetworkPrefSection* _tmp27_;
	RygelNetworkPrefSection* _tmp28_;
	GeeArrayList* _tmp29_;
	RygelNetworkPrefSection* _tmp30_;
	GeeArrayList* _tmp31_;
	GtkBuilder* _tmp32_;
	RygelWritableUserConfig* _tmp33_;
	RygelMediaPrefSection* _tmp34_;
	RygelMediaPrefSection* _tmp35_;
	GtkCheckButton* _tmp36_;
	GtkCheckButton* _tmp37_;
	GError * _inner_error_ = NULL;
	self = (RygelPreferencesDialog*) g_object_new (object_type, NULL);
	_tmp0_ = rygel_writable_user_config_new (&_inner_error_);
	_tmp1_ = _tmp0_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (self->priv->config);
	self->priv->config = _tmp1_;
	_tmp2_ = gtk_builder_new ();
	_g_object_unref0 (self->priv->builder);
	self->priv->builder = _tmp2_;
	_tmp3_ = self->priv->builder;
	gtk_builder_add_from_file (_tmp3_, RYGEL_PREFERENCES_DIALOG_UI_FILE, &_inner_error_);
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp4_ = self->priv->builder;
	_tmp5_ = gtk_builder_get_object (_tmp4_, "toolbar1");
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, GTK_TYPE_WIDGET) ? ((GtkWidget*) _tmp5_) : NULL);
	toolbar = _tmp6_;
	_tmp7_ = toolbar;
	_tmp8_ = gtk_widget_get_style_context (_tmp7_);
	_tmp9_ = _g_object_ref0 (_tmp8_);
	style_context = _tmp9_;
	_tmp10_ = style_context;
	gtk_style_context_set_junction_sides (_tmp10_, GTK_JUNCTION_TOP);
	_tmp11_ = style_context;
	gtk_style_context_add_class (_tmp11_, GTK_STYLE_CLASS_INLINE_TOOLBAR);
	_tmp12_ = self->priv->builder;
	_tmp13_ = gtk_builder_get_object (_tmp12_, RYGEL_PREFERENCES_DIALOG_DIALOG);
	_tmp14_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GTK_TYPE_DIALOG, GtkDialog));
	_g_object_unref0 (self->priv->dialog);
	self->priv->dialog = _tmp14_;
	_tmp15_ = self->priv->dialog;
	_vala_assert (_tmp15_ != NULL, "this.dialog != null");
	_tmp16_ = self->priv->builder;
	_tmp17_ = gtk_builder_get_object (_tmp16_, RYGEL_PREFERENCES_DIALOG_UPNP_CHECKBUTTON);
	_tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GTK_TYPE_CHECK_BUTTON, GtkCheckButton));
	_g_object_unref0 (self->priv->upnp_check);
	self->priv->upnp_check = _tmp18_;
	_tmp19_ = self->priv->upnp_check;
	_vala_assert (_tmp19_ != NULL, "this.upnp_check != null");
	_tmp20_ = self->priv->dialog;
	gtk_window_set_icon_from_file ((GtkWindow*) _tmp20_, RYGEL_PREFERENCES_DIALOG_ICON, &_inner_error_);
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (style_context);
		_g_object_unref0 (toolbar);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp21_ = self->priv->upnp_check;
	_tmp22_ = self->priv->config;
	_tmp23_ = rygel_writable_user_config_is_upnp_enabled (_tmp22_);
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp21_, _tmp23_);
	_tmp24_ = gee_array_list_new (RYGEL_TYPE_PREFERENCES_SECTION, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->sections);
	self->priv->sections = _tmp24_;
	_tmp25_ = self->priv->builder;
	_tmp26_ = self->priv->config;
	_tmp27_ = rygel_network_pref_section_new (_tmp25_, _tmp26_, &_inner_error_);
	_tmp28_ = _tmp27_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (style_context);
		_g_object_unref0 (toolbar);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp29_ = self->priv->sections;
	_tmp30_ = _tmp28_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp29_, (RygelPreferencesSection*) _tmp30_);
	_g_object_unref0 (_tmp30_);
	_tmp31_ = self->priv->sections;
	_tmp32_ = self->priv->builder;
	_tmp33_ = self->priv->config;
	_tmp34_ = rygel_media_pref_section_new (_tmp32_, _tmp33_);
	_tmp35_ = _tmp34_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp31_, (RygelPreferencesSection*) _tmp35_);
	_g_object_unref0 (_tmp35_);
	_tmp36_ = self->priv->upnp_check;
	rygel_preferences_dialog_on_upnp_check_button_toggled (self, (GtkToggleButton*) _tmp36_);
	_tmp37_ = self->priv->upnp_check;
	g_signal_connect_object ((GtkToggleButton*) _tmp37_, "toggled", (GCallback) _rygel_preferences_dialog_on_upnp_check_button_toggled_gtk_toggle_button_toggled, self, 0);
	_g_object_unref0 (style_context);
	_g_object_unref0 (toolbar);
	return self;
}


RygelPreferencesDialog* rygel_preferences_dialog_new (GError** error) {
	return rygel_preferences_dialog_construct (RYGEL_TYPE_PREFERENCES_DIALOG, error);
}


void rygel_preferences_dialog_run (RygelPreferencesDialog* self) {
	GtkDialog* _tmp0_;
	GtkDialog* _tmp1_;
	RygelWritableUserConfig* _tmp2_;
	GtkCheckButton* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	RygelWritableUserConfig* _tmp18_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->dialog;
	gtk_dialog_run (_tmp0_);
	_tmp1_ = self->priv->dialog;
	gtk_widget_hide ((GtkWidget*) _tmp1_);
	_tmp2_ = self->priv->config;
	_tmp3_ = self->priv->upnp_check;
	_tmp4_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp3_);
	_tmp5_ = _tmp4_;
	rygel_writable_user_config_set_upnp_enabled (_tmp2_, _tmp5_);
	{
		GeeArrayList* _tmp6_;
		GeeArrayList* _tmp7_;
		GeeArrayList* _section_list;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _section_size;
		gint _section_index;
		_tmp6_ = self->priv->sections;
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_section_list = _tmp7_;
		_tmp8_ = _section_list;
		_tmp9_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_section_size = _tmp10_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			gint _tmp13_;
			GeeArrayList* _tmp14_;
			gint _tmp15_;
			gpointer _tmp16_ = NULL;
			RygelPreferencesSection* section;
			RygelPreferencesSection* _tmp17_;
			_tmp11_ = _section_index;
			_section_index = _tmp11_ + 1;
			_tmp12_ = _section_index;
			_tmp13_ = _section_size;
			if (!(_tmp12_ < _tmp13_)) {
				break;
			}
			_tmp14_ = _section_list;
			_tmp15_ = _section_index;
			_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, _tmp15_);
			section = (RygelPreferencesSection*) _tmp16_;
			_tmp17_ = section;
			rygel_preferences_section_save (_tmp17_);
			_g_object_unref0 (section);
		}
		_g_object_unref0 (_section_list);
	}
	_tmp18_ = self->priv->config;
	rygel_writable_user_config_save (_tmp18_);
}


gint rygel_preferences_dialog_main (gchar** args, int args_length1) {
	gint result = 0;
	GError * _inner_error_ = NULL;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	gtk_init (&args_length1, &args);
	{
		RygelUserConfig* _tmp0_ = NULL;
		RygelUserConfig* _tmp1_;
		RygelUserConfig* _tmp2_;
		RygelPreferencesDialog* _tmp3_;
		RygelPreferencesDialog* dialog;
		RygelPreferencesDialog* _tmp4_;
		_tmp0_ = rygel_user_config_get_default (&_inner_error_);
		_tmp1_ = _tmp0_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp1_;
		rygel_meta_config_register_configuration ((RygelConfiguration*) _tmp2_);
		_g_object_unref0 (_tmp2_);
		_tmp3_ = rygel_preferences_dialog_new (&_inner_error_);
		dialog = _tmp3_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_tmp4_ = dialog;
		rygel_preferences_dialog_run (_tmp4_);
		_g_object_unref0 (dialog);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		const gchar* _tmp5_ = NULL;
		const gchar* _tmp6_;
		err = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = _ ("Failed to create preferences dialog: %s");
		_tmp6_ = err->message;
		g_error (_tmp5_, _tmp6_);
		_g_error_free0 (err);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		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);
		g_clear_error (&_inner_error_);
		return 0;
	}
	result = 0;
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return rygel_preferences_dialog_main (argv, argc);
}


static void rygel_preferences_dialog_on_upnp_check_button_toggled (RygelPreferencesDialog* self, GtkToggleButton* upnp_check) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (upnp_check != NULL);
	{
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		GeeArrayList* _section_list;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _section_size;
		gint _section_index;
		_tmp0_ = self->priv->sections;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_section_list = _tmp1_;
		_tmp2_ = _section_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_section_size = _tmp4_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			RygelPreferencesSection* section;
			RygelPreferencesSection* _tmp11_;
			GtkToggleButton* _tmp12_;
			gboolean _tmp13_;
			gboolean _tmp14_;
			_tmp5_ = _section_index;
			_section_index = _tmp5_ + 1;
			_tmp6_ = _section_index;
			_tmp7_ = _section_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _section_list;
			_tmp9_ = _section_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			section = (RygelPreferencesSection*) _tmp10_;
			_tmp11_ = section;
			_tmp12_ = upnp_check;
			_tmp13_ = gtk_toggle_button_get_active (_tmp12_);
			_tmp14_ = _tmp13_;
			rygel_preferences_section_set_sensitivity (_tmp11_, _tmp14_);
			_g_object_unref0 (section);
		}
		_g_object_unref0 (_section_list);
	}
}


static void rygel_preferences_dialog_class_init (RygelPreferencesDialogClass * klass) {
	rygel_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelPreferencesDialogPrivate));
	G_OBJECT_CLASS (klass)->finalize = rygel_preferences_dialog_finalize;
}


static void rygel_preferences_dialog_instance_init (RygelPreferencesDialog * self) {
	self->priv = RYGEL_PREFERENCES_DIALOG_GET_PRIVATE (self);
}


static void rygel_preferences_dialog_finalize (GObject* obj) {
	RygelPreferencesDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_PREFERENCES_DIALOG, RygelPreferencesDialog);
	_g_object_unref0 (self->priv->config);
	_g_object_unref0 (self->priv->builder);
	_g_object_unref0 (self->priv->dialog);
	_g_object_unref0 (self->priv->upnp_check);
	_g_object_unref0 (self->priv->sections);
	G_OBJECT_CLASS (rygel_preferences_dialog_parent_class)->finalize (obj);
}


GType rygel_preferences_dialog_get_type (void) {
	static volatile gsize rygel_preferences_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_preferences_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelPreferencesDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_preferences_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelPreferencesDialog), 0, (GInstanceInitFunc) rygel_preferences_dialog_instance_init, NULL };
		GType rygel_preferences_dialog_type_id;
		rygel_preferences_dialog_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelPreferencesDialog", &g_define_type_info, 0);
		g_once_init_leave (&rygel_preferences_dialog_type_id__volatile, rygel_preferences_dialog_type_id);
	}
	return rygel_preferences_dialog_type_id__volatile;
}



