Index: sources/rb-library-child-source.c
===================================================================
--- sources/rb-library-child-source.c	(Revision 0)
+++ sources/rb-library-child-source.c	(Revision 0)
@@ -0,0 +1,196 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ *  Copyright (C) 2008 Christian Becke <christianbecke@gmail.com> 
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+ *
+ */
+
+#include "config.h"
+
+#include "rb-library-child-source.h"
+
+static void rb_library_child_source_class_init (RBLibraryChildSourceClass *klass);
+static void rb_library_child_source_init (RBLibraryChildSource *source);
+static void rb_library_child_source_dispose (GObject *object);
+static void rb_library_child_source_finalize (GObject *object);
+static void rb_library_child_source_set_property (GObject *object,
+							guint prop_id,
+							const GValue *value,
+							GParamSpec *pspec);
+static void rb_library_child_source_get_property (GObject *object,
+							guint prop_id,
+							GValue *value,
+							GParamSpec *pspec);
+static GObject *rb_library_child_source_constructor (GType type, guint n_construct_properties,
+						      GObjectConstructParam *construct_properties);
+
+
+/* RBSource implementations */
+static char *impl_get_browser_key (RBSource *source);
+
+struct _RBLibraryChildSourcePrivate
+{
+	RBSource *parent_source;
+};
+
+enum
+{
+	PROP_0,
+	PROP_PARENT_SOURCE
+};
+
+G_DEFINE_TYPE (RBLibraryChildSource, rb_library_child_source, RB_TYPE_AUTO_PLAYLIST_SOURCE)
+#define RB_LIBRARY_CHILD_SOURCE_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), RB_TYPE_LIBRARY_CHILD_SOURCE, RBLibraryChildSourcePrivate))
+
+static void
+rb_library_child_source_class_init (RBLibraryChildSourceClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	RBSourceClass *source_class = RB_SOURCE_CLASS (klass);
+
+	object_class->set_property = rb_library_child_source_set_property;
+	object_class->get_property = rb_library_child_source_get_property;
+
+	object_class->constructor = rb_library_child_source_constructor;
+	object_class->dispose = rb_library_child_source_dispose;
+	object_class->finalize = rb_library_child_source_finalize;
+
+	source_class->impl_get_browser_key = impl_get_browser_key;
+
+	g_object_class_install_property (object_class,
+					PROP_PARENT_SOURCE,
+					g_param_spec_object ("parent-source",
+							"Parent source",
+							"Parent source object",
+							RB_TYPE_SOURCE,
+							G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_type_class_add_private (klass, sizeof (RBLibraryChildSourcePrivate));
+}
+
+static void
+rb_library_child_source_init (RBLibraryChildSource *source)
+{
+	source->priv = RB_LIBRARY_CHILD_SOURCE_GET_PRIVATE (source);
+}
+
+static void
+rb_library_child_source_dispose (GObject *object)
+{
+	RBLibraryChildSourcePrivate *priv = RB_LIBRARY_CHILD_SOURCE_GET_PRIVATE (object);
+
+	if (priv->parent_source) {
+		g_object_unref (priv->parent_source);
+		priv->parent_source = NULL;
+	}
+
+	G_OBJECT_CLASS (rb_library_child_source_parent_class)->dispose (object);
+}
+
+static void
+rb_library_child_source_finalize (GObject *object)
+{
+	RBLibraryChildSource *source;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (RB_IS_LIBRARY_CHILD_SOURCE (object));
+
+	source = RB_LIBRARY_CHILD_SOURCE (object);
+
+	g_return_if_fail (source->priv != NULL);
+
+	G_OBJECT_CLASS (rb_library_child_source_parent_class)->finalize (object);
+}
+
+static GObject *
+rb_library_child_source_constructor (GType type, guint n_construct_properties,
+				      GObjectConstructParam *construct_properties)
+{
+	RBLibraryChildSource *source;
+
+	source = RB_LIBRARY_CHILD_SOURCE (G_OBJECT_CLASS (rb_library_child_source_parent_class)
+			->constructor (type, n_construct_properties, construct_properties));
+
+	return G_OBJECT (source);
+}
+
+RBSource *
+rb_library_child_source_new (RBShell *shell, const char *name, gboolean local, RBSource *parent_source)
+{
+	if (name == NULL)
+		name = "";
+
+	return RB_SOURCE (g_object_new (RB_TYPE_LIBRARY_CHILD_SOURCE,
+					"name", name,
+					"shell", shell,
+					"is-local", local,
+					"parent-source", parent_source,
+					"entry-type", RHYTHMDB_ENTRY_TYPE_SONG,
+					"source-group", RB_SOURCE_GROUP_PLAYLISTS,
+					NULL));
+}
+
+static void
+rb_library_child_source_set_property (GObject *object,
+					guint prop_id,
+					const GValue *value,
+					GParamSpec *pspec)
+{
+	RBLibraryChildSourcePrivate *priv = RB_LIBRARY_CHILD_SOURCE_GET_PRIVATE (object);
+	
+	switch (prop_id) {
+	case PROP_PARENT_SOURCE:
+		priv->parent_source = g_value_get_object (value);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+}
+
+static void
+rb_library_child_source_get_property (GObject *object,
+					guint prop_id,
+					GValue *value,
+					GParamSpec *pspec)
+{
+	RBLibraryChildSourcePrivate *priv = RB_LIBRARY_CHILD_SOURCE_GET_PRIVATE (object);
+
+	switch (prop_id) {
+	case PROP_PARENT_SOURCE:
+		g_value_set_object (value, priv->parent_source);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+		break;
+	}
+
+}
+
+static char *
+impl_get_browser_key (RBSource *source)
+{
+	RBSource *parent_source;
+	
+	g_object_get (source, "parent-source", &parent_source, NULL);
+
+	if (parent_source) {
+		return rb_source_get_browser_key (parent_source);
+	}
+
+	return NULL;
+}
+
Index: sources/rb-library-child-source.h
===================================================================
--- sources/rb-library-child-source.h	(Revision 0)
+++ sources/rb-library-child-source.h	(Revision 0)
@@ -0,0 +1,61 @@
+/*
+ *  Copyright (C) 2008 Christian Becke <christianbecke@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
+ *
+ */
+
+/*
+ * Header for library child class
+ */
+
+#ifndef __RB_LIBRARY_CHILD_SOURCE_H
+#define __RB_LIBRARY_CHILD_SOURCE_H
+
+#include "rb-auto-playlist-source.h"
+
+G_BEGIN_DECLS
+
+#define RB_TYPE_LIBRARY_CHILD_SOURCE         (rb_library_child_source_get_type ())
+#define RB_LIBRARY_CHILD_SOURCE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_LIBRARY_CHILD_SOURCE, RBLibraryChildSource))
+#define RB_LIBRARY_CHILD_SOURCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_LIBRARY_CHILD_SOURCE, RBLibraryChildSourceClass))
+#define RB_IS_LIBRARY_CHILD_SOURCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_LIBRARY_CHILD_SOURCE))
+#define RB_IS_LIBRARY_CHILD_SOURCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_LIBRARY_CHILD_SOURCE))
+#define RB_LIBRARY_CHILD_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_LIBRARY_CHILD_SOURCE, RBLibraryChildSourceClass))
+
+typedef struct _RBLibraryChildSourcePrivate RBLibraryChildSourcePrivate;
+
+typedef struct
+{
+	RBAutoPlaylistSource parent;
+
+	RBLibraryChildSourcePrivate *priv;
+} RBLibraryChildSource;
+
+typedef struct
+{
+	RBAutoPlaylistSourceClass parent;
+} RBLibraryChildSourceClass;
+
+GType		rb_library_child_source_get_type 	(void);
+
+RBSource *	rb_library_child_source_new		(RBShell *shell,
+							 const char *name,
+							 gboolean local,
+							 RBSource *parent_source);
+
+G_END_DECLS
+
+#endif /* __RB_LIBRARY_CHILD_SOURCE_H */
Index: sources/rb-library-source.c
===================================================================
--- sources/rb-library-source.c	(Revision 5623)
+++ sources/rb-library-source.c	(Arbeitskopie)
@@ -44,6 +44,7 @@
 #include "rb-library-source.h"
 #include "rb-removable-media-manager.h"
 #include "rb-auto-playlist-source.h"
+#include "rb-library-child-source.h"
 
 static void rb_library_source_class_init (RBLibrarySourceClass *klass);
 static void rb_library_source_init (RBLibrarySource *source);
@@ -1346,7 +1347,7 @@
 	rb_entry_view_get_sorting_order (rb_source_get_entry_view (RB_SOURCE (library_source)),
 					 &sort_column, &sort_order);
 
-	source = rb_auto_playlist_source_new (shell, name, FALSE);
+	source = rb_library_child_source_new (shell, name, FALSE, RB_SOURCE (library_source));
 	query = rhythmdb_query_parse (library_source->priv->db,
 				      RHYTHMDB_QUERY_PROP_EQUALS, RHYTHMDB_PROP_TYPE, entry_type,
 				      RHYTHMDB_QUERY_PROP_PREFIX, RHYTHMDB_PROP_LOCATION, path,
Index: sources/Makefile.am
===================================================================
--- sources/Makefile.am	(Revision 5623)
+++ sources/Makefile.am	(Arbeitskopie)
@@ -37,6 +37,8 @@
 	rb-missing-files-source.h	\
 	rb-import-errors-source.c	\
 	rb-import-errors-source.h	\
+	rb-library-child-source.c	\
+	rb-library-child-source.h	\
 	$(NULL)
 
 INCLUDES =						\
