/* 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-mpddata-model.h"

#include "gmpc-mpddata-model-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 */

#line 74 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"

#define LOG_DOMAIN "MpdData.Model"

#line 30 "gmpc-mpddata-model.c"
/* self casting macros */
#define SELF(x) GMPC_MPDDATA_MODEL(x)
#define SELF_CONST(x) GMPC_MPDDATA_MODEL_CONST(x)
#define IS_SELF(x) GMPC_IS_MPDDATA_MODEL(x)
#define TYPE_SELF GMPC_TYPE_MPDDATA_MODEL
#define SELF_CLASS(x) GMPC_MPDDATA_MODEL_CLASS(x)

#define SELF_GET_CLASS(x) GMPC_MPDDATA_MODEL_GET_CLASS(x)

/* self typedefs */
typedef GmpcMpdDataModel Self;
typedef GmpcMpdDataModelClass SelfClass;

/* here are local prototypes */
static void ___object_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
#line 111 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void gmpc_mpddata_model_init (GmpcMpdDataModel * self) G_GNUC_UNUSED;
#line 49 "gmpc-mpddata-model.c"
#line 147 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void gmpc_mpddata_model_class_init (GmpcMpdDataModelClass * klass) G_GNUC_UNUSED;
#line 52 "gmpc-mpddata-model.c"
#line 155 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void ___6_gmpc_mpddata_model_finalize (GObject * obj) G_GNUC_UNUSED;
#line 55 "gmpc-mpddata-model.c"
#line 184 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GtkTreeModelFlags gmpc_mpddata_model_get_flags (GtkTreeModel * self) G_GNUC_UNUSED;
#line 58 "gmpc-mpddata-model.c"
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_get_iter (GtkTreeModel * model, GtkTreeIter * iter, GtkTreePath * path) G_GNUC_UNUSED;
#line 61 "gmpc-mpddata-model.c"
#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_iter_next (GtkTreeModel * model, GtkTreeIter * iter) G_GNUC_UNUSED;
#line 64 "gmpc-mpddata-model.c"
#line 294 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_iter_has_child (GtkTreeModel * self, GtkTreeIter * iter) G_GNUC_UNUSED;
#line 67 "gmpc-mpddata-model.c"
#line 300 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gint gmpc_mpddata_model_iter_n_children (GtkTreeModel * model, GtkTreeIter * iter) G_GNUC_UNUSED;
#line 70 "gmpc-mpddata-model.c"
#line 310 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_iter_parent (GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * child) G_GNUC_UNUSED;
#line 73 "gmpc-mpddata-model.c"
#line 315 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void gmpc_mpddata_model_cover_art_fetched (mpd_Song * song, MetaDataResult ret, MetaData * met, GtkTreeRowReference * ref) G_GNUC_UNUSED;
#line 76 "gmpc-mpddata-model.c"
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_iter_nth_child (GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * parent, gint n) G_GNUC_UNUSED;
#line 79 "gmpc-mpddata-model.c"
#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GtkTreePath * gmpc_mpddata_model_get_path (GtkTreeModel * self, GtkTreeIter * iter) G_GNUC_UNUSED;
#line 82 "gmpc-mpddata-model.c"
#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GType gmpc_mpddata_model_get_column_type (GtkTreeModel * model, gint ind) G_GNUC_UNUSED;
#line 85 "gmpc-mpddata-model.c"
#line 900 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_get_sort_column_id (GtkTreeSortable * model, gint * sort_column_id, GtkSortType * order) G_GNUC_UNUSED;
#line 88 "gmpc-mpddata-model.c"
#line 912 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void gmpc_mpddata_model_set_sort_column_id (GtkTreeSortable * model, gint sort_column_id, GtkSortType order) G_GNUC_UNUSED;
#line 91 "gmpc-mpddata-model.c"
#line 928 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_has_default_sort_func (GtkTreeSortable * model) G_GNUC_UNUSED;
#line 94 "gmpc-mpddata-model.c"
#line 934 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static int gmpc_mpddata_model_sort_func (gpointer ppaa, gpointer ppbb, Self * self) G_GNUC_UNUSED;
#line 97 "gmpc-mpddata-model.c"
#line 1025 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void gmpc_mpddata_model_sort_column_changed (GtkTreeSortable * model) G_GNUC_UNUSED;
#line 100 "gmpc-mpddata-model.c"
#line 1065 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static int gmpc_mpddata_model_test_sort_func (gpointer ppaa, gpointer ppbb, Self * self) G_GNUC_UNUSED;
#line 103 "gmpc-mpddata-model.c"
static void ___real_gmpc_mpddata_model_playtime_changed (GmpcMpdDataModel * self, gulong playtime);
#line 1386 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_row_draggable (GtkTreeDragSource * drag_source, GtkTreePath * path) G_GNUC_UNUSED;
#line 107 "gmpc-mpddata-model.c"
#line 1401 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_drag_data_delete (GtkTreeDragSource * drag_source, GtkTreePath * path) G_GNUC_UNUSED;
#line 110 "gmpc-mpddata-model.c"
#line 1407 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean gmpc_mpddata_model_drag_data_get (GtkTreeDragSource * drag_source, GtkTreePath * path, GtkSelectionData * selection_data) G_GNUC_UNUSED;
#line 113 "gmpc-mpddata-model.c"

/*
 * Signal connection wrapper macro shortcuts
 */
#define self_connect__playtime_changed(object,func,data)	gmpc_mpddata_model_connect__playtime_changed((object),(func),(data))
#define self_connect_after__playtime_changed(object,func,data)	gmpc_mpddata_model_connect_after__playtime_changed((object),(func),(data))
#define self_connect_data__playtime_changed(object,func,data,destroy_data,flags)	gmpc_mpddata_model_connect_data__playtime_changed((object),(func),(data),(destroy_data),(flags))

typedef void  (*___Sig1) (GmpcMpdDataModel *, glong , 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 == 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 = (___Sig1) (marshal_data != NULL ? marshal_data : cc->callback);

	callback ((GmpcMpdDataModel *)data1,
		(glong ) g_value_get_long (param_values + 1),
		data2);
}


enum {
	PLAYTIME_CHANGED_SIGNAL,
	LAST_SIGNAL
};

enum {
	PROP_0,
	PROP_HAS_UP
};

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_has_up gmpc_mpddata_model_get_has_up
#define self_set_has_up gmpc_mpddata_model_set_has_up
#define self_new gmpc_mpddata_model_new
#define self_get_flags gmpc_mpddata_model_get_flags
#define self_iter_children gmpc_mpddata_model_iter_children
#define self_get_n_columns gmpc_mpddata_model_get_n_columns
#define self_get_iter gmpc_mpddata_model_get_iter
#define self_iter_next gmpc_mpddata_model_iter_next
#define self_iter_has_child gmpc_mpddata_model_iter_has_child
#define self_iter_n_children gmpc_mpddata_model_iter_n_children
#define self_iter_parent gmpc_mpddata_model_iter_parent
#define self_cover_art_fetched gmpc_mpddata_model_cover_art_fetched
#define self_get_value gmpc_mpddata_model_get_value
#define self_iter_nth_child gmpc_mpddata_model_iter_nth_child
#define self_get_path gmpc_mpddata_model_get_path
#define self_get_column_type gmpc_mpddata_model_get_column_type
#define self_set_request_artist gmpc_mpddata_model_set_request_artist
#define self_get_request_artist gmpc_mpddata_model_get_request_artist
#define self_set_mpd_data gmpc_mpddata_model_set_mpd_data
#define self_get_sort_column_id gmpc_mpddata_model_get_sort_column_id
#define self_set_sort_column_id gmpc_mpddata_model_set_sort_column_id
#define self_has_default_sort_func gmpc_mpddata_model_has_default_sort_func
#define self_sort_func gmpc_mpddata_model_sort_func
#define self_sort_column_changed gmpc_mpddata_model_sort_column_changed
#define self_test_sort_func gmpc_mpddata_model_test_sort_func
#define self_set_mpd_data_slow gmpc_mpddata_model_set_mpd_data_slow
#define self_playtime_changed gmpc_mpddata_model_playtime_changed
#define self_get_playtime gmpc_mpddata_model_get_playtime
#define self_get_pos gmpc_mpddata_model_get_pos
#define self_disable_image gmpc_mpddata_model_disable_image
#define self_steal_mpd_data gmpc_mpddata_model_steal_mpd_data
#define self_row_draggable gmpc_mpddata_model_row_draggable
#define self_drag_data_delete gmpc_mpddata_model_drag_data_delete
#define self_drag_data_get gmpc_mpddata_model_drag_data_get


static void
___Gtk_Tree_Model_init (GtkTreeModelIface *iface)
{
#line 184 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_flags = self_get_flags;
#line 193 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_children = self_iter_children;
#line 213 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_n_columns = self_get_n_columns;
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_iter = self_get_iter;
#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_next = self_iter_next;
#line 294 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_has_child = self_iter_has_child;
#line 300 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_n_children = self_iter_n_children;
#line 310 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_parent = self_iter_parent;
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_value = self_get_value;
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->iter_nth_child = self_iter_nth_child;
#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_path = self_get_path;
#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_column_type = self_get_column_type;
#line 233 "gmpc-mpddata-model.c"
}


static void
___Gtk_Tree_Drag_Source_init (GtkTreeDragSourceIface *iface)
{
#line 1386 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->row_draggable = self_row_draggable;
#line 1401 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->drag_data_delete = self_drag_data_delete;
#line 1407 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->drag_data_get = self_drag_data_get;
#line 246 "gmpc-mpddata-model.c"
}


static void
___Gtk_Tree_Sortable_init (GtkTreeSortableIface *iface)
{
#line 900 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->get_sort_column_id = self_get_sort_column_id;
#line 912 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->set_sort_column_id = self_set_sort_column_id;
#line 928 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->has_default_sort_func = self_has_default_sort_func;
#line 1025 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	iface->sort_column_changed = self_sort_column_changed;
#line 261 "gmpc-mpddata-model.c"
}

GType
gmpc_mpddata_model_get_type (void)
{
	static GType type = 0;

	if ___GOB_UNLIKELY(type == 0) {
		static const GTypeInfo info = {
			sizeof (GmpcMpdDataModelClass),
			(GBaseInitFunc) NULL,
			(GBaseFinalizeFunc) NULL,
			(GClassInitFunc) gmpc_mpddata_model_class_init,
			(GClassFinalizeFunc) NULL,
			NULL /* class_data */,
			sizeof (GmpcMpdDataModel),
			0 /* n_preallocs */,
			(GInstanceInitFunc) gmpc_mpddata_model_init,
			NULL
		};

		static const GInterfaceInfo Gtk_Tree_Model_info = {
			(GInterfaceInitFunc) ___Gtk_Tree_Model_init,
			NULL,
			NULL
		};

		static const GInterfaceInfo Gtk_Tree_Drag_Source_info = {
			(GInterfaceInitFunc) ___Gtk_Tree_Drag_Source_init,
			NULL,
			NULL
		};

		static const GInterfaceInfo Gtk_Tree_Sortable_info = {
			(GInterfaceInitFunc) ___Gtk_Tree_Sortable_init,
			NULL,
			NULL
		};

		type = g_type_register_static (G_TYPE_OBJECT, "GmpcMpdDataModel", &info, (GTypeFlags)0);
		g_type_add_interface_static (type,
			GTK_TYPE_TREE_MODEL,
			&Gtk_Tree_Model_info);
		g_type_add_interface_static (type,
			GTK_TYPE_TREE_DRAG_SOURCE,
			&Gtk_Tree_Drag_Source_info);
		g_type_add_interface_static (type,
			GTK_TYPE_TREE_SORTABLE,
			&Gtk_Tree_Sortable_info);
	}

	return type;
}

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

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


static void
___finalize(GObject *obj_self)
{
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::finalize"
	GmpcMpdDataModel *self G_GNUC_UNUSED = GMPC_MPDDATA_MODEL (obj_self);
	gpointer priv G_GNUC_UNUSED = self->_priv;
#line 88 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	if(self->_priv->req_artist) { g_free ((gpointer) self->_priv->req_artist); self->_priv->req_artist = NULL; }
#line 342 "gmpc-mpddata-model.c"
#line 89 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	if(self->_priv->blank) { g_object_unref ((gpointer) self->_priv->blank); self->_priv->blank = NULL; }
#line 345 "gmpc-mpddata-model.c"
#line 97 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	if(self->_priv->markup) { g_free ((gpointer) self->_priv->markup); self->_priv->markup = NULL; }
#line 348 "gmpc-mpddata-model.c"
#line 155 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	___6_gmpc_mpddata_model_finalize(obj_self);
#line 351 "gmpc-mpddata-model.c"
}
#undef __GOB_FUNCTION__

#line 111 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
gmpc_mpddata_model_init (GmpcMpdDataModel * self G_GNUC_UNUSED)
{
#line 359 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::init"
	self->_priv = G_TYPE_INSTANCE_GET_PRIVATE(self,GMPC_TYPE_MPDDATA_MODEL,GmpcMpdDataModelPrivate);
#line 83 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->stamp = g_random_int();
#line 364 "gmpc-mpddata-model.c"
#line 83 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->data = NULL;
#line 367 "gmpc-mpddata-model.c"
#line 83 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->num_rows = 0;
#line 370 "gmpc-mpddata-model.c"
#line 83 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->images = NULL;
#line 373 "gmpc-mpddata-model.c"
#line 88 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->req_artist = NULL;
#line 376 "gmpc-mpddata-model.c"
#line 89 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->blank = NULL;
#line 379 "gmpc-mpddata-model.c"
#line 90 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->icon_size = cfg_get_single_value_as_int_with_default(config, "gmpc-mpddata-model", "icon-size", 32);
#line 382 "gmpc-mpddata-model.c"
#line 90 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->sort_order = GTK_SORT_ASCENDING;
#line 385 "gmpc-mpddata-model.c"
#line 90 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->sort_column = GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID;
#line 388 "gmpc-mpddata-model.c"
#line 90 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->old_sort_column = GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID;
#line 391 "gmpc-mpddata-model.c"
#line 90 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->has_up = FALSE;
#line 394 "gmpc-mpddata-model.c"
#line 97 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->markup = cfg_get_single_value_as_string_with_default(config, "playlist", "browser_markup",DEFAULT_MARKUP_BROWSER);
#line 397 "gmpc-mpddata-model.c"
#line 99 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->playtime = 0;
#line 400 "gmpc-mpddata-model.c"
#line 99 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	self->_priv->use_images = TRUE;
#line 403 "gmpc-mpddata-model.c"
 {
#line 112 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"

        self->types[MPDDATA_MODEL_COL_MPDSONG] = G_TYPE_POINTER;
        self->types[MPDDATA_MODEL_COL_MARKUP] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_PLAYING] = G_TYPE_BOOLEAN;
        self->types[MPDDATA_MODEL_COL_PLAYING_FONT_WEIGHT] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_COL_PATH] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_ARTIST] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_ALBUM] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_TITLE] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_TITLEFILE] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_TRACK] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_GENRE] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_NAME] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_COMPOSER] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_PERFORMER]= G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_DATE] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_LENGTH] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_COL_SONG_LENGTH_FORMAT] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_DISC] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_COMMENT] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_POS] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_COL_SONG_ALBUMARTIST] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_PATH_EXTENSION] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_PATH_DIRECTORY] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_COL_SONG_ID] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_COL_ICON_ID] = G_TYPE_STRING;
        self->types[MPDDATA_MODEL_TAG_TYPE] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_ROW_TYPE] = G_TYPE_INT;
        self->types[MPDDATA_MODEL_USERDATA] = G_TYPE_POINTER;
        self->types[MPDDATA_MODEL_META_DATA] = GDK_TYPE_PIXBUF;


        self->_priv->blank = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, self->icon_size, self->icon_size);
        gdk_pixbuf_fill(self->_priv->blank, 0x00000000);
    
#line 441 "gmpc-mpddata-model.c"
 }
}
#undef __GOB_FUNCTION__
#line 147 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
gmpc_mpddata_model_class_init (GmpcMpdDataModelClass * klass G_GNUC_UNUSED)
{
#line 449 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::class_init"
	GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) klass;

	g_type_class_add_private(klass,sizeof(GmpcMpdDataModelPrivate));

	parent_class = g_type_class_ref (G_TYPE_OBJECT);

	object_signals[PLAYTIME_CHANGED_SIGNAL] =
		g_signal_new ("playtime_changed",
			G_TYPE_FROM_CLASS (g_object_class),
			(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
			G_STRUCT_OFFSET (GmpcMpdDataModelClass, playtime_changed),
			NULL, NULL,
			___marshal_Sig1,
			G_TYPE_NONE, 1,
			G_TYPE_LONG);
	if ___GOB_UNLIKELY(sizeof(gulong ) != sizeof(glong ) || parent_class == NULL /* avoid warning */) {
		g_error("/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob line 1318: Type mismatch of \"playtime_changed\" signal signature");
	}

#line 155 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_object_class->finalize = ___finalize;
#line 1318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	klass->playtime_changed = ___real_gmpc_mpddata_model_playtime_changed;
#line 474 "gmpc-mpddata-model.c"
	g_object_class->get_property = ___object_get_property;
	g_object_class->set_property = ___object_set_property;
    {
	GParamSpec   *param_spec;

	param_spec = g_param_spec_boolean
		("has_up" /* name */,
		 "Has Up" /* nick */,
		 "Show an 'up row" /* blurb */,
		 FALSE /* default_value */,
		 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (g_object_class,
		PROP_HAS_UP,
		param_spec);
    }
}
#undef __GOB_FUNCTION__

static void
___object_set_property (GObject *object,
	guint property_id,
	const GValue *VAL G_GNUC_UNUSED,
	GParamSpec *pspec G_GNUC_UNUSED)
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_property"
{
	GmpcMpdDataModel *self G_GNUC_UNUSED;

	self = GMPC_MPDDATA_MODEL (object);

	switch (property_id) {
	case PROP_HAS_UP:
		{
#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
self->has_up = g_value_get_boolean (VAL);
#line 509 "gmpc-mpddata-model.c"
		}
		break;
	default:
/* Apparently in g++ this is needed, glib is b0rk */
#ifndef __PRETTY_FUNCTION__
#  undef G_STRLOC
#  define G_STRLOC	__FILE__ ":" G_STRINGIFY (__LINE__)
#endif
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}
#undef __GOB_FUNCTION__

static void
___object_get_property (GObject *object,
	guint property_id,
	GValue *VAL G_GNUC_UNUSED,
	GParamSpec *pspec G_GNUC_UNUSED)
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_property"
{
	GmpcMpdDataModel *self G_GNUC_UNUSED;

	self = GMPC_MPDDATA_MODEL (object);

	switch (property_id) {
	case PROP_HAS_UP:
		{
#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
g_value_set_boolean (VAL, self->has_up);
#line 540 "gmpc-mpddata-model.c"
		}
		break;
	default:
/* Apparently in g++ this is needed, glib is b0rk */
#ifndef __PRETTY_FUNCTION__
#  undef G_STRLOC
#  define G_STRLOC	__FILE__ ":" G_STRINGIFY (__LINE__)
#endif
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}
#undef __GOB_FUNCTION__

#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
gboolean 
gmpc_mpddata_model_get_has_up (GmpcMpdDataModel * self)
{
#line 559 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_has_up"
{
#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
		gboolean val; g_object_get (G_OBJECT (self), "has_up", &val, NULL); return val;
}}
#line 565 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
void 
gmpc_mpddata_model_set_has_up (GmpcMpdDataModel * self, gboolean val)
{
#line 572 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_has_up"
{
#line 104 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
		g_object_set (G_OBJECT (self), "has_up", val, NULL);
}}
#line 578 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__



#line 149 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
GmpcMpdDataModel * 
gmpc_mpddata_model_new (void)
{
#line 587 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::new"
{
#line 151 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return GET_NEW;
        }}
#line 594 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 155 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
___6_gmpc_mpddata_model_finalize (GObject * obj G_GNUC_UNUSED)
#line 600 "gmpc-mpddata-model.c"
#define PARENT_HANDLER(___obj) \
	{ if(G_OBJECT_CLASS(parent_class)->finalize) \
		(* G_OBJECT_CLASS(parent_class)->finalize)(___obj); }
{
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::finalize"
{
#line 158 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            int i =0;
            Self *self = GMPC_MPDDATA_MODEL(obj); 

            if(self->_priv->data)
            {
                mpd_data_free(self->_priv->data);
                self->_priv->data = NULL;
            }
            if(self->_priv->images && self->_priv->use_images)
            {
                for(i=0;i<self->num_rows;i++)
                {
                    if(self->_priv->images[i]) {
                        g_object_unref(self->_priv->images[i]);
                        self->_priv->images[i] = NULL;
                    }
                }
                q_free(self->_priv->images);
                /* q_free should do it, but force it */
                self->_priv->images = NULL;
            }
            PARENT_HANDLER(obj);
        }}
#line 632 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__
#undef PARENT_HANDLER

#line 184 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GtkTreeModelFlags 
gmpc_mpddata_model_get_flags (GtkTreeModel * self)
{
#line 640 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_flags"
#line 184 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (GtkTreeModelFlags )0);
#line 184 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (self), (GtkTreeModelFlags )0);
#line 646 "gmpc-mpddata-model.c"
{
#line 186 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            /* Here would be the implementation */
            return (GtkTreeModelFlags)GTK_TREE_MODEL_LIST_ONLY;
        }}
#line 653 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 193 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
gboolean 
gmpc_mpddata_model_iter_children (GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * parent)
{
#line 660 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_children"
{
#line 195 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self  = GMPC_MPDDATA_MODEL(model);
            if(parent)
                return FALSE;
            if(self->num_rows == 0)
                return FALSE;
            /* Set iter to first item in list */
            iter->stamp = self->_priv->stamp; 
            iter->user_data = self->_priv->data;
            iter->user_data2 =  GINT_TO_POINTER(0);
            iter->user_data3 = NULL;	/* unused */

            return TRUE;
        }}
#line 678 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 213 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
gint 
gmpc_mpddata_model_get_n_columns (GtkTreeModel * model)
{
#line 685 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_n_columns"
{
#line 215 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return MPDDATA_MODEL_N_COLUMNS;
        }}
#line 692 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_get_iter (GtkTreeModel * model, GtkTreeIter * iter, GtkTreePath * path)
{
#line 699 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_iter"
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (gboolean )0);
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (gboolean )0);
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (iter != NULL, (gboolean )0);
#line 220 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (path != NULL, (gboolean )0);
#line 709 "gmpc-mpddata-model.c"
{
#line 224 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            MpdData_real *data = NULL;
            gint i=0;
            const gint *indices = gtk_tree_path_get_indices(path);
            gint depth = gtk_tree_path_get_depth(path);
            gint n = indices[0];	/* the n-th top level row */

            /* No Children */
            g_assert(depth == 1); 

            if (n >= self->num_rows || n < 0)
                return FALSE; 

            g_assert(n<self->num_rows);
            /* If it is the first item in a has_up list, do nothing */
            if(self->has_up && n == 0){
                data = NULL;
                goto end;
            }
            data = (MpdData_real *)self->_priv->data;

            if(self->has_up)
                i=1;

            for(; i < (n);i++)
            {
                data = data->next; 
            }
end:
            iter->stamp = self->_priv->stamp;
            iter->user_data = data; 
            iter->user_data2 = GINT_TO_POINTER(n);
            return TRUE;
        }}
#line 747 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_iter_next (GtkTreeModel * model, GtkTreeIter * iter)
{
#line 754 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_next"
#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (gboolean )0);
#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (gboolean )0);
#line 261 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (iter != NULL, (gboolean )0);
#line 762 "gmpc-mpddata-model.c"
{
#line 263 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            MpdData *data = iter->user_data;
            int n = GPOINTER_TO_INT(iter->user_data2) ;
            /* if the row is the last row in the list or bigger then the last row, return FALSE */
            if(n >= self->num_rows)
            {
                return FALSE;
            }
            /* if the row is the first row in the list, and it has a "go-up" entry, 
             * it can have a next entry
             */
            if(data == NULL &&  n == 0 && self->has_up == TRUE)
            {
                iter->user_data = (MpdData *)self->_priv->data; 
                iter->user_data2 = GINT_TO_POINTER(1);
                if(iter->user_data == NULL)
                    return FALSE;
                return TRUE;
            }
            if(mpd_data_get_next_real(data,FALSE) == NULL)
            {
                return FALSE;
            }
            iter->user_data = (MpdData *)mpd_data_get_next_real(data,FALSE); 
            iter->user_data2 = GINT_TO_POINTER(n+1);
            g_assert(iter->user_data != NULL);
            return TRUE;
        }}
#line 794 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 294 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_iter_has_child (GtkTreeModel * self, GtkTreeIter * iter)
{
#line 801 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_has_child"
#line 294 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (gboolean )0);
#line 294 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (self), (gboolean )0);
#line 807 "gmpc-mpddata-model.c"
{
#line 296 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return FALSE;
        }}
#line 813 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 300 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gint 
gmpc_mpddata_model_iter_n_children (GtkTreeModel * model, GtkTreeIter * iter)
{
#line 820 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_n_children"
#line 300 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (gint )0);
#line 300 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (gint )0);
#line 826 "gmpc-mpddata-model.c"
{
#line 302 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	 
            Self *list = GMPC_MPDDATA_MODEL(model);
            if(iter)
                return 0;
            return list->num_rows;
        }}
#line 835 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 310 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_iter_parent (GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * child)
{
#line 842 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_parent"
#line 310 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (gboolean )0);
#line 310 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (gboolean )0);
#line 848 "gmpc-mpddata-model.c"
{
#line 312 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return FALSE;
        }}
#line 854 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 315 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
gmpc_mpddata_model_cover_art_fetched (mpd_Song * song, MetaDataResult ret, MetaData * met, GtkTreeRowReference * ref)
{
#line 861 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::cover_art_fetched"
{
#line 318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	

            if(ref)
            {
                GtkTreePath *path =gtk_tree_row_reference_get_path(ref);
                GtkTreeModel *model = gtk_tree_row_reference_get_model(ref);
                if(path && model)
                {
					int n;	
                    Self *self = GMPC_MPDDATA_MODEL(model);
                    GtkTreeIter iter;

                    g_assert(self->_priv->use_images == TRUE);
                    
                    gtk_tree_model_get_iter(model, &iter, path);
                    n = GPOINTER_TO_INT(iter.user_data2) ;

                    if(self->_priv->images[n] == NULL){
                        self->_priv->images[n]= gmpc_pixbuf_loader_async_new();
                        gmpc_pixbuf_loader_async_set_rref(GMPC_PIXBUF_LOADER_ASYNC(self->_priv->images[n]), ref);
                    }

                    if(ret == META_DATA_AVAILABLE)
                    {
                        
                        GdkPixbuf *pb = NULL;
                        if(met->content_type == META_DATA_CONTENT_URI)
                        {
                            const gchar *coverpath = meta_data_get_uri(met);
                            MpdData_real *data = iter.user_data;	
                            gmpc_pixbuf_loader_async_set_from_file(GMPC_PIXBUF_LOADER_ASYNC(self->_priv->images[n]),
                                    coverpath, self->icon_size, self->icon_size,
                                    ((data->type == MPD_DATA_TYPE_TAG && data->tag_type == MPD_TAG_ITEM_ALBUM) || (data->type == MPD_DATA_TYPE_SONG)?GMPC_MODIFICATION_TYPE_CASING: GMPC_MODIFICATION_TYPE_NONE));
                        }else{
                            pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-no-cover", self->icon_size, 0,NULL);
                            gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n], pb);
                            g_object_unref(pb);
                        }
                    }
                    else   if(ret == META_DATA_UNAVAILABLE)
                    {
                        GdkPixbuf *pb2;
                        pb2 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-no-cover", self->icon_size, 0,NULL);
                        gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n], pb2);
                        g_object_unref(pb2);
                    }
                    gtk_tree_model_row_changed(model,path, &iter);
                    gtk_tree_path_free(path);
                }

                if(ret == META_DATA_AVAILABLE || ret == META_DATA_UNAVAILABLE)
                {
                    if(ref)
                    {
                        gtk_tree_row_reference_free(ref);
                    }
                }
            }
        }}
#line 924 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
void 
gmpc_mpddata_model_get_value (GtkTreeModel * model, GtkTreeIter * iter, gint column, GValue * value)
{
#line 931 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_value"
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (model != NULL);
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (GTK_IS_TREE_MODEL (model));
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (iter != NULL);
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (column >= 0);
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (column < MPDDATA_MODEL_N_COLUMNS);
#line 379 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (value != NULL);
#line 945 "gmpc-mpddata-model.c"
{
#line 381 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            MpdData_real *data = iter->user_data;	
            int n = GPOINTER_TO_INT(iter->user_data2);

            if(self->_priv->data == NULL)
                g_warning("self->_priv->data == NULL");
            /* set value to the correct type */
            g_value_init(value, self->types[column]);

            /** 
             * Sanity checks 
             */
             g_assert((n < self->num_rows || n == 0));
            g_assert(!(data == NULL && n != 0));

            /* handle row up */
            if(data == NULL && n == 0)
            {
                switch(column)
                {
                    case MPDDATA_MODEL_COL_ICON_ID:
                        g_value_set_string(value, GTK_STOCK_GO_UP);
                        break;
                    case MPDDATA_MODEL_ROW_TYPE:
                        /**
                         * Make define 
                         */
                        g_value_set_int(value, -1);
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLE:
                    case MPDDATA_MODEL_COL_MARKUP:
                        {
                            g_value_set_string(value,"..");
                            break;
                        }
                    default:
                        break;
                }
                return;
            }

            if(column == MPDDATA_MODEL_META_DATA)
            {
                if(self->_priv->use_images && self->_priv->images)
                {
                    if(self->_priv->images[n] == NULL)
                    {
                        GtkTreePath *path;
                        GtkTreeRowReference *ref;
                        path = gtk_tree_model_get_path(GTK_TREE_MODEL(self), iter);
                        ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(self),path);

                        self->_priv->images[n]= gmpc_pixbuf_loader_async_new();
                        gmpc_pixbuf_loader_async_set_rref(GMPC_PIXBUF_LOADER_ASYNC(self->_priv->images[n]), ref);
                        if(data->type == MPD_DATA_TYPE_TAG && (data->tag_type == MPD_TAG_ITEM_ARTIST || data->tag_type == MPD_TAG_ITEM_ALBUM_ARTIST) )
                        {
                            mpd_Song *song;
                            GdkPixbuf *pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-loading-cover", self->icon_size, 0,NULL);
                            gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n], pb);
                            g_object_unref(pb);
                            song = mpd_newSong();
                            song->artist = g_strdup(data->tag);
                            song->album = NULL; 
                            gmpc_meta_watcher_get_meta_path_callback(gmw,song, META_ARTIST_ART, (MetaDataCallback)self_cover_art_fetched, (gpointer)ref);
                            mpd_freeSong(song);	
                        }

                        else if(data->type == MPD_DATA_TYPE_TAG && data->tag_type == MPD_TAG_ITEM_ALBUM && self->_priv->req_artist)
                        {
                            mpd_Song *song;
                            GdkPixbuf *pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-loading-cover", self->icon_size, 0,NULL);
                            gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n],pb); 
                            g_object_unref(pb);
                            song = mpd_newSong();
                            song->artist = g_strdup(self->_priv->req_artist); 
                            song->albumartist = g_strdup(self->_priv->req_artist); 
                            song->album = g_strdup(data->tag);
                            gmpc_meta_watcher_get_meta_path_callback(gmw,song, META_ALBUM_ART, (MetaDataCallback)self_cover_art_fetched, ref);
                            mpd_freeSong(song);	
                        }
                        else if(data->type == MPD_DATA_TYPE_SONG&& data->song && data->song->album && (data->song->artist || self->_priv->req_artist)) 
                        {
                            if(data->prev && data->prev->type == MPD_DATA_TYPE_SONG && data->prev->song->album && g_utf8_collate(data->song->album, data->prev->song->album) ==0)
                            {
                                gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n],self->_priv->blank);
                            }else{
                                mpd_Song *song;
                                GdkPixbuf *pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-loading-cover", self->icon_size, 0,NULL);
                                gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n],pb);
                                g_object_unref(pb);
                                song = mpd_newSong();
                                song->artist = g_strdup((data->song->artist)?data->song->artist:self->_priv->req_artist); 
                                song->albumartist = g_strdup((data->song->albumartist)?data->song->albumartist:self->_priv->req_artist); 
                                song->album = g_strdup(data->song->album);
                                gmpc_meta_watcher_get_meta_path_callback(gmw,song, META_ALBUM_ART, (MetaDataCallback)self_cover_art_fetched, ref);
                                mpd_freeSong(song);	
                            }
                        }
                        else 
                        {
                            GdkPixbuf *pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "gmpc-no-cover", self->icon_size, 0,NULL);
                            gmpc_pixbuf_loader_async_set_pixbuf(self->_priv->images[n],pb);
                            g_object_unref(pb);
                        }
                        gtk_tree_path_free(path);
                    }
                    g_value_set_object(value, gmpc_pixbuf_loader_async_get_pixbuf(self->_priv->images[n]));
                }else{
                    g_value_set_object(value,NULL); 
                }
            }
            if(column == MPDDATA_MODEL_USERDATA)
            {
                g_value_set_pointer(value,data->userdata);

            }
            /* handle row type, this is independent of the row type */
            if(column == MPDDATA_MODEL_ROW_TYPE)
            {
                g_value_set_int(value, data->type);
                return;
            } 
            if (data->type == MPD_DATA_TYPE_TAG) {
                switch(column)
                {
                    case MPDDATA_MODEL_COL_ICON_ID:
                        switch(data->tag_type) 
                        {
                            case MPD_TAG_ITEM_ALBUM:
                                g_value_set_string(value, "media-album");
                                break;
                            case MPD_TAG_ITEM_ARTIST:
                                g_value_set_string(value, "media-artist");
                                break;
                            case MPD_TAG_ITEM_GENRE:
                                g_value_set_string(value, "media-genre");
                                break;
                            case MPD_TAG_ITEM_TRACK:
                                g_value_set_string(value, "media-num-tracks");
                                break;
                            default:
                                g_value_set_string(value, "media-tag");
                        }
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLE:
                    case MPDDATA_MODEL_COL_MARKUP:
                        {
                            g_value_set_string(value, data->tag);
                            break;
                        }
                    case MPDDATA_MODEL_COL_PATH:
                        g_value_set_string(value, data->tag);
                        break;                                         		
                    case MPDDATA_MODEL_TAG_TYPE:
                        g_value_set_int(value, data->tag_type);
                        break;                                         		
                    default:
                        break;
                }
            } else if(data->type == MPD_DATA_TYPE_DIRECTORY) {
                switch(column)
                {
                    case MPDDATA_MODEL_COL_ICON_ID:
                        g_value_set_string(value, GTK_STOCK_OPEN);
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLE:
                    case MPDDATA_MODEL_COL_SONG_TITLEFILE:
                    case MPDDATA_MODEL_COL_MARKUP:
                        {
                            gchar *basename = g_path_get_basename(data->directory);
                            g_value_set_string(value, basename);
                            g_free(basename);
                            break;
                        }
                    case MPDDATA_MODEL_COL_PATH:
                        g_value_set_string(value, data->directory);
                        break;                                         		
                    default:
                        break;
                }
            }
            else if(data->type == MPD_DATA_TYPE_PLAYLIST)
            {
                switch(column)
                {
                    case MPDDATA_MODEL_COL_ICON_ID:
                        g_value_set_string(value, "media-playlist");
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLE:
                    case MPDDATA_MODEL_COL_SONG_TITLEFILE:
                    case MPDDATA_MODEL_COL_MARKUP:
                        {
                            gchar *basename = g_path_get_basename(data->playlist->path);
                            g_value_set_string(value, basename);
                            g_free(basename);
                            break;
                        }
                    case MPDDATA_MODEL_COL_PATH:
                        g_value_set_string(value, data->playlist->path);
                        break;                                         		
                    default:
                        break;
                }
            }
            else if(data->type == MPD_DATA_TYPE_SONG)
            {
                mpd_Song *song = data->song;
                switch (column) {
                    case MPDDATA_MODEL_COL_MPDSONG:
                        g_value_set_pointer(value, song);
                        break;
                    case MPDDATA_MODEL_COL_PLAYING:
                        g_value_set_boolean(value, FALSE);
                        break;
                    case MPDDATA_MODEL_COL_PLAYING_FONT_WEIGHT:
                        g_value_set_int(value, PANGO_WEIGHT_NORMAL);
                        break;
                    case MPDDATA_MODEL_COL_MARKUP:
                        {
                            /* we want to go cache this stuff */
                            gchar buffer[1024];
                            mpd_song_markup(buffer, 1024, GMPC_MPDDATA_MODEL(model)->_priv->markup, song);
                            g_value_set_string(value, buffer);
                            break;
                        }
                    case MPDDATA_MODEL_COL_PATH:
                        g_value_set_string(value, song->file);
                        break;
										case MPDDATA_MODEL_COL_PATH_EXTENSION:
												{
													int j = strlen(song->file);
													for(;j>0&&song->file[j] != '.';j--);
													g_value_set_string(value, &(song->file)[j+1]);
													break;
												}
										case MPDDATA_MODEL_COL_PATH_DIRECTORY:
												{
													gchar *dir = g_path_get_dirname(song->file);
													g_value_set_string(value, dir);
													g_free(dir);
													break;
												}
                    case MPDDATA_MODEL_COL_SONG_ARTIST:
                        g_value_set_string(value, song->artist);
                        break;
                    case MPDDATA_MODEL_COL_SONG_ALBUM:
                        g_value_set_string(value, song->album);
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLE:
                        /* If there is a song available use that, else use the filename */
                        if(song->title) {
                            g_value_set_string(value, song->title);
                        } else if (song->name) {
                            g_value_set_string(value, song->name);
                        }else {
                            /* Use the markup stuff, this makes sure it gets processed equaly */
                            gchar buffer[1024];
                            mpd_song_markup(buffer, 1024, "%shortfile%", song);
                            g_value_set_string(value, buffer);
                        }
                        break;
                    case MPDDATA_MODEL_COL_SONG_TITLEFILE:
                        {
                            gchar *path = g_path_get_basename(song->file);
                            g_value_set_string(value, path);
                            g_free(path);
                        }
                        break;                                       			
                    case MPDDATA_MODEL_COL_SONG_GENRE:
                        g_value_set_string(value, song->genre);
                        break;
                    case MPDDATA_MODEL_COL_SONG_TRACK:
                        g_value_set_string(value, song->track);
                        break;
                    case MPDDATA_MODEL_COL_SONG_NAME:
                        g_value_set_string(value, song->name);
                        break;
                    case MPDDATA_MODEL_COL_SONG_COMPOSER:
                        g_value_set_string(value, song->composer);
                        break;
                    case MPDDATA_MODEL_COL_SONG_PERFORMER:
                        g_value_set_string(value, song->performer);
                        break;
                    case MPDDATA_MODEL_COL_SONG_DATE:
                        g_value_set_string(value, song->date);
                        break;
                    case MPDDATA_MODEL_COL_SONG_LENGTH:
                        g_value_set_int(value, song->time);
                        break;
                    case MPDDATA_MODEL_COL_SONG_LENGTH_FORMAT:
                        {
                            if(song->time >= 0) {
                                gchar *strdata = g_strdup_printf("%02i:%02i",
                                        song->time/60, song->time%60);
                                g_value_set_string(value, strdata);
                                g_free(strdata);
                            } else {
                                g_value_set_string(value, "n/a");
                            }
                        }
                        break;                             			
                    case MPDDATA_MODEL_COL_SONG_DISC:
                        g_value_set_string(value, song->disc);
                        break;
                    case MPDDATA_MODEL_COL_SONG_COMMENT:
                        g_value_set_string(value, song->comment);
                        break;                                			
                    case MPDDATA_MODEL_COL_SONG_POS:
                        g_value_set_int(value, song->pos+1);
                        break;
                    case MPDDATA_MODEL_COL_SONG_ALBUMARTIST:
                        g_value_set_string(value, song->albumartist);
                        break;
                    case MPDDATA_MODEL_COL_SONG_ID:
                        g_value_set_int(value, song->id);
                        break;

                    case MPDDATA_MODEL_COL_ICON_ID:
                        if (strstr(song->file, "://")) {
                            g_value_set_string(value, "media-stream");
                        } else {
                            g_value_set_string(value, "media-audiofile");
                        }
                        break;
                    default:
                        break;
                }
            }
        }}
#line 1278 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_iter_nth_child (GtkTreeModel * model, GtkTreeIter * iter, GtkTreeIter * parent, gint n)
{
#line 1285 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::iter_nth_child"
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (gboolean )0);
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (gboolean )0);
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (iter != NULL, (gboolean )0);
#line 713 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (n >= 0, (gboolean )0);
#line 1295 "gmpc-mpddata-model.c"
{
#line 715 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            int i;
            MpdData_real *data = NULL;
            if(parent)
                return FALSE;
            if (n >= self->num_rows || n < 0)
                return FALSE; 

            data = (MpdData_real *)self->_priv->data;
            i=0;
            if(self->has_up)
                i=1;
            for(; i < (n);i++)
            {
                data = data->next;//mpd_data_get_next_real(data, FALSE);
                g_assert(data != NULL);
            }

            if(self->has_up && n == 0)
                data = NULL;

            iter->stamp = self->_priv->stamp;
            iter->user_data = data; 
            iter->user_data2 = GINT_TO_POINTER(n);
            return TRUE;
        }}
#line 1325 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GtkTreePath * 
gmpc_mpddata_model_get_path (GtkTreeModel * self, GtkTreeIter * iter)
{
#line 1332 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_path"
#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (GtkTreePath * )0);
#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (self), (GtkTreePath * )0);
#line 744 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (iter != NULL, (GtkTreePath * )0);
#line 1340 "gmpc-mpddata-model.c"
{
#line 746 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            GtkTreePath *path = NULL;
            path = gtk_tree_path_new();
            gtk_tree_path_append_index(path, GPOINTER_TO_INT(iter->user_data2));
            return path;
        }}
#line 1349 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static GType 
gmpc_mpddata_model_get_column_type (GtkTreeModel * model, gint ind)
{
#line 1356 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_column_type"
#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (model != NULL, (GType )0);
#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GTK_IS_TREE_MODEL (model), (GType )0);
#line 754 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (ind >= 0, (GType )0);
#line 1364 "gmpc-mpddata-model.c"
{
#line 756 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            return self->types[ind];
        }}
#line 1371 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 760 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
void 
gmpc_mpddata_model_set_request_artist (GmpcMpdDataModel * self, const char * artist)
{
#line 1378 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_request_artist"
#line 760 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (self != NULL);
#line 760 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (GMPC_IS_MPDDATA_MODEL (self));
#line 1384 "gmpc-mpddata-model.c"
{
#line 763 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            int i;
            GtkTreePath *path = NULL;
            GtkTreeIter iter;
            if(self->_priv->req_artist) 
                q_free(self->_priv->req_artist);
            self->_priv->req_artist = (artist != NULL && artist[0] != '\0')?g_strdup(artist):NULL;
            /* Free possible stored images */
            if(self->_priv->images && self->_priv->use_images)
            {
                MpdData *data2 = mpd_data_get_first(self->_priv->data); 
                for(i=0;i<self->num_rows;i++)
                {
                    if(self->_priv->images[i]){
                        g_object_unref(self->_priv->images[i]);
                        self->_priv->images[i] = NULL;
                    
                        /* Update the view */
                        path = gtk_tree_path_new();
                        gtk_tree_path_append_index(path,i);
                        iter.stamp = self->_priv->stamp;
                        iter.user_data = data2;
                        iter.user_data2 =  GINT_TO_POINTER(i);
                        /* propegate change */
                        gtk_tree_model_row_changed(GTK_TREE_MODEL(self), path, &iter);
                        gtk_tree_path_free(path);
                    }
                    data2 = mpd_data_get_next_real(data2,FALSE);
                }
            }
        }}
#line 1418 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 794 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
const char * 
gmpc_mpddata_model_get_request_artist (GmpcMpdDataModel * self)
{
#line 1425 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_request_artist"
#line 794 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (const char * )0);
#line 794 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (const char * )0);
#line 1431 "gmpc-mpddata-model.c"
{
#line 797 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return self->_priv->req_artist;
        }}
#line 1437 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 800 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
long unsigned 
gmpc_mpddata_model_set_mpd_data (GmpcMpdDataModel * self, MpdData * data2)
{
#line 1444 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_mpd_data"
#line 800 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (long unsigned )0);
#line 800 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (long unsigned )0);
#line 1450 "gmpc-mpddata-model.c"
{
#line 802 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            int i;
            long unsigned retval = 0;
            GtkTreeIter iter;
            GtkTreePath *path = NULL;
            int old_num_rows = self->num_rows;
            /* Do some cleanup, like removing rows, and so */
            /* loop and remove */
            while ( self->num_rows > 0 ) {
                path = gtk_tree_path_new();
                gtk_tree_path_append_index(path, self->num_rows - 1 );
                /* propegate change */
                gtk_tree_model_row_deleted(GTK_TREE_MODEL(self), path);
                gtk_tree_path_free(path);
                self->num_rows--;
            }


            /**
             * Free if there is a list and set it to NULL 
             */
            if(self->_priv->data){
                mpd_data_free(mpd_data_get_first(self->_priv->data));
            }
            self->_priv->data = NULL;

            if(self->num_rows != 0)
                g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING,"not every row cleared %i\n",self->num_rows);
            self->num_rows =0;
            /* Free possible stored images */
            if(self->_priv->images && self->_priv->use_images)
            {
                for(i=0;i< old_num_rows;i++)
                {
                    if(self->_priv->images[i])
                        g_object_unref(self->_priv->images[i]);
                }
                q_free(self->_priv->images);
            }
            if(data2 == NULL)
            {
                self->_priv->playtime = 0;
                self_playtime_changed(self, self->_priv->playtime);
                return 0;
            }

            self->_priv->data = mpd_data_get_first(data2);
            data2 = NULL;
            if(self->_priv->sort_column == MPDDATA_MODEL_COL_ICON_ID)
            {
                self->_priv->data = misc_sort_mpddata_by_album_disc_track(self->_priv->data);
            }
            else if ( self->_priv->sort_column != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID )
            {
                self->_priv->data = misc_sort_mpddata(self->_priv->data,(GCompareDataFunc)self_sort_func,self ); 
            }

            if(self->has_up) {
                path = gtk_tree_path_new();
                gtk_tree_path_append_index(path, self->num_rows);
                iter.stamp = self->_priv->stamp;
                iter.user_data = NULL; 
                iter.user_data2 =  GINT_TO_POINTER(self->num_rows);

                self->num_rows++;
                /* propegate change */
                gtk_tree_model_row_inserted(GTK_TREE_MODEL(self), path, &iter);
                gtk_tree_path_free(path);
            }
            for(data2 = mpd_data_get_first(self->_priv->data);data2; data2 = mpd_data_get_next_real(data2,FALSE)) {
                path = gtk_tree_path_new();
                gtk_tree_path_append_index(path,self->num_rows);
                iter.stamp = self->_priv->stamp;
                iter.user_data = data2;
                iter.user_data2 =  GINT_TO_POINTER(self->num_rows);

                self->num_rows++;
                /* propegate change */
                gtk_tree_model_row_inserted(GTK_TREE_MODEL(self), path, &iter);
                gtk_tree_path_free(path);
                if(data2->type == MPD_DATA_TYPE_SONG)
                {
                    if(data2->song && data2->song->time > 0)
                        retval+= data2->song->time;
                }
            }
            if(self->_priv->use_images)
            {
                self->_priv->images = g_malloc0((self->num_rows)*sizeof(*(self->_priv->images)));
            }

            self->_priv->playtime = retval;
            self_playtime_changed(self, self->_priv->playtime);
            return retval;
        }}
#line 1548 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 900 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_get_sort_column_id (GtkTreeSortable * model, gint * sort_column_id, GtkSortType * order)
{
#line 1555 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_sort_column_id"
{
#line 902 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            if(sort_column_id) 
                *sort_column_id = self->_priv->sort_column;
            if(order)
                *order = self->_priv->sort_order;
            return TRUE;
        }}
#line 1567 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 912 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
gmpc_mpddata_model_set_sort_column_id (GtkTreeSortable * model, gint sort_column_id, GtkSortType order)
{
#line 1574 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_sort_column_id"
{
#line 914 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            gint old_col = self->_priv->sort_column;
            GtkSortType old_ord = self->_priv->sort_order;
            self->_priv->sort_column = sort_column_id;
            self->_priv->sort_order = order;
            /* trigger signal */
            if(old_col != sort_column_id || old_ord != order)
                gtk_tree_sortable_sort_column_changed(model);
            self->_priv->old_sort_column = self->_priv->sort_column;

        }}
#line 1590 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 928 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_has_default_sort_func (GtkTreeSortable * model)
{
#line 1597 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::has_default_sort_func"
{
#line 931 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return FALSE;
        }}
#line 1604 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 934 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static int 
gmpc_mpddata_model_sort_func (gpointer ppaa, gpointer ppbb, Self * self)
{
#line 1611 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::sort_func"
{
#line 936 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            MpdData_real *a = *(MpdData_real **)ppaa;
            MpdData_real *b = *(MpdData_real **)ppbb;
            int fact = (self->_priv->sort_order == GTK_SORT_ASCENDING)?-1:1;

            if(a->type != b->type )
            {
                int val = a->type - b->type; 
                return val; 
            }
            else if(a->type == b->type)
            {
                int val=0;
                GtkTreeIter iter;
                GValue va = {0,},vb = {0,};
                /* Get values from tree view, so we don't have to replicate code to sort the right entries */
                iter.user_data = a;
                iter.user_data2 = GPOINTER_TO_INT(0);
                gtk_tree_model_get_value(GTK_TREE_MODEL(self), &iter, self->_priv->sort_column, &va);
                iter.user_data = b;
                gtk_tree_model_get_value(GTK_TREE_MODEL(self), &iter, self->_priv->sort_column, &vb);
                /* if the type is a directory or a tag, always sort on the title column */
                if(a->type == MPD_DATA_TYPE_DIRECTORY || b->type == MPD_DATA_TYPE_TAG)
                {
                    const char *ca,*cb;
                    ca = g_value_get_string(&va);
                    cb = g_value_get_string(&vb);
                    if(ca && cb) {
                        gchar *aa,*bb;
                        aa = g_utf8_strdown(ca, -1);
                        bb = g_utf8_strdown(cb, -1);
                        val = g_utf8_collate(aa,bb);
                        g_free(aa);
                        g_free(bb);
                    } else {
                        val = (ca == NULL)?((cb==NULL)?0:-1):1;
                    }
                    g_value_unset(&va);
                    g_value_unset(&vb);
                    /* return */
                    return val*fact;
                }
                if(self->_priv->sort_column == MPDDATA_MODEL_COL_SONG_TRACK)
                {
                    const char *ca = g_value_get_string(&va);
                    const char *cb = g_value_get_string(&vb);
                    gint ca1 = (ca)?atoi(ca):0;
                    gint cb1 = (cb)?atoi(cb):0;
                    g_value_unset(&va);
                    g_value_unset(&vb);
                    return fact*(ca1-cb1);
                }
                else if(self->types[self->_priv->sort_column] == G_TYPE_INT)
                {
                    val = g_value_get_int(&va) - g_value_get_int(&vb);
                }
                else if (self->types[self->_priv->sort_column] == G_TYPE_STRING)
                {
                    const char *ca = g_value_get_string(&va);
                    const char *cb = g_value_get_string(&vb);
                    if(ca && cb) {
                        gchar *aa,*bb;
                        aa = g_utf8_normalize(ca, -1,G_NORMALIZE_ALL);
                        bb = g_utf8_normalize(cb, -1,G_NORMALIZE_ALL);
                        val = g_utf8_collate(aa,bb);
                        g_free(aa);
                        g_free(bb);
                    } else {
                        val = (ca == NULL)?((cb==NULL)?0:-1):1;
                    }
                }

                if (val == 0 &&
                        a->type == MPD_DATA_TYPE_SONG &&
                        b->type == MPD_DATA_TYPE_SONG && 
                        a->song->file &&
                        b->song->file)
                {
                    val = strcmp (a->song->file, b->song->file);
                }

                g_value_unset(&va);
                g_value_unset(&vb);
                return fact*val; 
            }
            return 0;
        }}
#line 1702 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1025 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
gmpc_mpddata_model_sort_column_changed (GtkTreeSortable * model)
{
#line 1709 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::sort_column_changed"
{
#line 1028 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            Self *self = GMPC_MPDDATA_MODEL(model);
            if(!self->_priv->data || !(((MpdData_real *)self->_priv->data)->next))
                return; 
            if(self->_priv->sort_column == MPDDATA_MODEL_COL_ICON_ID)
            {
                self->_priv->data = misc_sort_mpddata_by_album_disc_track(self->_priv->data); 
            }
            else if(self->_priv->sort_column !=  GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
            {
                self->_priv->data = misc_sort_mpddata(self->_priv->data,(GCompareDataFunc)self_sort_func,self ); 
            }
            self->_priv->old_sort_column = self->_priv->sort_column;

            /* tell the view that rows have changed  */    
            {
                int i=0;
                GtkTreePath *path = NULL;
                GtkTreeIter iter;
                MpdData *data2 = mpd_data_get_first(self->_priv->data); 
                if(self->has_up) i = 1;
                for(;data2; data2 = mpd_data_get_next_real(data2,FALSE)) 
                {
                    path = gtk_tree_path_new();
                    gtk_tree_path_append_index(path,i);
                    iter.stamp = self->_priv->stamp;
                    iter.user_data = data2;
                    iter.user_data2 =  GINT_TO_POINTER(i);

                    /* propegate change */
                    gtk_tree_model_row_changed(GTK_TREE_MODEL(self), path, &iter);
                    gtk_tree_path_free(path);
                    i++;
                }
            }
        }}
#line 1749 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1065 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static int 
gmpc_mpddata_model_test_sort_func (gpointer ppaa, gpointer ppbb, Self * self)
{
#line 1756 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::test_sort_func"
{
#line 1068 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            MpdData_real *a = *(MpdData_real **)ppaa;
            MpdData_real *b = *(MpdData_real **)ppbb;
            if(a->type == MPD_DATA_TYPE_TAG && b->type == MPD_DATA_TYPE_TAG)
            {
                if(a->tag_type != b->tag_type)
                    return a->tag_type - b->tag_type;
                if(a->tag== NULL && b->tag != NULL)
                    return -1;
                else if(b->tag == NULL && a->tag != NULL)
                    return 1;
                else if (a->tag  && b->tag)
                {
                    int val;
                    if(a->tag && b->tag) {
                        gchar *sa,*sb;
                        sa = g_utf8_strdown(a->tag, -1);
                        sb = g_utf8_strdown(b->tag, -1);
                        val = g_utf8_collate(sa,sb);
                        g_free(sa);
                        g_free(sb);
                    } else {
                        val = (a == NULL)?((b==NULL)?0:-1):1;
                    }
                    return val;
                }
            }
            return a->type - b->type;
        }}
#line 1789 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1101 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
long unsigned 
gmpc_mpddata_model_set_mpd_data_slow (GmpcMpdDataModel * self, MpdData * data2)
{
#line 1796 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::set_mpd_data_slow"
#line 1101 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (long unsigned )0);
#line 1101 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (long unsigned )0);
#line 1802 "gmpc-mpddata-model.c"
{
#line 1103 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	                                               
            MpdData_real *new_list = NULL;
            int i=0;
            int items=0;
            MpdData_real *original = (MpdData_real *)mpd_data_get_first(self->_priv->data);
            MpdData_real *new = (MpdData_real *) data2;
            GtkTreePath *path =NULL;
            GtkTreeIter iter;
            int old_list_size = self->num_rows;

            /* sort it identical */
            data2 = misc_sort_mpddata(data2,(GCompareDataFunc)self_test_sort_func,self ); 
            new = (MpdData_real *)data2;

            if(new) {
                MpdData_real *n = new->first;
                while(n) {
                    items++;
                    n = n->next;
                }
            }


            /* Free possible stored images */
            /**
             * TODO: Don't free the list, but grow it to MAX(items, self->num_rows);
             * Then after updating, resize it to new size 
             */
            /* Grow the list when needed */

            if(self->_priv->use_images)
            {
                /* Clean them, they might not be in the right place anymore */
                for(i=0;i< old_list_size; i++)
                {
                    if(self->_priv->images[i] != NULL) g_object_unref(self->_priv->images[i]);
                    self->_priv->images[i] = NULL;
                }
                if(items > self->num_rows)
                {
                    self->_priv->images = g_realloc(self->_priv->images, items*sizeof(GdkPixbuf *));
                    /* set the new ones to NUll */
                    for(i=self->num_rows;i<items;i++)
                    {
                        self->_priv->images[i] = NULL;
                    }
                }
            }




            i=0;
            /* compare lists */
            if(self->_priv->data && original == NULL) g_warning("weirdness\n");
            if(self->_priv->data)
            {
                int has_next;
                do
                {
                    has_next = 0;
                    if(new == NULL)
                    {
                        if(self->num_rows > items)
                        {
                            MpdData_real *n = original->next;
                            /* remove current row */
                            self->num_rows--;

                            path = gtk_tree_path_new();
                            gtk_tree_path_append_index(path,i);

                            /* propegate change */
                            gtk_tree_model_row_deleted(GTK_TREE_MODEL(self), path);
                            gtk_tree_path_free(path);
                           
                            original =(MpdData_real *) mpd_data_delete_item((MpdData *)original); 
                            self->_priv->data = mpd_data_get_first((MpdData *)original);

                            original=n;
                            has_next = (original )?1:0;
                        }
                    }
                    else
                    {
                        int compare;
                        gchar *aa,*bb;
                        aa = g_utf8_strdown(new->tag, -1);
                        bb = g_utf8_strdown(original->tag, -1);
                        compare = g_utf8_collate(aa,bb);
                        g_free(aa);
                        g_free(bb);
                        //int compare = //strcmp(new->tag, original->tag);
                        if(compare < 0)
                        {
                            /* add */
                            MpdData_real *n = (MpdData_real *) mpd_new_data_struct();
                            n->type = MPD_DATA_TYPE_TAG;
                            n->tag_type = new->tag_type;
                            n->tag = new->tag;
                            new->tag = NULL;

                            /* add */

                            self->num_rows++;
                            n->prev = original->prev;

                            if(original->prev)
                                original->prev->next = n;
                            n->next = original;
                            n->first = original->first;
                            original->prev = n;
                            if(n->prev == NULL){
                                MpdData_real *fiter;
                                for(fiter = n;fiter;fiter = fiter->next){
                                    fiter->first = n;
                                }
                            }

                            self->_priv->data = mpd_data_get_first((MpdData *)original);
                            {
                                path = gtk_tree_path_new();
                                gtk_tree_path_append_index(path,i);
                                iter.stamp = self->_priv->stamp;
                                iter.user_data = n;
                                iter.user_data2 =  GINT_TO_POINTER(i);

                                gtk_tree_model_row_inserted(GTK_TREE_MODEL(self), path, &iter);
                                gtk_tree_path_free(path);
                            }
                            /* mark for insert */
                            new=new->next;
                            i++;
                            has_next = 1;
                        }
                        else if (compare > 0)
                        {
                            MpdData_real *n = original->next;
                            path = gtk_tree_path_new();
                            gtk_tree_path_append_index(path,i);
                            /* propegate change */

                            self->num_rows--;
                            gtk_tree_model_row_deleted(GTK_TREE_MODEL(self), path);
                            gtk_tree_path_free(path);


                            original = (MpdData_real *)mpd_data_delete_item((MpdData *)original); 
                            self->_priv->data = mpd_data_get_first((MpdData *)original);
                            original = n;
                            //original = original->next; 
                            has_next = (original )?1:0;

                        }else{
                            new = new->next;
                            original = original->next;
                            has_next = (original )?1:0;
                            i++;
                        }
                    }            
                }while(has_next);
            }
            /* add entries remaining in new */
            if(new)
            {
                
                new_list = (MpdData_real *) self->_priv->data;
                while(new_list && new_list->next) new_list = new_list->next;
                do{
                    new_list = (MpdData_real *)mpd_new_data_struct_append((MpdData*)new_list); 
                    new_list->type = MPD_DATA_TYPE_TAG;
                    new_list->tag_type = new->tag_type;
                    new_list->tag = new->tag;
                    new->tag = NULL;

                    self->_priv->data = (MpdData *)new_list->first;
                    if(self->_priv->data == NULL) g_warning("self->_priv->data == NULL");
                    self->num_rows++;
                    {
                        path = gtk_tree_path_new();
                        gtk_tree_path_append_index(path,i);
                        iter.stamp = self->_priv->stamp;
                        iter.user_data = new_list;
                        iter.user_data2 =  GINT_TO_POINTER(i);

                        gtk_tree_model_row_inserted(GTK_TREE_MODEL(self), path, &iter);
                        gtk_tree_path_free(path);
                    }

                    new = new->next;
                    i++;
                }while(new);
            }


            if(self->_priv->use_images){
                if(self->num_rows < old_list_size){
                    for(i=self->num_rows;i< old_list_size; i++)
                    {
                        /* clean it */
                        if(self->_priv->images[i] != NULL) g_object_unref(self->_priv->images[i]);
                    }
                    self->_priv->images = g_realloc(self->_priv->images, (self->num_rows)*sizeof(GdkPixbuf *));
                }
            }

   

            if(data2)
                mpd_data_free(data2);

            g_assert(items == self->num_rows);
            return 0;                    
        }}
#line 2019 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
void 
gmpc_mpddata_model_playtime_changed (GmpcMpdDataModel * self, gulong playtime)
{
#line 2026 "gmpc-mpddata-model.c"
	GValue ___param_values[2];
	GValue ___return_val;

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

#line 1318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (self != NULL);
#line 1318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (GMPC_IS_MPDDATA_MODEL (self));
#line 2037 "gmpc-mpddata-model.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_LONG);
	g_value_set_long (&___param_values[1], (glong ) playtime);

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

	g_value_unset (&___param_values[0]);
	g_value_unset (&___param_values[1]);
}
#line 1318 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static void 
___real_gmpc_mpddata_model_playtime_changed (GmpcMpdDataModel * self G_GNUC_UNUSED, gulong playtime)
{
#line 2059 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::playtime_changed"
{
#line 1321 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            return;
        }}
#line 2066 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1325 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
gulong 
gmpc_mpddata_model_get_playtime (GmpcMpdDataModel * self)
{
#line 2073 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_playtime"
#line 1325 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (gulong )0);
#line 1325 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (gulong )0);
#line 2079 "gmpc-mpddata-model.c"
{
#line 1328 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
        return self->_priv->playtime;
    }}
#line 2085 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1331 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
gint 
gmpc_mpddata_model_get_pos (GmpcMpdDataModel * self, GtkTreeIter * iter)
{
#line 2092 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::get_pos"
#line 1331 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (gint )0);
#line 1331 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (gint )0);
#line 2098 "gmpc-mpddata-model.c"
{
#line 1334 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
	    g_assert(iter->stamp == self->_priv->stamp);
	    return GPOINTER_TO_INT(iter->user_data2);
    }}
#line 2105 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1339 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
void 
gmpc_mpddata_model_disable_image (GmpcMpdDataModel * self)
{
#line 2112 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::disable_image"
#line 1339 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (self != NULL);
#line 1339 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_if_fail (GMPC_IS_MPDDATA_MODEL (self));
#line 2118 "gmpc-mpddata-model.c"
{
#line 1342 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
        g_assert(self->_priv->data == NULL);
        self->_priv->use_images = FALSE;
    }}
#line 2125 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1347 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
MpdData * 
gmpc_mpddata_model_steal_mpd_data (GmpcMpdDataModel * self)
{
#line 2132 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::steal_mpd_data"
#line 1347 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (self != NULL, (MpdData * )0);
#line 1347 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	g_return_val_if_fail (GMPC_IS_MPDDATA_MODEL (self), (MpdData * )0);
#line 2138 "gmpc-mpddata-model.c"
{
#line 1350 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
        GtkTreePath *path;
        int i;
        int old_num_rows = self->num_rows;
        MpdData *data = self->_priv->data; 
        while ( self->num_rows > 0 ) {
            path = gtk_tree_path_new();
            gtk_tree_path_append_index(path, self->num_rows - 1 );
            /* propegate change */
            gtk_tree_model_row_deleted(GTK_TREE_MODEL(self), path);
            gtk_tree_path_free(path);
            self->num_rows--;
        }

        /* Clear */
        self->_priv->data = NULL;
        /* Free possible stored images */
        if(self->_priv->images && self->_priv->use_images)
        {
            for(i=0;i<  old_num_rows;i++)
            {
                if(self->_priv->images[i])
                    g_object_unref(self->_priv->images[i]);
            }
            q_free(self->_priv->images);
        }
        self->_priv->playtime = 0;
        self_playtime_changed(self, self->_priv->playtime);

        return mpd_data_get_first(data);
    }}
#line 2172 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1386 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_row_draggable (GtkTreeDragSource * drag_source, GtkTreePath * path)
{
#line 2179 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::row_draggable"
{
#line 1388 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            GtkTreeIter iter;
            if(gtk_tree_model_get_iter(GTK_TREE_MODEL(drag_source), &iter, path))
            {
                MpdData *data = iter.user_data; 
                if(data->type == MPD_DATA_TYPE_SONG) {
                    return TRUE;
                }
            }
            return FALSE;
        }}
#line 2194 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1401 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_drag_data_delete (GtkTreeDragSource * drag_source, GtkTreePath * path)
{
#line 2201 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::drag_data_delete"
{
#line 1403 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
			return TRUE;
		}}
#line 2208 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__

#line 1407 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
static gboolean 
gmpc_mpddata_model_drag_data_get (GtkTreeDragSource * drag_source, GtkTreePath * path, GtkSelectionData * selection_data)
{
#line 2215 "gmpc-mpddata-model.c"
#define __GOB_FUNCTION__ "Gmpc:MpdData:Model::drag_data_get"
{
#line 1409 "/usr/src/extras/gmpc/gmpc-11.8.16-2.x86_64/src/gmpc-11.8.16/src/gmpc-mpddata-model.gob"
	
            if(!gtk_tree_set_row_drag_data(selection_data,GTK_TREE_MODEL(drag_source), path)) {
                return FALSE;
            }
			return TRUE;
		}}
#line 2225 "gmpc-mpddata-model.c"
#undef __GOB_FUNCTION__
