/* Generated by GOB (v2.0.20)   (do not edit directly) */

/* End world hunger, donate to the World Food Programme, http://www.wfp.org */

#define GOB_VERSION_MAJOR 2
#define GOB_VERSION_MINOR 0
#define GOB_VERSION_PATCHLEVEL 20

#define selfp (self->_priv)

#include <string.h> /* memset() */

#include "gmpc-profiles.h"

#include "gmpc-profiles-private.h"

#ifdef G_LIKELY
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
#else /* ! G_LIKELY */
#define ___GOB_LIKELY(expr) (expr)
#define ___GOB_UNLIKELY(expr) (expr)
#endif /* G_LIKELY */
/* self casting macros */
#define SELF(x) GMPC_PROFILES(x)
#define SELF_CONST(x) GMPC_PROFILES_CONST(x)
#define IS_SELF(x) GMPC_IS_PROFILES(x)
#define TYPE_SELF GMPC_TYPE_PROFILES
#define SELF_CLASS(x) GMPC_PROFILES_CLASS(x)

#define SELF_GET_CLASS(x) GMPC_PROFILES_GET_CLASS(x)

/* self typedefs */
typedef GmpcProfiles Self;
typedef GmpcProfilesClass SelfClass;

/* here are local prototypes */
static void gmpc_profiles_class_init (GmpcProfilesClass * c) G_GNUC_UNUSED;
#line 79 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void gmpc_profiles_connect_to_profile_button (GmpcProfiles * self, GtkWidget * button) G_GNUC_UNUSED;
#line 42 "gmpc-profiles.c"
static void ___real_gmpc_profiles_changed (GmpcProfiles * self, const int changed, const int col, const char * id);
#line 140 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void gmpc_profiles_init (GmpcProfiles * self) G_GNUC_UNUSED;
#line 46 "gmpc-profiles.c"
#line 167 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void gmpc_profiles_add_default (GmpcProfiles * self) G_GNUC_UNUSED;
#line 49 "gmpc-profiles.c"
#line 222 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void gmpc_profiles_load_from_config (GmpcProfiles * self) G_GNUC_UNUSED;
#line 52 "gmpc-profiles.c"
#line 253 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static Profile * gmpc_profiles_get_profile (GmpcProfiles * self, const gchar * id) G_GNUC_UNUSED;
#line 55 "gmpc-profiles.c"
static void ___real_gmpc_profiles_set_current (GmpcProfiles * self, const gchar * id);
#line 650 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void ___21_gmpc_profiles_finalize (GObject * obj) G_GNUC_UNUSED;
#line 59 "gmpc-profiles.c"

/*
 * Signal connection wrapper macro shortcuts
 */
#define self_connect__changed(object,func,data)	gmpc_profiles_connect__changed((object),(func),(data))
#define self_connect_after__changed(object,func,data)	gmpc_profiles_connect_after__changed((object),(func),(data))
#define self_connect_data__changed(object,func,data,destroy_data,flags)	gmpc_profiles_connect_data__changed((object),(func),(data),(destroy_data),(flags))
#define self_connect__set_current(object,func,data)	gmpc_profiles_connect__set_current((object),(func),(data))
#define self_connect_after__set_current(object,func,data)	gmpc_profiles_connect_after__set_current((object),(func),(data))
#define self_connect_data__set_current(object,func,data,destroy_data,flags)	gmpc_profiles_connect_data__set_current((object),(func),(data),(destroy_data),(flags))

typedef void  (*___Sig1) (GmpcProfiles *, gint , gint , gchar *, gpointer);

static void
___marshal_Sig1 (GClosure *closure,
	GValue *return_value G_GNUC_UNUSED,
	guint n_param_values,
	const GValue *param_values,
	gpointer invocation_hint G_GNUC_UNUSED,
	gpointer marshal_data)
{
	register ___Sig1 callback;
	register GCClosure *cc = (GCClosure*) closure;
	register gpointer data1, data2;

	g_return_if_fail (n_param_values == 4);

	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = g_value_peek_pointer (param_values + 0);
	} else {
		data1 = g_value_peek_pointer (param_values + 0);
		data2 = closure->data;
	}

	callback = (___Sig1) (marshal_data != NULL ? marshal_data : cc->callback);

	callback ((GmpcProfiles *)data1,
		(gint ) g_value_get_int (param_values + 1),
		(gint ) g_value_get_int (param_values + 2),
		(gchar *) g_value_get_string (param_values + 3),
		data2);
}


typedef void  (*___Sig2) (GmpcProfiles *, gchar *, gpointer);

static void
___marshal_Sig2 (GClosure *closure,
	GValue *return_value G_GNUC_UNUSED,
	guint n_param_values,
	const GValue *param_values,
	gpointer invocation_hint G_GNUC_UNUSED,
	gpointer marshal_data)
{
	register ___Sig2 callback;
	register GCClosure *cc = (GCClosure*) closure;
	register gpointer data1, data2;

	g_return_if_fail (n_param_values == 2);

	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = g_value_peek_pointer (param_values + 0);
	} else {
		data1 = g_value_peek_pointer (param_values + 0);
		data2 = closure->data;
	}

	callback = (___Sig2) (marshal_data != NULL ? marshal_data : cc->callback);

	callback ((GmpcProfiles *)data1,
		(gchar *) g_value_get_string (param_values + 1),
		data2);
}


enum {
	CHANGED_SIGNAL,
	SET_CURRENT_SIGNAL,
	LAST_SIGNAL
};

static guint object_signals[LAST_SIGNAL] = {0};

/* pointer to the class of our parent */
static GObjectClass *parent_class = NULL;

/* Short form macros */
#define self_get_number_of_profiles gmpc_profiles_get_number_of_profiles
#define self_connect_to_profile_button gmpc_profiles_connect_to_profile_button
#define self_changed gmpc_profiles_changed
#define self_new gmpc_profiles_new
#define self_add_default gmpc_profiles_add_default
#define self_free_profile gmpc_profiles_free_profile
#define self_new_profile gmpc_profiles_new_profile
#define self_load_from_config gmpc_profiles_load_from_config
#define self_get_profile gmpc_profiles_get_profile
#define self_get_hostname gmpc_profiles_get_hostname
#define self_get_name gmpc_profiles_get_name
#define self_get_id gmpc_profiles_get_id
#define self_get_password gmpc_profiles_get_password
#define self_get_music_directory gmpc_profiles_get_music_directory
#define self_get_db_update_time gmpc_profiles_get_db_update_time
#define self_get_port gmpc_profiles_get_port
#define self_get_do_auth gmpc_profiles_get_do_auth
#define self_create_new_item gmpc_profiles_create_new_item
#define self_create_new_item_with_name gmpc_profiles_create_new_item_with_name
#define self_remove_item gmpc_profiles_remove_item
#define self_get_current gmpc_profiles_get_current
#define self_set_current gmpc_profiles_set_current
#define self_get_profiles_ids gmpc_profiles_get_profiles_ids
#define self_set_name gmpc_profiles_set_name
#define self_set_hostname gmpc_profiles_set_hostname
#define self_set_password gmpc_profiles_set_password
#define self_set_port gmpc_profiles_set_port
#define self_set_music_directory gmpc_profiles_set_music_directory
#define self_set_db_update_time gmpc_profiles_set_db_update_time
#define self_set_do_auth gmpc_profiles_set_do_auth
#define self_has_profile gmpc_profiles_has_profile
#define self_set_profile_from_name gmpc_profiles_set_profile_from_name
GType
gmpc_profiles_get_type (void)
{
	static GType type = 0;

	if ___GOB_UNLIKELY(type == 0) {
		static const GTypeInfo info = {
			sizeof (GmpcProfilesClass),
			(GBaseInitFunc) NULL,
			(GBaseFinalizeFunc) NULL,
			(GClassInitFunc) gmpc_profiles_class_init,
			(GClassFinalizeFunc) NULL,
			NULL /* class_data */,
			sizeof (GmpcProfiles),
			0 /* n_preallocs */,
			(GInstanceInitFunc) gmpc_profiles_init,
			NULL
		};

		type = g_type_register_static (G_TYPE_OBJECT, "GmpcProfiles", &info, (GTypeFlags)0);
	}

	return type;
}

/* a macro for creating a new object of our type */
#define GET_NEW ((GmpcProfiles *)g_object_new(gmpc_profiles_get_type(), NULL))

/* a function for creating a new object of our type */
#include <stdarg.h>
static GmpcProfiles * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
static GmpcProfiles *
GET_NEW_VARG (const char *first, ...)
{
	GmpcProfiles *ret;
	va_list ap;
	va_start (ap, first);
	ret = (GmpcProfiles *)g_object_new_valist (gmpc_profiles_get_type (), first, ap);
	va_end (ap);
	return ret;
}


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "Gmpc:Profiles::finalize"
	GmpcProfiles *self G_GNUC_UNUSED = GMPC_PROFILES (obj_self);
	gpointer priv G_GNUC_UNUSED = self->_priv;
#line 650 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	___21_gmpc_profiles_finalize(obj_self);
#line 232 "gmpc-profiles.c"
}
#undef __GOB_FUNCTION__

static void 
gmpc_profiles_class_init (GmpcProfilesClass * c G_GNUC_UNUSED)
{
#define __GOB_FUNCTION__ "Gmpc:Profiles::class_init"
	GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;

	g_type_class_add_private(c,sizeof(GmpcProfilesPrivate));

	parent_class = g_type_class_ref (G_TYPE_OBJECT);

	object_signals[CHANGED_SIGNAL] =
		g_signal_new ("changed",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (GmpcProfilesClass, changed),
			NULL, NULL,
			___marshal_Sig1,
			G_TYPE_NONE, 3,
			G_TYPE_INT,
			G_TYPE_INT,
			G_TYPE_STRING);
	if ___GOB_UNLIKELY(sizeof(const int ) != sizeof(gint ) || sizeof(const int ) != sizeof(gint ) || sizeof(const char * ) != sizeof(gchar *) || parent_class == NULL /* avoid warning */) {
		g_error("/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob line 92: Type mismatch of \"changed\" signal signature");
	}
	object_signals[SET_CURRENT_SIGNAL] =
		g_signal_new ("set_current",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (GmpcProfilesClass, set_current),
			NULL, NULL,
			___marshal_Sig2,
			G_TYPE_NONE, 1,
			G_TYPE_STRING);
	if ___GOB_UNLIKELY(sizeof(const gchar * ) != sizeof(gchar *) || parent_class == NULL /* avoid warning */) {
		g_error("/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob line 475: Type mismatch of \"set_current\" signal signature");
	}

#line 92 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	c->changed = ___real_gmpc_profiles_changed;
#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	c->set_current = ___real_gmpc_profiles_set_current;
#line 650 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_object_class->finalize = ___finalize;
#line 279 "gmpc-profiles.c"
}
#undef __GOB_FUNCTION__
#line 140 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
gmpc_profiles_init (GmpcProfiles * self G_GNUC_UNUSED)
{
#line 286 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::init"
	self->_priv = G_TYPE_INSTANCE_GET_PRIVATE(self,GMPC_TYPE_PROFILES,GmpcProfilesPrivate);
#line 66 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	self->_priv->profiles = NULL;
#line 291 "gmpc-profiles.c"
#line 67 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	self->_priv->list = NULL;
#line 294 "gmpc-profiles.c"
#line 68 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	self->_priv->num_profiles = 0;
#line 297 "gmpc-profiles.c"
 {
#line 141 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"

      gchar *url;
      /**
       * Get Profile
       */
      url = gmpc_get_user_path("profiles.cfg");
      self->_priv->profiles = cfg_open(url);
      if(self->_priv->profiles == NULL)
      {
          /**
           * Show gtk error message and quit 
           */
          g_log(LOG_DOMAIN, G_LOG_LEVEL_ERROR,"Failed to save/load Profile file:\n%s\n",url);
          abort();
      }
      g_free(url);
      self_load_from_config(self);
      if(self->_priv->num_profiles == 0)
      {
          self_add_default(self);
          self_load_from_config(self);
      }
  
#line 323 "gmpc-profiles.c"
 }
}
#undef __GOB_FUNCTION__


#line 71 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
int 
gmpc_profiles_get_number_of_profiles (GmpcProfiles * self)
{
#line 333 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_number_of_profiles"
#line 71 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (int )0);
#line 71 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (int )0);
#line 339 "gmpc-profiles.c"
{
#line 74 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
        return self->_priv->num_profiles;
    }}
#line 345 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 79 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
gmpc_profiles_connect_to_profile_button (GmpcProfiles * self, GtkWidget * button)
{
#line 352 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::connect_to_profile_button"
#line 79 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 79 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 358 "gmpc-profiles.c"
{
#line 82 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
        gchar *id = g_object_get_data(G_OBJECT(button), "profile-id");
        if(id)
        {
            self_set_current(self, id);
            mpd_disconnect(connection);
            connect_to_mpd();
        }
    }}
#line 370 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 92 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_changed (GmpcProfiles * self, const int changed, const int col, const char * id)
{
#line 377 "gmpc-profiles.c"
	GValue ___param_values[4];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 92 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 92 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 388 "gmpc-profiles.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	___param_values[1].g_type = 0;
	g_value_init (&___param_values[1], G_TYPE_INT);
	g_value_set_int (&___param_values[1], (gint ) changed);

	___param_values[2].g_type = 0;
	g_value_init (&___param_values[2], G_TYPE_INT);
	g_value_set_int (&___param_values[2], (gint ) col);

	___param_values[3].g_type = 0;
	g_value_init (&___param_values[3], G_TYPE_STRING);
	g_value_set_static_string (&___param_values[3], (gchar *) id);

	g_signal_emitv (___param_values,
		object_signals[CHANGED_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
	g_value_unset (&___param_values[1]);
	g_value_unset (&___param_values[2]);
	g_value_unset (&___param_values[3]);
}
#line 92 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
___real_gmpc_profiles_changed (GmpcProfiles * self G_GNUC_UNUSED, const int changed, const int col, const char * id)
{
#line 420 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::changed"
{
#line 95 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
	if(changed == PROFILE_ADDED)
    {
        GtkWidget *connect_button = gtk_button_new_from_stock(GTK_STOCK_CONNECT);
        gchar *message = g_markup_printf_escaped("<b>%s:</b> '%s'", _("Added profile"),self_get_name(self,id));
        playlist3_show_error_message(message, ERROR_INFO);

        g_object_set_data_full(G_OBJECT(connect_button), "profile-id", g_strdup(id), (GDestroyNotify)g_free);
        g_signal_connect_swapped(G_OBJECT(connect_button), "clicked", G_CALLBACK(self_connect_to_profile_button), self);
        playlist3_error_add_widget(connect_button);
        q_free(message);

        g_log(LOG_DOMAIN, G_LOG_LEVEL_DEBUG,"Item %s added\n", id);
    }
    else if(changed == PROFILE_REMOVED)
    {
		g_log(LOG_DOMAIN, G_LOG_LEVEL_DEBUG,"Item %s removed\n", id);
    }
	else if(changed == PROFILE_COL_CHANGED)
	{
        /* Disabled because of grand spamming charges */
    /*    
        gchar *message = g_markup_printf_escaped("<b>%s:</b> '%s'", _("Changed profile"),self_get_name(self,id));
        playlist3_show_error_message(message, ERROR_INFO);
        q_free(message);
        */
        g_log(LOG_DOMAIN, G_LOG_LEVEL_DEBUG,"Item %s changed col: %i\n", id, col);
    }
  }}
#line 453 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 129 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
GmpcProfiles * 
gmpc_profiles_new (void)
{
#line 460 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::new"
{
#line 132 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    return (GmpcProfiles *)GET_NEW;
  }}
#line 467 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

/**
 * gmpc_profiles_init:
 * 
 **/

#line 167 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
gmpc_profiles_add_default (GmpcProfiles * self)
{
#line 479 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::add_default"
#line 167 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 167 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 485 "gmpc-profiles.c"
{
#line 170 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    cfg_set_single_value_as_string(config, "connection", "currentprofile", "Default"); 
    cfg_set_single_value_as_string(self->_priv->profiles, "Default", "hostname", "localhost");
    cfg_set_single_value_as_string(self->_priv->profiles, "Default", "name", "Default");
    cfg_set_single_value_as_string(self->_priv->profiles, "Default", "password","");
    cfg_set_single_value_as_int(self->_priv->profiles, "Default", "portnumber",6600);
    cfg_set_single_value_as_int(self->_priv->profiles, "Default", "useauth",FALSE);

    cfg_set_single_value_as_string(self->_priv->profiles, "Default", "music directory","");
  }}
#line 498 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 185 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_free_profile (Profile * profile)
{
#line 505 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::free_profile"
{
#line 188 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    if(profile->name)
      g_free(profile->name);
    if(profile->id)
      g_free(profile->id);
    if(profile->hostname)
      g_free(profile->hostname);
    if(profile->password)
      g_free(profile->password); 
    if(profile->music_directory)
        g_free(profile->music_directory);

    profile->db_update_time = 0;
    g_free(profile);
  }}
#line 524 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 204 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
Profile * 
gmpc_profiles_new_profile (void)
{
#line 531 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::new_profile"
{
#line 207 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *retv = g_malloc0(sizeof(*retv));
    /* Init values */
    retv->name      = NULL;
    retv->id        = NULL;
    retv->password  = NULL;
    retv->hostname  = NULL;
    retv->port      = 6600;
    retv->do_auth   = FALSE; 
    retv->music_directory = NULL;
    retv->db_update_time = 0;

    return retv;
  }}
#line 549 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 222 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
gmpc_profiles_load_from_config (GmpcProfiles * self)
{
#line 556 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::load_from_config"
#line 222 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 222 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 562 "gmpc-profiles.c"
{
#line 225 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    conf_mult_obj *iter,*mult = cfg_get_class_list(self->_priv->profiles);
    /* free the old list */
    for(iter = mult;iter;iter = iter->next)
    {
      Profile *prof = self_new_profile();

      self->_priv->num_profiles++;
      self->_priv->list = g_realloc(self->_priv->list, (self->_priv->num_profiles+1)*sizeof(Profile *)); 
      self->_priv->list[self->_priv->num_profiles] = NULL;
      self->_priv->list[self->_priv->num_profiles-1] = prof;

      prof->id = g_strdup(iter->key);
      prof->name = cfg_get_single_value_as_string(self->_priv->profiles, prof->id, "name");
      prof->hostname = cfg_get_single_value_as_string(self->_priv->profiles, prof->id, "hostname");
      prof->password = cfg_get_single_value_as_string(self->_priv->profiles, prof->id, "password");
      prof->port = cfg_get_single_value_as_int(self->_priv->profiles, prof->id, "portnumber");
      prof->do_auth = cfg_get_single_value_as_int(self->_priv->profiles, prof->id, "useauth");

      prof->music_directory = cfg_get_single_value_as_string(self->_priv->profiles, prof->id, "music directory");
      prof->db_update_time = cfg_get_single_value_as_int_with_default(self->_priv->profiles, prof->id, "db update time",0);
    }
    cfg_free_multiple(mult);
  }}
#line 589 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 253 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static Profile * 
gmpc_profiles_get_profile (GmpcProfiles * self, const gchar * id)
{
#line 596 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_profile"
#line 253 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (Profile * )0);
#line 253 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (Profile * )0);
#line 253 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (Profile * )0);
#line 604 "gmpc-profiles.c"
{
#line 256 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    int i = 0;
    if(self->_priv->list)
    {
      for(i=0;self->_priv->list[i]; i++)
      {
        if(!strcmp(self->_priv->list[i]->id, id))
          return self->_priv->list[i];
      }
    } 
    return NULL;
  }}
#line 619 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 272 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gchar * 
gmpc_profiles_get_hostname (GmpcProfiles * self, const gchar * id)
{
#line 626 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_hostname"
#line 272 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gchar * )0);
#line 272 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gchar * )0);
#line 272 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (gchar * )0);
#line 634 "gmpc-profiles.c"
{
#line 275 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return NULL;
    return prof->hostname;
  }}
#line 643 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 284 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
const gchar * 
gmpc_profiles_get_name (GmpcProfiles * self, const gchar * id)
{
#line 650 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_name"
#line 284 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (const gchar * )0);
#line 284 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (const gchar * )0);
#line 284 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (const gchar * )0);
#line 658 "gmpc-profiles.c"
{
#line 287 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return NULL;
    return prof->name;
  }}
#line 667 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 296 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
const gchar * 
gmpc_profiles_get_id (GmpcProfiles * self, const gchar * id)
{
#line 674 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_id"
#line 296 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (const gchar * )0);
#line 296 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (const gchar * )0);
#line 296 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (const gchar * )0);
#line 682 "gmpc-profiles.c"
{
#line 299 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return NULL;
    return prof->id;
  }}
#line 691 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 308 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gchar * 
gmpc_profiles_get_password (GmpcProfiles * self, const gchar * id)
{
#line 698 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_password"
#line 308 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gchar * )0);
#line 308 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gchar * )0);
#line 308 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (gchar * )0);
#line 706 "gmpc-profiles.c"
{
#line 311 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return NULL;
    return prof->password;
  }}
#line 715 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 321 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
const gchar * 
gmpc_profiles_get_music_directory (GmpcProfiles * self, const gchar * id)
{
#line 722 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_music_directory"
#line 321 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (const gchar * )0);
#line 321 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (const gchar * )0);
#line 321 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (const gchar * )0);
#line 730 "gmpc-profiles.c"
{
#line 324 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return NULL;
    return prof->music_directory;
  }}
#line 739 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 333 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
int 
gmpc_profiles_get_db_update_time (GmpcProfiles * self, const gchar * id)
{
#line 746 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_db_update_time"
#line 333 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (int )0);
#line 333 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (int )0);
#line 333 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (int )0);
#line 754 "gmpc-profiles.c"
{
#line 336 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return 0;
    return prof->db_update_time;
  }}
#line 763 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 345 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
int 
gmpc_profiles_get_port (GmpcProfiles * self, const gchar * id)
{
#line 770 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_port"
#line 345 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (int )0);
#line 345 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (int )0);
#line 345 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (int )0);
#line 778 "gmpc-profiles.c"
{
#line 348 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return -1;
    return prof->port;
  }}
#line 787 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 358 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gboolean 
gmpc_profiles_get_do_auth (GmpcProfiles * self, const gchar * id)
{
#line 794 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_do_auth"
#line 358 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gboolean )0);
#line 358 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gboolean )0);
#line 358 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (gboolean )0);
#line 802 "gmpc-profiles.c"
{
#line 361 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return FALSE;
    return prof->do_auth;
  }}
#line 811 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 371 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gchar * 
gmpc_profiles_create_new_item (GmpcProfiles * self, const gchar * id)
{
#line 818 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::create_new_item"
#line 371 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gchar * )0);
#line 371 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gchar * )0);
#line 824 "gmpc-profiles.c"
{
#line 374 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
        return self_create_new_item_with_name(self, id, "New Profile");
  }}
#line 830 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 377 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gchar * 
gmpc_profiles_create_new_item_with_name (GmpcProfiles * self, const gchar * id, const gchar * name)
{
#line 837 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::create_new_item_with_name"
#line 377 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gchar * )0);
#line 377 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gchar * )0);
#line 843 "gmpc-profiles.c"
{
#line 380 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = g_malloc0(sizeof(*prof));
    if(!id)
      prof->id = g_strdup_printf("%u",g_random_int());
    else
      prof->id = g_strdup(id);
    if(!name)
        prof->name = g_strdup("New Profile");
    else
        prof->name = g_strdup(name);
    prof->hostname = g_strdup("localhost");
    prof->password= g_strdup("");
    prof->port = 6600;
    prof->do_auth = 0;
   
	/* safe this to the config file */ 
    cfg_set_single_value_as_string(self->_priv->profiles, prof->id, "name", prof->name);
    cfg_set_single_value_as_string(self->_priv->profiles, prof->id, "hostname", prof->hostname);
    cfg_set_single_value_as_string(self->_priv->profiles, prof->id, "password", prof->password);
    cfg_set_single_value_as_int(self->_priv->profiles, prof->id, "portnumber", prof->port);
    cfg_set_single_value_as_int(self->_priv->profiles, prof->id, "useauth", prof->do_auth);
    cfg_set_single_value_as_string(self->_priv->profiles, prof->id, "music directory", prof->music_directory);

    cfg_get_single_value_as_int_with_default(self->_priv->profiles, prof->id, "db update time",(int)(prof->db_update_time));

    self->_priv->num_profiles++;
    self->_priv->list = g_realloc(self->_priv->list, (self->_priv->num_profiles+1)*sizeof(Profile *));     
    self->_priv->list[self->_priv->num_profiles] = NULL;
    self->_priv->list[self->_priv->num_profiles-1] = prof;
    /* propagate */
    self_changed(self,PROFILE_ADDED,-1, prof->id);
    return prof->id;
  }}
#line 879 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 413 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_remove_item (GmpcProfiles * self, const gchar * id)
{
#line 886 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::remove_item"
#line 413 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 413 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 892 "gmpc-profiles.c"
{
#line 416 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    gchar *message = NULL;
    int i=0;
    Profile *prof =  self_get_profile(self, id);
    if(!prof)
    {
        g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Trying to remove not-existing profile: %s\n", id);
      return;
    }
    /* Generate removal message before the actual profile is destroyed */
    message = g_markup_printf_escaped("<b>%s:</b> '%s'", _("Removed profile"),self_get_name(self,id));

    for(i=0; self->_priv->list[i] && self->_priv->list[i] != prof;i++);
    if(self->_priv->list[i] == prof)
    {
      for(; self->_priv->list[i] ;i++)
      {
        self->_priv->list[i] = self->_priv->list[i+1];
      }
      self->_priv->num_profiles--;
      self->_priv->list = g_realloc(self->_priv->list, (self->_priv->num_profiles+1)*sizeof(Profile *));     
      
      cfg_remove_class(self->_priv->profiles, (char *)id);
      self_free_profile(prof);
    }

    /* Display the message */
    playlist3_show_error_message(message, ERROR_INFO);
    q_free(message);

    self_changed(self,PROFILE_REMOVED,-1, id);
  }}
#line 927 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 452 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gchar * 
gmpc_profiles_get_current (GmpcProfiles * self)
{
#line 934 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_current"
#line 452 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gchar * )0);
#line 452 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gchar * )0);
#line 940 "gmpc-profiles.c"
{
#line 455 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
		gchar *id = cfg_get_single_value_as_string_with_default(config, "connection", "currentprofile", "Default");
		Profile *prof = self_get_profile(self, id);
		/* if not available get the first one */
		if(!prof)
		{
			g_free(id);
            if(self->_priv->list != NULL && self->_priv->list[0])
            {
			    self_set_current(self, self->_priv->list[0]->id);
            } else {
                self_add_default(self);    
                self_load_from_config(self);
                self_changed(self, PROFILE_ADDED, -1,"Default");
            }
			id = cfg_get_single_value_as_string_with_default(config, "connection", "currentprofile", "Default");
		}
		return id; 
  }}
#line 962 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_current (GmpcProfiles * self, const gchar * id)
{
#line 969 "gmpc-profiles.c"
	GValue ___param_values[2];
	GValue ___return_val;

memset (&___return_val, 0, sizeof (___return_val));
memset (&___param_values, 0, sizeof (___param_values));

#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 982 "gmpc-profiles.c"

	___param_values[0].g_type = 0;
	g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
	g_value_set_instance (&___param_values[0], (gpointer) self);

	___param_values[1].g_type = 0;
	g_value_init (&___param_values[1], G_TYPE_STRING);
	g_value_set_static_string (&___param_values[1], (gchar *) id);

	g_signal_emitv (___param_values,
		object_signals[SET_CURRENT_SIGNAL],
		0 /* detail */,
		&___return_val);

	g_value_unset (&___param_values[0]);
	g_value_unset (&___param_values[1]);
}
#line 475 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
___real_gmpc_profiles_set_current (GmpcProfiles * self G_GNUC_UNUSED, const gchar * id)
{
#line 1004 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_current"
{
#line 478 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(prof){
        cfg_set_single_value_as_string(config, "connection", "currentprofile", (char *)id);

        self_changed(self, PROFILE_CURRENT,0, id); 
    }

  }}
#line 1017 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 487 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
GList * 
gmpc_profiles_get_profiles_ids (GmpcProfiles * self)
{
#line 1024 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::get_profiles_ids"
#line 487 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (GList * )0);
#line 487 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (GList * )0);
#line 1030 "gmpc-profiles.c"
{
#line 490 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    GList *list = NULL;
    int i=0;
    for(i=0; self->_priv->list[i] ; i++)
    {
      list = g_list_append(list,g_strdup(self->_priv->list[i]->id));
    }
    return list;
  }}
#line 1042 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 503 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_name (GmpcProfiles * self, const gchar * id, const gchar * value)
{
#line 1049 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_name"
#line 503 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 503 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 503 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 503 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (value != NULL);
#line 1059 "gmpc-profiles.c"
{
#line 506 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);

    if(!prof)
      return ;                              
	
    if((value && prof->name &&  g_utf8_collate(value, prof->name) == 0)|| (value == NULL && prof->name == NULL))
	return;

    if(prof->name)
      g_free(prof->name);

    prof->name = g_strdup(value);
    cfg_set_single_value_as_string(self->_priv->profiles, (char *)id, "name",prof->name);
    self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_NAME,id);
  }}
#line 1078 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 523 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_hostname (GmpcProfiles * self, const gchar * id, const gchar * value)
{
#line 1085 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_hostname"
#line 523 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 523 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 523 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 523 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (value != NULL);
#line 1095 "gmpc-profiles.c"
{
#line 526 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return ;                              

    if((value && prof->hostname &&  g_utf8_collate(value, prof->hostname) == 0)|| (value == NULL && prof->hostname == NULL))
	return;

    if(prof->hostname)
      g_free(prof->hostname);
    prof->hostname = g_strdup(value);
    cfg_set_single_value_as_string(self->_priv->profiles, (char *)id, "hostname",prof->hostname);
    self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_HOSTNAME,id);
  }}
#line 1112 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 543 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_password (GmpcProfiles * self, const gchar * id, gchar * value)
{
#line 1119 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_password"
#line 543 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 543 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 543 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 1127 "gmpc-profiles.c"
{
#line 546 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return ;                              

    if((value && prof->password &&  g_utf8_collate(value, prof->password) == 0)|| (value == NULL && prof->password == NULL))
	return;

    if(prof->password)
      g_free(prof->password);
    if(value)
      prof->password = g_strdup(value);
    else
      prof->password = g_strdup("");
    cfg_set_single_value_as_string(self->_priv->profiles, (char *)id, "password",prof->password);
    self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_PASSWORD,id);
  }}
#line 1147 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 567 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_port (GmpcProfiles * self, const gchar * id, int value)
{
#line 1154 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_port"
#line 567 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 567 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 567 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 1162 "gmpc-profiles.c"
{
#line 570 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return ;                              
    if(value == prof->port)
	    return;
    prof->port = value;
    cfg_set_single_value_as_int(self->_priv->profiles, (char *)id, "portnumber",prof->port);
    self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_PORT,id);
  }}
#line 1175 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 584 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_music_directory (GmpcProfiles * self, const gchar * id, gchar * value)
{
#line 1182 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_music_directory"
#line 584 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 584 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 584 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 1190 "gmpc-profiles.c"
{
#line 587 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
      Profile *prof = self_get_profile(self, id);
      if(!prof)
          return ;                              

      if((value && prof->music_directory &&  g_utf8_collate(value, prof->music_directory) == 0)|| (value == NULL && prof->music_directory == NULL))
          return;

      if(prof->music_directory)
          g_free(prof->music_directory);
      if(value)
          prof->music_directory = g_strdup(value);
      else
          prof->music_directory = g_strdup("");
      cfg_set_single_value_as_string(self->_priv->profiles, (char *)id, "music directory",prof->music_directory);
      self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_MUSIC_DIRECTORY,id);
  }}
#line 1210 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 606 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_db_update_time (GmpcProfiles * self, const gchar * id, int value)
{
#line 1217 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_db_update_time"
#line 606 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 606 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 606 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 1225 "gmpc-profiles.c"
{
#line 609 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	

        Profile *prof = self_get_profile(self, id);
        if(!prof)
          return ;                              

        if(value == prof->db_update_time)  return;
    
        cfg_set_single_value_as_int(self->_priv->profiles, (char *)id, "db update time",(int)value);
        self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_DB_UPDATE_TIME,id);
    }}
#line 1239 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 623 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_do_auth (GmpcProfiles * self, const gchar * id, int value)
{
#line 1246 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_do_auth"
#line 623 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 623 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 623 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (id != NULL);
#line 1254 "gmpc-profiles.c"
{
#line 626 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
    Profile *prof = self_get_profile(self, id);
    if(!prof)
      return ;                              
    if(prof->do_auth == value)
	    return;
    prof->do_auth = value;
    cfg_set_single_value_as_int(self->_priv->profiles,(char *)id, "useauth",prof->do_auth);
    self_changed(self,PROFILE_COL_CHANGED, PROFILE_COL_DO_AUTH,id);
  }}
#line 1267 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 639 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
gboolean 
gmpc_profiles_has_profile (GmpcProfiles * self, const gchar * id)
{
#line 1274 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::has_profile"
#line 639 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (self != NULL, (gboolean )0);
#line 639 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (GMPC_IS_PROFILES (self), (gboolean )0);
#line 639 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_val_if_fail (id != NULL, (gboolean )0);
#line 1282 "gmpc-profiles.c"
{
#line 642 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
		Profile *prof = self_get_profile(self, id);
		if(!prof)
			return FALSE;
		else 
			return TRUE;                                 	

	}}
#line 1293 "gmpc-profiles.c"
#undef __GOB_FUNCTION__

#line 650 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
static void 
___21_gmpc_profiles_finalize (GObject * obj G_GNUC_UNUSED)
#line 1299 "gmpc-profiles.c"
#define PARENT_HANDLER(___obj) \
	{ if(G_OBJECT_CLASS(parent_class)->finalize) \
		(* G_OBJECT_CLASS(parent_class)->finalize)(___obj); }
{
#define __GOB_FUNCTION__ "Gmpc:Profiles::finalize"
{
#line 653 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
		Self *self = GMPC_PROFILES(obj);
		if(self->_priv->list)
		{
			int i = 0;
			do{
				Profile * prof = self->_priv->list[i];
				self_free_profile(prof);
				self->_priv->list[i] = NULL;
				i++;
			}while(self->_priv->list[i]);
			g_free(self->_priv->list);
			self->_priv->list = NULL;
		}
		if(self->_priv->profiles)
		{
			cfg_close(self->_priv->profiles);
			self->_priv->profiles=  NULL;
		}
		PARENT_HANDLER(obj);
	}}
#line 1328 "gmpc-profiles.c"
#undef __GOB_FUNCTION__
#undef PARENT_HANDLER

#line 675 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
void 
gmpc_profiles_set_profile_from_name (GmpcProfiles * self, const gchar * name)
{
#line 1336 "gmpc-profiles.c"
#define __GOB_FUNCTION__ "Gmpc:Profiles::set_profile_from_name"
#line 675 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (self != NULL);
#line 675 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (GMPC_IS_PROFILES (self));
#line 675 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	g_return_if_fail (name != NULL);
#line 1344 "gmpc-profiles.c"
{
#line 678 "/usr/src/extras/gmpc/gmpc-11.8.16-2.i686/src/gmpc-11.8.16/src/gmpc-profiles.gob"
	
        GList *iter, *items = gmpc_profiles_get_profiles_ids(gmpc_profiles);
        for (iter = g_list_first(items); iter; iter = g_list_next(iter))
        {
			const char *pname = gmpc_profiles_get_name(gmpc_profiles, 
					(const gchar *)iter->data);
			if (pname != NULL && 
				g_utf8_collate(name, pname) == 0)
            {
                connection_set_current_profile((const gchar *)iter->data);
                break;
            }
        }
        g_list_foreach(items, (GFunc) g_free, NULL);
        g_list_free(items);
	}}
#line 1363 "gmpc-profiles.c"
#undef __GOB_FUNCTION__
