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

/*
 *  Copyright (c) 2009-2010 Mike Massonnet <mmassonnet@xfce.org>
 *  Copyright (c) 2009-2010 Vincent Legout <vincent@xfce.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include "xfmpc.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <libxfce4util/libxfce4util.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

enum  {
	XFMPC_PREFERENCES_0_PROPERTY,
	XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY,
	XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY,
	XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY,
	XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY,
	XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY,
	XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY,
	XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY,
	XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY,
	XFMPC_PREFERENCES_MPD_PORT_PROPERTY,
	XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY,
	XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY,
	XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY,
	XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY,
	XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY,
	XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY,
	XFMPC_PREFERENCES_NUM_PROPERTIES
};
static GParamSpec* xfmpc_preferences_properties[XFMPC_PREFERENCES_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xfce_rc_close0(var) ((var == NULL) ? NULL : (var = (xfce_rc_close (var), NULL)))

struct _XfmpcPreferencesPrivate {
	gint _last_window_posx;
	gint _last_window_posy;
	gint _last_window_width;
	gint _last_window_height;
	gboolean _last_window_state_sticky;
	gboolean _playlist_autocenter;
	gboolean _playlist_show_position;
	gchar* _mpd_hostname;
	gint _mpd_port;
	gchar* _mpd_password;
	gboolean _mpd_use_defaults;
	gboolean _show_status_icon;
	gboolean _show_statusbar;
	XfmpcPreferencesSongFormat _song_format;
	gchar* _song_format_custom;
};

static gint XfmpcPreferences_private_offset;
static gpointer xfmpc_preferences_parent_class = NULL;
static XfmpcPreferences* xfmpc_preferences_preferences;
static XfmpcPreferences* xfmpc_preferences_preferences = NULL;

static void xfmpc_preferences_load (XfmpcPreferences* self);
static void xfmpc_preferences_store (XfmpcPreferences* self);
static GObject * xfmpc_preferences_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void xfmpc_preferences_finalize (GObject * obj);
static GType xfmpc_preferences_get_type_once (void);
static void _vala_xfmpc_preferences_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_xfmpc_preferences_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
xfmpc_preferences_get_instance_private (XfmpcPreferences* self)
{
	return G_STRUCT_MEMBER_P (self, XfmpcPreferences_private_offset);
}

 G_GNUC_NO_INLINE static GType
xfmpc_preferences_song_format_get_type_once (void)
{
	static const GEnumValue values[] = {{XFMPC_PREFERENCES_SONG_FORMAT_TITLE, "XFMPC_PREFERENCES_SONG_FORMAT_TITLE", "title"}, {XFMPC_PREFERENCES_SONG_FORMAT_ALBUM_TITLE, "XFMPC_PREFERENCES_SONG_FORMAT_ALBUM_TITLE", "album-title"}, {XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_TITLE, "XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_TITLE", "artist-title"}, {XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_TITLE_DATE, "XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_TITLE_DATE", "artist-title-date"}, {XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_ALBUM_TITLE, "XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_ALBUM_TITLE", "artist-album-title"}, {XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_ALBUM_TRACK_TITLE, "XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_ALBUM_TRACK_TITLE", "artist-album-track-title"}, {XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_FORMAT, "XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_FORMAT", "custom-format"}, {0, NULL, NULL}};
	GType xfmpc_preferences_song_format_type_id;
	xfmpc_preferences_song_format_type_id = g_enum_register_static ("XfmpcPreferencesSongFormat", values);
	return xfmpc_preferences_song_format_type_id;
}

GType
xfmpc_preferences_song_format_get_type (void)
{
	static volatile gsize xfmpc_preferences_song_format_type_id__once = 0;
	if (g_once_init_enter (&xfmpc_preferences_song_format_type_id__once)) {
		GType xfmpc_preferences_song_format_type_id;
		xfmpc_preferences_song_format_type_id = xfmpc_preferences_song_format_get_type_once ();
		g_once_init_leave (&xfmpc_preferences_song_format_type_id__once, xfmpc_preferences_song_format_type_id);
	}
	return xfmpc_preferences_song_format_type_id__once;
}

XfmpcPreferences*
xfmpc_preferences_construct (GType object_type)
{
	XfmpcPreferences * self = NULL;
	self = (XfmpcPreferences*) g_object_new (object_type, NULL);
	xfmpc_preferences_load (self);
	return self;
}

XfmpcPreferences*
xfmpc_preferences_new (void)
{
	return xfmpc_preferences_construct (XFMPC_TYPE_PREFERENCES);
}

XfmpcPreferences*
xfmpc_preferences_get_default (void)
{
	XfmpcPreferences* _tmp0_;
	XfmpcPreferences* _tmp4_;
	XfmpcPreferences* result;
	_tmp0_ = xfmpc_preferences_preferences;
	if (_tmp0_ == NULL) {
		XfmpcPreferences* _tmp1_;
		XfmpcPreferences* _tmp2_;
		_tmp1_ = xfmpc_preferences_new ();
		_g_object_unref0 (xfmpc_preferences_preferences);
		xfmpc_preferences_preferences = _tmp1_;
		_tmp2_ = xfmpc_preferences_preferences;
		g_object_add_weak_pointer ((GObject*) _tmp2_, &xfmpc_preferences_preferences);
	} else {
		XfmpcPreferences* _tmp3_;
		_tmp3_ = xfmpc_preferences_preferences;
		g_object_ref ((GObject*) _tmp3_);
	}
	_tmp4_ = xfmpc_preferences_preferences;
	result = _tmp4_;
	return result;
}

static void
xfmpc_preferences_load (XfmpcPreferences* self)
{
	XfceRc* rc = NULL;
	XfceRc* _tmp0_;
	XfceRc* _tmp1_;
	XfceRc* _tmp2_;
	gchar* entry = NULL;
	GValue src = {0};
	GValue _tmp3_ = {0};
	GTypeClass* _tmp4_;
	guint _tmp5_ = 0;
	GParamSpec** _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "xfce4/xfmpcrc", FALSE);
	rc = _tmp0_;
	_tmp1_ = rc;
	if (_tmp1_ == NULL) {
		g_warning ("preferences.vala:152: Failed to load the preferences");
		_xfce_rc_close0 (rc);
		return;
	}
	g_object_freeze_notify ((GObject*) self);
	_tmp2_ = rc;
	xfce_rc_set_group (_tmp2_, "Configuration");
	g_value_init (&_tmp3_, G_TYPE_STRING);
	src = _tmp3_;
	_tmp4_ = g_type_class_peek (G_TYPE_FROM_INSTANCE ((GObject*) self));
	_tmp6_ = g_object_class_list_properties ((GObjectClass*) _tmp4_, &_tmp5_);
	{
		GParamSpec** spec_collection = NULL;
		gint spec_collection_length1 = 0;
		gint _spec_collection_size_ = 0;
		gint spec_it = 0;
		spec_collection = _tmp6_;
		spec_collection_length1 = _tmp5_;
		for (spec_it = 0; spec_it < spec_collection_length1; spec_it = spec_it + 1) {
			GParamSpec* spec = NULL;
			spec = spec_collection[spec_it];
			{
				XfceRc* _tmp7_;
				GParamSpec* _tmp8_;
				const gchar* _tmp9_;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				const gchar* _tmp12_;
				const gchar* _tmp13_;
				GParamSpec* _tmp14_;
				const gchar* _tmp15_;
				GValue _tmp16_;
				_tmp7_ = rc;
				_tmp8_ = spec;
				_tmp9_ = g_param_spec_get_nick (_tmp8_);
				_tmp10_ = xfce_rc_read_entry (_tmp7_, _tmp9_, "");
				_tmp11_ = g_strdup (_tmp10_);
				_g_free0 (entry);
				entry = _tmp11_;
				_tmp12_ = entry;
				if (g_strcmp0 (_tmp12_, "") == 0) {
					continue;
				}
				_tmp13_ = entry;
				g_value_set_static_string (&src, _tmp13_);
				_tmp14_ = spec;
				_tmp15_ = _tmp14_->name;
				_tmp16_ = src;
				g_object_set_property ((GObject*) self, _tmp15_, &_tmp16_);
			}
		}
		spec_collection = (g_free (spec_collection), NULL);
	}
	g_object_thaw_notify ((GObject*) self);
	G_IS_VALUE (&src) ? (g_value_unset (&src), NULL) : NULL;
	_g_free0 (entry);
	_xfce_rc_close0 (rc);
}

static void
xfmpc_preferences_store (XfmpcPreferences* self)
{
	XfceRc* rc = NULL;
	XfceRc* _tmp0_;
	XfceRc* _tmp1_;
	XfceRc* _tmp2_;
	gchar* entry = NULL;
	GValue dst = {0};
	GValue _tmp3_ = {0};
	GTypeClass* _tmp4_;
	guint _tmp5_ = 0;
	GParamSpec** _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "xfce4/xfmpcrc", FALSE);
	rc = _tmp0_;
	_tmp1_ = rc;
	if (_tmp1_ == NULL) {
		g_warning ("preferences.vala:180: Failed to save the preferences");
		_xfce_rc_close0 (rc);
		return;
	}
	_tmp2_ = rc;
	xfce_rc_set_group (_tmp2_, "Configuration");
	g_value_init (&_tmp3_, G_TYPE_STRING);
	dst = _tmp3_;
	_tmp4_ = g_type_class_peek (G_TYPE_FROM_INSTANCE ((GObject*) self));
	_tmp6_ = g_object_class_list_properties ((GObjectClass*) _tmp4_, &_tmp5_);
	{
		GParamSpec** spec_collection = NULL;
		gint spec_collection_length1 = 0;
		gint _spec_collection_size_ = 0;
		gint spec_it = 0;
		spec_collection = _tmp6_;
		spec_collection_length1 = _tmp5_;
		for (spec_it = 0; spec_it < spec_collection_length1; spec_it = spec_it + 1) {
			GParamSpec* spec = NULL;
			spec = spec_collection[spec_it];
			{
				GParamSpec* _tmp7_;
				const gchar* _tmp14_;
				gchar* _tmp15_;
				const gchar* _tmp16_;
				_tmp7_ = spec;
				if (_tmp7_->value_type == G_TYPE_STRING) {
					GParamSpec* _tmp8_;
					const gchar* _tmp9_;
					_tmp8_ = spec;
					_tmp9_ = _tmp8_->name;
					g_object_get_property ((GObject*) self, _tmp9_, &dst);
				} else {
					GValue src = {0};
					GParamSpec* _tmp10_;
					GValue _tmp11_ = {0};
					GParamSpec* _tmp12_;
					const gchar* _tmp13_;
					_tmp10_ = spec;
					g_value_init (&_tmp11_, _tmp10_->value_type);
					src = _tmp11_;
					_tmp12_ = spec;
					_tmp13_ = _tmp12_->name;
					g_object_get_property ((GObject*) self, _tmp13_, &src);
					g_value_transform (&src, &dst);
					G_IS_VALUE (&src) ? (g_value_unset (&src), NULL) : NULL;
				}
				_tmp14_ = g_value_get_string (&dst);
				_tmp15_ = g_strdup (_tmp14_);
				_g_free0 (entry);
				entry = _tmp15_;
				_tmp16_ = entry;
				if (_tmp16_ != NULL) {
					XfceRc* _tmp17_;
					GParamSpec* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					_tmp17_ = rc;
					_tmp18_ = spec;
					_tmp19_ = g_param_spec_get_nick (_tmp18_);
					_tmp20_ = entry;
					xfce_rc_write_entry (_tmp17_, _tmp19_, _tmp20_);
				}
			}
		}
		spec_collection = (g_free (spec_collection), NULL);
	}
	G_IS_VALUE (&dst) ? (g_value_unset (&dst), NULL) : NULL;
	_g_free0 (entry);
	_xfce_rc_close0 (rc);
}

gint
xfmpc_preferences_get_last_window_posx (XfmpcPreferences* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_last_window_posx;
	return result;
}

void
xfmpc_preferences_set_last_window_posx (XfmpcPreferences* self,
                                        gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_last_window_posx = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY]);
}

gint
xfmpc_preferences_get_last_window_posy (XfmpcPreferences* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_last_window_posy;
	return result;
}

void
xfmpc_preferences_set_last_window_posy (XfmpcPreferences* self,
                                        gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_last_window_posy = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY]);
}

gint
xfmpc_preferences_get_last_window_width (XfmpcPreferences* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_last_window_width;
	return result;
}

void
xfmpc_preferences_set_last_window_width (XfmpcPreferences* self,
                                         gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_last_window_width = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY]);
}

gint
xfmpc_preferences_get_last_window_height (XfmpcPreferences* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_last_window_height;
	return result;
}

void
xfmpc_preferences_set_last_window_height (XfmpcPreferences* self,
                                          gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_last_window_height = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY]);
}

gboolean
xfmpc_preferences_get_last_window_state_sticky (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_last_window_state_sticky;
	return result;
}

void
xfmpc_preferences_set_last_window_state_sticky (XfmpcPreferences* self,
                                                gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_last_window_state_sticky = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY]);
}

gboolean
xfmpc_preferences_get_playlist_autocenter (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_playlist_autocenter;
	return result;
}

void
xfmpc_preferences_set_playlist_autocenter (XfmpcPreferences* self,
                                           gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_playlist_autocenter = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY]);
}

gboolean
xfmpc_preferences_get_playlist_show_position (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_playlist_show_position;
	return result;
}

void
xfmpc_preferences_set_playlist_show_position (XfmpcPreferences* self,
                                              gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_playlist_show_position = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY]);
}

const gchar*
xfmpc_preferences_get_mpd_hostname (XfmpcPreferences* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_mpd_hostname;
	result = _tmp0_;
	return result;
}

void
xfmpc_preferences_set_mpd_hostname (XfmpcPreferences* self,
                                    const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_mpd_hostname);
	self->priv->_mpd_hostname = _tmp0_;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY]);
}

gint
xfmpc_preferences_get_mpd_port (XfmpcPreferences* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_mpd_port;
	return result;
}

void
xfmpc_preferences_set_mpd_port (XfmpcPreferences* self,
                                gint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_mpd_port = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_PORT_PROPERTY]);
}

const gchar*
xfmpc_preferences_get_mpd_password (XfmpcPreferences* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_mpd_password;
	result = _tmp0_;
	return result;
}

void
xfmpc_preferences_set_mpd_password (XfmpcPreferences* self,
                                    const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_mpd_password);
	self->priv->_mpd_password = _tmp0_;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY]);
}

gboolean
xfmpc_preferences_get_mpd_use_defaults (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_mpd_use_defaults;
	return result;
}

void
xfmpc_preferences_set_mpd_use_defaults (XfmpcPreferences* self,
                                        gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_mpd_use_defaults = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY]);
}

gboolean
xfmpc_preferences_get_show_status_icon (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_status_icon;
	return result;
}

void
xfmpc_preferences_set_show_status_icon (XfmpcPreferences* self,
                                        gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_status_icon = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY]);
}

gboolean
xfmpc_preferences_get_show_statusbar (XfmpcPreferences* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_show_statusbar;
	return result;
}

void
xfmpc_preferences_set_show_statusbar (XfmpcPreferences* self,
                                      gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_show_statusbar = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY]);
}

XfmpcPreferencesSongFormat
xfmpc_preferences_get_song_format (XfmpcPreferences* self)
{
	XfmpcPreferencesSongFormat result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_song_format;
	return result;
}

void
xfmpc_preferences_set_song_format (XfmpcPreferences* self,
                                   XfmpcPreferencesSongFormat value)
{
	g_return_if_fail (self != NULL);
	self->priv->_song_format = value;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY]);
}

const gchar*
xfmpc_preferences_get_song_format_custom (XfmpcPreferences* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_song_format_custom;
	result = _tmp0_;
	return result;
}

void
xfmpc_preferences_set_song_format_custom (XfmpcPreferences* self,
                                          const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_song_format_custom);
	self->priv->_song_format_custom = _tmp0_;
	xfmpc_preferences_store (self);
	g_object_notify_by_pspec ((GObject *) self, xfmpc_preferences_properties[XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY]);
}

static GObject *
xfmpc_preferences_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	XfmpcPreferences * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	parent_class = G_OBJECT_CLASS (xfmpc_preferences_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XFMPC_TYPE_PREFERENCES, XfmpcPreferences);
	self->priv->_last_window_posx = 200;
	self->priv->_last_window_posy = 100;
	self->priv->_last_window_width = 330;
	self->priv->_last_window_height = 330;
	self->priv->_last_window_state_sticky = FALSE;
	self->priv->_playlist_autocenter = TRUE;
	self->priv->_playlist_show_position = FALSE;
	_tmp0_ = g_strdup ("localhost");
	_g_free0 (self->priv->_mpd_hostname);
	self->priv->_mpd_hostname = _tmp0_;
	self->priv->_mpd_port = 6600;
	_tmp1_ = g_strdup ("");
	_g_free0 (self->priv->_mpd_password);
	self->priv->_mpd_password = _tmp1_;
	self->priv->_mpd_use_defaults = TRUE;
	self->priv->_show_status_icon = FALSE;
	self->priv->_show_statusbar = TRUE;
	self->priv->_song_format = XFMPC_PREFERENCES_SONG_FORMAT_ARTIST_TITLE;
	_tmp2_ = g_strdup ("%a - %t");
	_g_free0 (self->priv->_song_format_custom);
	self->priv->_song_format_custom = _tmp2_;
	return obj;
}

static void
xfmpc_preferences_class_init (XfmpcPreferencesClass * klass,
                              gpointer klass_data)
{
	xfmpc_preferences_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XfmpcPreferences_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xfmpc_preferences_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xfmpc_preferences_set_property;
	G_OBJECT_CLASS (klass)->constructor = xfmpc_preferences_constructor;
	G_OBJECT_CLASS (klass)->finalize = xfmpc_preferences_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY] = g_param_spec_int ("last-window-posx", "last-window-posx", "last-window-posx", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY] = g_param_spec_int ("last-window-posy", "last-window-posy", "last-window-posy", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY] = g_param_spec_int ("last-window-width", "last-window-width", "last-window-width", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY] = g_param_spec_int ("last-window-height", "last-window-height", "last-window-height", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY] = g_param_spec_boolean ("last-window-state-sticky", "last-window-state-sticky", "last-window-state-sticky", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY] = g_param_spec_boolean ("playlist-autocenter", "playlist-autocenter", "playlist-autocenter", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY] = g_param_spec_boolean ("playlist-show-position", "playlist-show-position", "playlist-show-position", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY] = g_param_spec_string ("mpd-hostname", "mpd-hostname", "mpd-hostname", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_MPD_PORT_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_PORT_PROPERTY] = g_param_spec_int ("mpd-port", "mpd-port", "mpd-port", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY] = g_param_spec_string ("mpd-password", "mpd-password", "mpd-password", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY] = g_param_spec_boolean ("mpd-use-defaults", "mpd-use-defaults", "mpd-use-defaults", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY] = g_param_spec_boolean ("show-status-icon", "show-status-icon", "show-status-icon", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY] = g_param_spec_boolean ("show-statusbar", "show-statusbar", "show-statusbar", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY] = g_param_spec_enum ("song-format", "song-format", "song-format", XFMPC_PREFERENCES_TYPE_SONG_FORMAT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY, xfmpc_preferences_properties[XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY] = g_param_spec_string ("song-format-custom", "song-format-custom", "song-format-custom", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
xfmpc_preferences_instance_init (XfmpcPreferences * self,
                                 gpointer klass)
{
	self->priv = xfmpc_preferences_get_instance_private (self);
}

static void
xfmpc_preferences_finalize (GObject * obj)
{
	XfmpcPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XFMPC_TYPE_PREFERENCES, XfmpcPreferences);
	_g_free0 (self->priv->_mpd_hostname);
	_g_free0 (self->priv->_mpd_password);
	_g_free0 (self->priv->_song_format_custom);
	G_OBJECT_CLASS (xfmpc_preferences_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
xfmpc_preferences_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XfmpcPreferencesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xfmpc_preferences_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XfmpcPreferences), 0, (GInstanceInitFunc) xfmpc_preferences_instance_init, NULL };
	GType xfmpc_preferences_type_id;
	xfmpc_preferences_type_id = g_type_register_static (G_TYPE_OBJECT, "XfmpcPreferences", &g_define_type_info, 0);
	XfmpcPreferences_private_offset = g_type_add_instance_private (xfmpc_preferences_type_id, sizeof (XfmpcPreferencesPrivate));
	return xfmpc_preferences_type_id;
}

GType
xfmpc_preferences_get_type (void)
{
	static volatile gsize xfmpc_preferences_type_id__once = 0;
	if (g_once_init_enter (&xfmpc_preferences_type_id__once)) {
		GType xfmpc_preferences_type_id;
		xfmpc_preferences_type_id = xfmpc_preferences_get_type_once ();
		g_once_init_leave (&xfmpc_preferences_type_id__once, xfmpc_preferences_type_id);
	}
	return xfmpc_preferences_type_id__once;
}

static void
_vala_xfmpc_preferences_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	XfmpcPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XFMPC_TYPE_PREFERENCES, XfmpcPreferences);
	switch (property_id) {
		case XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY:
		g_value_set_int (value, xfmpc_preferences_get_last_window_posx (self));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY:
		g_value_set_int (value, xfmpc_preferences_get_last_window_posy (self));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY:
		g_value_set_int (value, xfmpc_preferences_get_last_window_width (self));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY:
		g_value_set_int (value, xfmpc_preferences_get_last_window_height (self));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_last_window_state_sticky (self));
		break;
		case XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_playlist_autocenter (self));
		break;
		case XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_playlist_show_position (self));
		break;
		case XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY:
		g_value_set_string (value, xfmpc_preferences_get_mpd_hostname (self));
		break;
		case XFMPC_PREFERENCES_MPD_PORT_PROPERTY:
		g_value_set_int (value, xfmpc_preferences_get_mpd_port (self));
		break;
		case XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY:
		g_value_set_string (value, xfmpc_preferences_get_mpd_password (self));
		break;
		case XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_mpd_use_defaults (self));
		break;
		case XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_show_status_icon (self));
		break;
		case XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY:
		g_value_set_boolean (value, xfmpc_preferences_get_show_statusbar (self));
		break;
		case XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY:
		g_value_set_enum (value, xfmpc_preferences_get_song_format (self));
		break;
		case XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY:
		g_value_set_string (value, xfmpc_preferences_get_song_format_custom (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xfmpc_preferences_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	XfmpcPreferences * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XFMPC_TYPE_PREFERENCES, XfmpcPreferences);
	switch (property_id) {
		case XFMPC_PREFERENCES_LAST_WINDOW_POSX_PROPERTY:
		xfmpc_preferences_set_last_window_posx (self, g_value_get_int (value));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_POSY_PROPERTY:
		xfmpc_preferences_set_last_window_posy (self, g_value_get_int (value));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_WIDTH_PROPERTY:
		xfmpc_preferences_set_last_window_width (self, g_value_get_int (value));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_HEIGHT_PROPERTY:
		xfmpc_preferences_set_last_window_height (self, g_value_get_int (value));
		break;
		case XFMPC_PREFERENCES_LAST_WINDOW_STATE_STICKY_PROPERTY:
		xfmpc_preferences_set_last_window_state_sticky (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_PLAYLIST_AUTOCENTER_PROPERTY:
		xfmpc_preferences_set_playlist_autocenter (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_PLAYLIST_SHOW_POSITION_PROPERTY:
		xfmpc_preferences_set_playlist_show_position (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_MPD_HOSTNAME_PROPERTY:
		xfmpc_preferences_set_mpd_hostname (self, g_value_get_string (value));
		break;
		case XFMPC_PREFERENCES_MPD_PORT_PROPERTY:
		xfmpc_preferences_set_mpd_port (self, g_value_get_int (value));
		break;
		case XFMPC_PREFERENCES_MPD_PASSWORD_PROPERTY:
		xfmpc_preferences_set_mpd_password (self, g_value_get_string (value));
		break;
		case XFMPC_PREFERENCES_MPD_USE_DEFAULTS_PROPERTY:
		xfmpc_preferences_set_mpd_use_defaults (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_SHOW_STATUS_ICON_PROPERTY:
		xfmpc_preferences_set_show_status_icon (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_SHOW_STATUSBAR_PROPERTY:
		xfmpc_preferences_set_show_statusbar (self, g_value_get_boolean (value));
		break;
		case XFMPC_PREFERENCES_SONG_FORMAT_PROPERTY:
		xfmpc_preferences_set_song_format (self, g_value_get_enum (value));
		break;
		case XFMPC_PREFERENCES_SONG_FORMAT_CUSTOM_PROPERTY:
		xfmpc_preferences_set_song_format_custom (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

