/* rygel-preferences-dialog.c generated by valac 0.56.19, 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.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 <gtk/gtk.h>
#include <glib-object.h>
#include "rygel-core.h"
#include <gee.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
#include "config.h"

#define RYGEL_PREFERENCES_DIALOG_UI_FILE "/org/gnome/Rygel/Preferences/rygel-preferences.ui"
#define RYGEL_PREFERENCES_DIALOG_DIALOG "preferences-dialog"
#define RYGEL_PREFERENCES_DIALOG_UPNP_CHECKBUTTON "upnp-checkbutton"
#define RYGEL_PREFERENCES_DIALOG_CLOSE_BUTTON "close-button"
#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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#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_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;
enum  {
	RYGEL_PREFERENCES_DIALOG_0_PROPERTY,
	RYGEL_PREFERENCES_DIALOG_NUM_PROPERTIES
};
static GParamSpec* rygel_preferences_dialog_properties[RYGEL_PREFERENCES_DIALOG_NUM_PROPERTIES];
#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);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

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

struct _RygelPreferencesDialogClass {
	GtkApplicationClass parent_class;
};

struct _RygelPreferencesDialogPrivate {
	RygelWritableUserConfig* config;
	GtkBuilder* builder;
	GtkApplicationWindow* dialog;
	GtkSwitch* upnp_check;
	GeeArrayList* sections;
};

static gint RygelPreferencesDialog_private_offset;
static gpointer rygel_preferences_dialog_parent_class = NULL;

VALA_EXTERN GType rygel_preferences_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelPreferencesDialog, g_object_unref)
VALA_EXTERN GType rygel_writable_user_config_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelWritableUserConfig, g_object_unref)
VALA_EXTERN GType rygel_preferences_section_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelPreferencesSection, g_object_unref)
VALA_EXTERN RygelPreferencesDialog* rygel_preferences_dialog_new (GError** error);
VALA_EXTERN RygelPreferencesDialog* rygel_preferences_dialog_construct (GType object_type,
                                                            GError** error);
VALA_EXTERN RygelWritableUserConfig* rygel_writable_user_config_new (GError** error);
VALA_EXTERN RygelWritableUserConfig* rygel_writable_user_config_construct (GType object_type,
                                                               GError** error);
VALA_EXTERN gboolean rygel_writable_user_config_is_upnp_enabled (RygelWritableUserConfig* self);
VALA_EXTERN GType rygel_network_pref_section_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelNetworkPrefSection, g_object_unref)
VALA_EXTERN RygelNetworkPrefSection* rygel_network_pref_section_new (GtkBuilder* builder,
                                                         RygelWritableUserConfig* config,
                                                         GError** error);
VALA_EXTERN RygelNetworkPrefSection* rygel_network_pref_section_construct (GType object_type,
                                                               GtkBuilder* builder,
                                                               RygelWritableUserConfig* config,
                                                               GError** error);
VALA_EXTERN RygelMediaPrefSection* rygel_media_pref_section_new (GtkBuilder* builder,
                                                     RygelWritableUserConfig* config);
VALA_EXTERN RygelMediaPrefSection* rygel_media_pref_section_construct (GType object_type,
                                                           GtkBuilder* builder,
                                                           RygelWritableUserConfig* config);
VALA_EXTERN GType rygel_media_pref_section_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelMediaPrefSection, g_object_unref)
static void rygel_preferences_dialog_on_upnp_switch_toggled (RygelPreferencesDialog* self);
static void __lambda8_ (RygelPreferencesDialog* self);
static void ___lambda8__g_object_notify (GObject* _sender,
                                  GParamSpec* pspec,
                                  gpointer self);
static void rygel_preferences_dialog_real_activate (GApplication* base);
static void rygel_preferences_dialog_real_shutdown (GApplication* base);
VALA_EXTERN void rygel_writable_user_config_set_upnp_enabled (RygelWritableUserConfig* self,
                                                  gboolean value);
VALA_EXTERN void rygel_preferences_section_save (RygelPreferencesSection* self);
VALA_EXTERN void rygel_writable_user_config_save (RygelWritableUserConfig* self);
static gint rygel_preferences_dialog_main (gchar** args,
                                    gint args_length1);
VALA_EXTERN void rygel_preferences_section_set_sensitivity (RygelPreferencesSection* self,
                                                gboolean sensitivity);
static void rygel_preferences_dialog_finalize (GObject * obj);
static GType rygel_preferences_dialog_get_type_once (void);

static inline gpointer
rygel_preferences_dialog_get_instance_private (RygelPreferencesDialog* self)
{
	return G_STRUCT_MEMBER_P (self, RygelPreferencesDialog_private_offset);
}

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

static void
__lambda8_ (RygelPreferencesDialog* self)
{
	rygel_preferences_dialog_on_upnp_switch_toggled (self);
}

static void
___lambda8__g_object_notify (GObject* _sender,
                             GParamSpec* pspec,
                             gpointer self)
{
	__lambda8_ ((RygelPreferencesDialog*) self);
}

RygelPreferencesDialog*
rygel_preferences_dialog_construct (GType object_type,
                                    GError** error)
{
	RygelPreferencesDialog * self = NULL;
	RygelWritableUserConfig* _tmp0_ = NULL;
	RygelWritableUserConfig* _tmp1_;
	RygelWritableUserConfig* _tmp2_;
	GtkBuilder* _tmp3_;
	GtkBuilder* _tmp4_;
	GtkBuilder* _tmp5_;
	GObject* _tmp6_;
	GtkApplicationWindow* _tmp7_;
	GtkApplicationWindow* _tmp8_;
	GtkBuilder* _tmp9_;
	GObject* _tmp10_;
	GtkSwitch* _tmp11_;
	GtkSwitch* _tmp12_;
	GtkSwitch* _tmp13_;
	RygelWritableUserConfig* _tmp14_;
	GeeArrayList* _tmp15_;
	RygelNetworkPrefSection* _tmp16_ = NULL;
	GtkBuilder* _tmp17_;
	RygelWritableUserConfig* _tmp18_;
	RygelNetworkPrefSection* _tmp19_;
	GeeArrayList* _tmp20_;
	GeeArrayList* _tmp21_;
	GtkBuilder* _tmp22_;
	RygelWritableUserConfig* _tmp23_;
	RygelMediaPrefSection* _tmp24_;
	RygelMediaPrefSection* _tmp25_;
	GtkSwitch* _tmp26_;
	GError* _inner_error0_ = NULL;
	self = (RygelPreferencesDialog*) g_object_new (object_type, "application-id", "org.gnome.Rygel.Preferences", "flags", G_APPLICATION_FLAGS_NONE, NULL);
	g_set_application_name ("RygelPreferences");
	_tmp1_ = rygel_writable_user_config_new (&_inner_error0_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp2_ = _tmp0_;
	_tmp0_ = NULL;
	_g_object_unref0 (self->priv->config);
	self->priv->config = _tmp2_;
	_tmp3_ = gtk_builder_new ();
	_g_object_unref0 (self->priv->builder);
	self->priv->builder = _tmp3_;
	_tmp4_ = self->priv->builder;
	gtk_builder_add_from_resource (_tmp4_, RYGEL_PREFERENCES_DIALOG_UI_FILE, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (_tmp0_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp5_ = self->priv->builder;
	_tmp6_ = gtk_builder_get_object (_tmp5_, RYGEL_PREFERENCES_DIALOG_DIALOG);
	_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, gtk_application_window_get_type (), GtkApplicationWindow));
	_g_object_unref0 (self->priv->dialog);
	self->priv->dialog = _tmp7_;
	_tmp8_ = self->priv->dialog;
	_vala_assert (_tmp8_ != NULL, "this.dialog != null");
	_tmp9_ = self->priv->builder;
	_tmp10_ = gtk_builder_get_object (_tmp9_, RYGEL_PREFERENCES_DIALOG_UPNP_CHECKBUTTON);
	_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_switch_get_type (), GtkSwitch));
	_g_object_unref0 (self->priv->upnp_check);
	self->priv->upnp_check = _tmp11_;
	_tmp12_ = self->priv->upnp_check;
	_vala_assert (_tmp12_ != NULL, "this.upnp_check != null");
	_tmp13_ = self->priv->upnp_check;
	_tmp14_ = self->priv->config;
	gtk_switch_set_active (_tmp13_, rygel_writable_user_config_is_upnp_enabled (_tmp14_));
	_tmp15_ = gee_array_list_new (RYGEL_TYPE_PREFERENCES_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->sections);
	self->priv->sections = _tmp15_;
	_tmp17_ = self->priv->builder;
	_tmp18_ = self->priv->config;
	_tmp19_ = rygel_network_pref_section_new (_tmp17_, _tmp18_, &_inner_error0_);
	_tmp16_ = _tmp19_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (_tmp0_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp20_ = self->priv->sections;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, (RygelPreferencesSection*) _tmp16_);
	_tmp21_ = self->priv->sections;
	_tmp22_ = self->priv->builder;
	_tmp23_ = self->priv->config;
	_tmp24_ = rygel_media_pref_section_new (_tmp22_, _tmp23_);
	_tmp25_ = _tmp24_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp21_, (RygelPreferencesSection*) _tmp25_);
	_g_object_unref0 (_tmp25_);
	rygel_preferences_dialog_on_upnp_switch_toggled (self);
	_tmp26_ = self->priv->upnp_check;
	g_signal_connect_object ((GObject*) _tmp26_, "notify::active", (GCallback) ___lambda8__g_object_notify, self, 0);
	_g_object_unref0 (_tmp16_);
	_g_object_unref0 (_tmp0_);
	return self;
}

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

static void
rygel_preferences_dialog_real_activate (GApplication* base)
{
	RygelPreferencesDialog * self;
	GtkApplicationWindow* _tmp0_;
	GtkApplicationWindow* _tmp1_;
	self = (RygelPreferencesDialog*) base;
	_tmp0_ = self->priv->dialog;
	gtk_window_set_application ((GtkWindow*) _tmp0_, (GtkApplication*) self);
	_tmp1_ = self->priv->dialog;
	gtk_window_present ((GtkWindow*) _tmp1_);
}

static void
rygel_preferences_dialog_real_shutdown (GApplication* base)
{
	RygelPreferencesDialog * self;
	RygelWritableUserConfig* _tmp0_;
	GtkSwitch* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	RygelWritableUserConfig* _tmp13_;
	self = (RygelPreferencesDialog*) base;
	_tmp0_ = self->priv->config;
	_tmp1_ = self->priv->upnp_check;
	_tmp2_ = gtk_switch_get_active (_tmp1_);
	_tmp3_ = _tmp2_;
	rygel_writable_user_config_set_upnp_enabled (_tmp0_, _tmp3_);
	{
		GeeArrayList* _section_list = NULL;
		GeeArrayList* _tmp4_;
		gint _section_size = 0;
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _section_index = 0;
		_tmp4_ = self->priv->sections;
		_section_list = _tmp4_;
		_tmp5_ = _section_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_section_size = _tmp7_;
		_section_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			RygelPreferencesSection* section = NULL;
			GeeArrayList* _tmp10_;
			gpointer _tmp11_;
			RygelPreferencesSection* _tmp12_;
			_section_index = _section_index + 1;
			_tmp8_ = _section_index;
			_tmp9_ = _section_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _section_list;
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _section_index);
			section = (RygelPreferencesSection*) _tmp11_;
			_tmp12_ = section;
			rygel_preferences_section_save (_tmp12_);
			_g_object_unref0 (section);
		}
	}
	_tmp13_ = self->priv->config;
	rygel_writable_user_config_save (_tmp13_);
	G_APPLICATION_CLASS (rygel_preferences_dialog_parent_class)->shutdown ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), GtkApplication));
}

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

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

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

static void
rygel_preferences_dialog_class_init (RygelPreferencesDialogClass * klass,
                                     gpointer klass_data)
{
	rygel_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelPreferencesDialog_private_offset);
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) rygel_preferences_dialog_real_activate;
	((GApplicationClass *) klass)->shutdown = (void (*) (GApplication*)) rygel_preferences_dialog_real_shutdown;
	G_OBJECT_CLASS (klass)->finalize = rygel_preferences_dialog_finalize;
}

static void
rygel_preferences_dialog_instance_init (RygelPreferencesDialog * self,
                                        gpointer klass)
{
	self->priv = rygel_preferences_dialog_get_instance_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);
}

 G_GNUC_NO_INLINE static GType
rygel_preferences_dialog_get_type_once (void)
{
	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 (gtk_application_get_type (), "RygelPreferencesDialog", &g_define_type_info, 0);
	RygelPreferencesDialog_private_offset = g_type_add_instance_private (rygel_preferences_dialog_type_id, sizeof (RygelPreferencesDialogPrivate));
	return rygel_preferences_dialog_type_id;
}

GType
rygel_preferences_dialog_get_type (void)
{
	static volatile gsize rygel_preferences_dialog_type_id__once = 0;
	if (g_once_init_enter (&rygel_preferences_dialog_type_id__once)) {
		GType rygel_preferences_dialog_type_id;
		rygel_preferences_dialog_type_id = rygel_preferences_dialog_get_type_once ();
		g_once_init_leave (&rygel_preferences_dialog_type_id__once, rygel_preferences_dialog_type_id);
	}
	return rygel_preferences_dialog_type_id__once;
}

