[rygel-gst-0-10-plugins] Containers cleanup.



commit 1ae8a02bf178b79e29cfb83bf2c155f7bc669c90
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Mon Jan 21 15:54:28 2013 +0100

    Containers cleanup.
    
    This is still work in progress.

 src/media-export/rygel-media-export-db-container.c |  243 +++++-----
 src/media-export/rygel-media-export-db-container.h |    5 +-
 .../rygel-media-export-dummy-container.c           |  327 ++++++++-----
 .../rygel-media-export-dummy-container.h           |   11 +-
 .../rygel-media-export-leaf-query-container.c      |  451 ++++-------------
 .../rygel-media-export-leaf-query-container.h      |   58 +++
 .../rygel-media-export-node-query-container.c      |  223 +++------
 .../rygel-media-export-node-query-container.h      |   60 +++
 .../rygel-media-export-null-container.c            |  287 +++--------
 .../rygel-media-export-null-container.h            |    6 +-
 .../rygel-media-export-query-container-factory.c   |   84 +----
 .../rygel-media-export-query-container-factory.h   |   76 +++
 .../rygel-media-export-query-container.c           |  515 +++++++++-----------
 .../rygel-media-export-query-container.h           |   22 +-
 .../rygel-media-export-root-container.c            |   36 +-
 15 files changed, 1024 insertions(+), 1380 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-db-container.c b/src/media-export/rygel-media-export-db-container.c
index 0f97206..a2a6420 100644
--- a/src/media-export/rygel-media-export-db-container.c
+++ b/src/media-export/rygel-media-export-db-container.c
@@ -28,10 +28,10 @@ static void
 rygel_media_export_db_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (RygelMediaExportDBContainer,
-			 rygel_media_export_db_container,
-			 RYGEL_TYPE_MEDIA_CONTAINER,
-			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_SEARCHABLE_CONTAINER,
-						rygel_media_export_db_container_rygel_searchable_container_interface_init))
+                         rygel_media_export_db_container,
+                         RYGEL_TYPE_MEDIA_CONTAINER,
+                         G_IMPLEMENT_INTERFACE (RYGEL_TYPE_SEARCHABLE_CONTAINER,
+                                                rygel_media_export_db_container_rygel_searchable_container_interface_init))
 
 typedef struct _RygelMediaExportDBContainerSearchData RygelMediaExportDBContainerSearchData;
 
@@ -48,8 +48,8 @@ struct _RygelMediaExportDBContainerSearchData {
 
 #define RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_PRIVATE(o) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
-				RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, \
-				RygelMediaExportDBContainerPrivate))
+                                RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, \
+                                RygelMediaExportDBContainerPrivate))
 
 enum  {
   RYGEL_MEDIA_EXPORT_DB_CONTAINER_DUMMY_PROPERTY,
@@ -93,6 +93,7 @@ on_media_container_updated (RygelMediaContainer  *sender,
 static void
 rygel_media_export_db_container_constructed (GObject *object)
 {
+  RygelMediaExportMediaCache *cache = rygel_media_export_media_cache_get_default (NULL);
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
   GeeArrayList *classes = gee_array_list_new (G_TYPE_STRING,
                                               (GBoxedCopyFunc) g_strdup,
@@ -104,6 +105,7 @@ rygel_media_export_db_container_constructed (GObject *object)
   rygel_searchable_container_set_search_classes (RYGEL_SEARCHABLE_CONTAINER (self),
                                                  classes);
   g_object_unref (classes);
+  self->priv->media_db = cache;
   g_signal_connect_object (self,
                            "container-updated",
                            G_CALLBACK (on_media_container_updated),
@@ -113,49 +115,47 @@ rygel_media_export_db_container_constructed (GObject *object)
 }
 
 RygelMediaExportDBContainer *
-rygel_media_export_db_container_new (RygelMediaExportMediaCache *media_db,
-				     const gchar                *id,
-				     const gchar                *title) {
+rygel_media_export_db_container_new (const gchar *id,
+                                     const gchar *title) {
   return RYGEL_MEDIA_EXPORT_DB_CONTAINER (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER,
-							"id", id,
-							"parent", NULL,
-							"title", title,
-							"child-count", 0,
-							"media-db", media-db,
-							NULL));
+                                                        "id", id,
+                                                        "parent", NULL,
+                                                        "title", title,
+                                                        "child-count", 0,
+                                                        NULL));
 }
 
 static void
 rygel_media_export_db_container_real_get_children (RygelMediaContainer *base,
-						   guint                offset,
-						   guint                max_count,
-						   const gchar         *sort_criteria,
-						   GCancellable        *cancellable,
-						   GAsyncReadyCallback  callback,
-						   gpointer             user_data) {
+                                                   guint                offset,
+                                                   guint                max_count,
+                                                   const gchar         *sort_criteria,
+                                                   GCancellable        *cancellable,
+                                                   GAsyncReadyCallback  callback,
+                                                   gpointer             user_data) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
   GError *inner_error = NULL;
   RygelMediaObjects *objects = rygel_media_export_media_cache_get_children (self->priv->media_db,
-									    base,
-									    sort_criteria,
-									    offset,
-									    max_count,
-									    &inner_error);
+                                                                            base,
+                                                                            sort_criteria,
+                                                                            offset,
+                                                                            max_count,
+                                                                            &inner_error);
   GSimpleAsyncResult *simple;
 
   if (inner_error) {
     simple = g_simple_async_result_new_take_error (G_OBJECT (self),
-						   callback,
-						   user_data,
-						   inner_error);
+                                                   callback,
+                                                   user_data,
+                                                   inner_error);
   } else {
     simple = g_simple_async_result_new (G_OBJECT (self),
-					callback,
-					user_data,
-					rygel_media_export_db_container_real_get_children);
+                                        callback,
+                                        user_data,
+                                        rygel_media_export_db_container_real_get_children);
     g_simple_async_result_set_op_res_gpointer (simple,
-					       objects,
-					       g_object_unref);
+                                               objects,
+                                               g_object_unref);
 
   }
   g_simple_async_result_complete_in_idle (simple);
@@ -197,15 +197,15 @@ rygel_media_export_db_container_real_search_data_free (gpointer user_data) {
 
 static void
 rygel_media_export_db_container_search_ready (GObject      *source_object,
-					      GAsyncResult *res,
-					      gpointer      user_data) {
+                                              GAsyncResult *res,
+                                              gpointer      user_data) {
   RygelMediaExportDBContainerSearchData *data = (RygelMediaExportDBContainerSearchData *) user_data;
   RygelSearchableContainer *searchable = RYGEL_SEARCHABLE_CONTAINER (source_object);
   GError *inner_error = NULL;
   RygelMediaObjects *objects = rygel_searchable_container_simple_search_finish (searchable,
-										res,
-										&data->total_matches,
-										&inner_error);
+                                                                                res,
+                                                                                &data->total_matches,
+                                                                                &inner_error);
 
   if (inner_error) {
     g_simple_async_result_take_error (data->async_result, inner_error);
@@ -218,13 +218,13 @@ rygel_media_export_db_container_search_ready (GObject      *source_object,
 
 static void
 rygel_media_export_db_container_real_search (RygelSearchableContainer *base,
-					     RygelSearchExpression    *expression,
-					     guint                     offset,
-					     guint                     max_count,
-					     const gchar              *sort_criteria,
-					     GCancellable             *cancellable,
-					     GAsyncReadyCallback       callback,
-					     gpointer                  user_data) {
+                                             RygelSearchExpression    *expression,
+                                             guint                     offset,
+                                             guint                     max_count,
+                                             const gchar              *sort_criteria,
+                                             GCancellable             *cancellable,
+                                             GAsyncReadyCallback       callback,
+                                             gpointer                  user_data) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
   gint id = rygel_media_object_get_id (RYGEL_MEDIA_OBJECT (self));
   GError *inner_error = NULL;
@@ -232,18 +232,18 @@ rygel_media_export_db_container_real_search (RygelSearchableContainer *base,
   GSimpleAsyncResult *simple;
   gboolean do_simple_search = FALSE;
   RygelMediaObjects *objects = rygel_media_export_media_cache_get_objects_by_search_expression (self->priv->media_db,
-												expression,
-												id,
-												sort_criteria,
-												offset,
-												max_count,
-												&total_matches,
-												&inner_error);
+                                                                                                expression,
+                                                                                                id,
+                                                                                                sort_criteria,
+                                                                                                offset,
+                                                                                                max_count,
+                                                                                                &total_matches,
+                                                                                                &inner_error);
 
   if (inner_error &&
       g_error_matches (inner_error,
-		       RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR,
-		       RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
+                       RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR,
+                       RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
     do_simple_search = TRUE;
     g_error_free (inner_error);
     inner_error = NULL;
@@ -251,30 +251,30 @@ rygel_media_export_db_container_real_search (RygelSearchableContainer *base,
 
   if (inner_error) {
     simple = g_simple_async_result_new_take_error (G_OBJECT (self),
-						   callback,
-						   user_data,
-						   inner_error);
+                                                   callback,
+                                                   user_data,
+                                                   inner_error);
   } else {
     RygelMediaExportDBContainerSearchData *data = g_slice_new0 (RygelMediaExportDBContainerSearchData);
 
     simple = g_simple_async_result_new (G_OBJECT (self),
-					callback,
-					user_data,
-					rygel_media_export_db_container_real_search);
+                                        callback,
+                                        user_data,
+                                        rygel_media_export_db_container_real_search);
     g_simple_async_result_set_op_res_gpointer (simple,
-					       data,
-					       rygel_media_export_db_container_real_search_data_free);
+                                               data,
+                                               rygel_media_export_db_container_real_search_data_free);
 
     if (do_simple_search) {
       data->async_result = simple;
       rygel_searchable_container_simple_search (base,
-						expression,
-						offset,
-						max_count,
-						sort_criteria,
-						cancellable,
-						rygel_media_export_db_container_search_ready,
-						data);
+                                                expression,
+                                                offset,
+                                                max_count,
+                                                sort_criteria,
+                                                cancellable,
+                                                rygel_media_export_db_container_search_ready,
+                                                data);
       return;
     } else {
       data->result = objects;
@@ -288,9 +288,9 @@ rygel_media_export_db_container_real_search (RygelSearchableContainer *base,
 
 static RygelMediaObjects *
 rygel_media_export_db_container_real_search_finish (RygelSearchableContainer  *base G_GNUC_UNUSED,
-						    GAsyncResult              *res,
-						    guint                     *total_matches,
-						    GError                   **error) {
+                                                    GAsyncResult              *res,
+                                                    guint                     *total_matches,
+                                                    GError                   **error) {
   RygelMediaObjects* result;
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
   RygelMediaExportDBContainerSearchData* data;
@@ -309,29 +309,29 @@ rygel_media_export_db_container_real_search_finish (RygelSearchableContainer  *b
 
 static void
 rygel_media_export_db_container_real_find_object (RygelMediaContainer *base,
-						  const gchar         *id,
-						  GCancellable        *cancellable,
-						  GAsyncReadyCallback  callback,
-						  gpointer             user_data) {
+                                                  const gchar         *id,
+                                                  GCancellable        *cancellable,
+                                                  GAsyncReadyCallback  callback,
+                                                  gpointer             user_data) {
   GError *inner_error = NULL;
   RygelMediaObject *object = rygel_media_export_media_cache_get_object (self->priv->media_db,
-									id,
-									&inner_error);
+                                                                        id,
+                                                                        &inner_error);
   GSimpleAsyncResult *simple;
 
   if (inner_error) {
     simple = g_simple_async_result_new_take_error (G_OBJECT (self),
-						   callback,
-						   user_data,
-						   inner_error);
+                                                   callback,
+                                                   user_data,
+                                                   inner_error);
   } else {
     simple = g_simple_async_result_new (G_OBJECT (self),
-					callback,
-					user_data,
-					rygel_media_export_db_container_real_find_object);
+                                        callback,
+                                        user_data,
+                                        rygel_media_export_db_container_real_find_object);
     g_simple_async_result_set_op_res_gpointer (simple,
-					       object,
-					       g_object_unref);
+                                               object,
+                                               g_object_unref);
   }
   g_simple_async_result_complete_in_idle (simple);
   g_object_unref (simple);
@@ -340,8 +340,8 @@ rygel_media_export_db_container_real_find_object (RygelMediaContainer *base,
 
 static RygelMediaObject *
 rygel_media_export_db_container_real_find_object_finish (RygelMediaContainer  *base,
-							 GAsyncResult         *res,
-							 GError              **error) {
+                                                         GAsyncResult         *res,
+                                                         GError              **error) {
   RygelMediaObject *result;
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
 
@@ -367,7 +367,7 @@ rygel_media_export_db_container_real_get_search_classes (RygelSearchableContaine
 
 static void
 rygel_media_export_db_container_real_set_search_classes (RygelSearchableContainer *base,
-							 GeeArrayList             *value) {
+                                                         GeeArrayList             *value) {
   RygelMediaExportDBContainer* self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
   GeeArrayList *old = self->priv->search_classes;
 
@@ -405,9 +405,9 @@ rygel_media_export_db_container_dispose (GObject *object) {
 
 static void
 rygel_media_export_db_container_get_property (GObject    *object,
-					      guint       property_id,
-					      GValue     *value,
-					      GParamSpec *pspec) {
+                                              guint       property_id,
+                                              GValue     *value,
+                                              GParamSpec *pspec) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
   RygelMediaExportDBContainerPrivate *priv = self->priv;
 
@@ -428,21 +428,16 @@ rygel_media_export_db_container_get_property (GObject    *object,
 
 static void
 rygel_media_export_db_container_set_property (GObject      *object,
-					      guint         property_id,
-					      const GValue *value,
-					      GParamSpec   *pspec) {
+                                              guint         property_id,
+                                              const GValue *value,
+                                              GParamSpec   *pspec) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
-  RygelMediaExportDBContainer *priv = self->priv;
+  RygelMediaExportDBContainerPrivate *priv = self->priv;
 
   switch (property_id) {
   case RYGEL_MEDIA_EXPORT_DB_CONTAINER_SEARCH_CLASSES:
     rygel_searchable_container_set_search_classes (RYGEL_SEARCHABLE_CONTAINER (self),
-						   g_value_get_object (value));
-    break;
-
-  case RYGEL_MEDIA_EXPORT_DB_CONTAINER_MEDIA_DB:
-    /* construct only property */
-    priv->media_db = g_value_dup_object (value);
+                                                   g_value_get_object (value));
     break;
 
   default:
@@ -465,31 +460,29 @@ rygel_media_export_db_container_class_init (RygelMediaExportDBContainerClass *db
   object_class->dispose = rygel_media_export_db_container_dispose;
 
   g_object_class_install_property (object_class,
-				   RYGEL_MEDIA_EXPORT_DB_CONTAINER_SEARCH_CLASSES,
-				   g_param_spec_object ("search-classes",
-							"search-classes",
-							"search-classes",
-							GEE_TYPE_ARRAY_LIST,
-							G_PARAM_STATIC_NAME |
-							G_PARAM_STATIC_NICK |
-							G_PARAM_STATIC_BLURB |
-							G_PARAM_READABLE |
-							G_PARAM_WRITABLE));
+                                   RYGEL_MEDIA_EXPORT_DB_CONTAINER_SEARCH_CLASSES,
+                                   g_param_spec_object ("search-classes",
+                                                        "search-classes",
+                                                        "search-classes",
+                                                        GEE_TYPE_ARRAY_LIST,
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_BLURB |
+                                                        G_PARAM_READABLE |
+                                                        G_PARAM_WRITABLE));
   g_object_class_install_property (object_class,
-				   RYGEL_MEDIA_EXPORT_DB_CONTAINER_MEDIA_DB,
-				   g_param_spec_object ("media-db",
-							"media-db",
-							"media-db",
-							RYGEL_MEDIA_EXPORT_MEDIA_CACHE,
-							G_PARAM_STATIC_NAME |
-							G_PARAM_STATIC_NICK |
-							G_PARAM_STATIC_BLURB |
-							G_PARAM_READABLE |
-							G_PARAM_WRITABLE |
-							G_PARAM_CONSTRUCT_ONLY));
+                                   RYGEL_MEDIA_EXPORT_DB_CONTAINER_MEDIA_DB,
+                                   g_param_spec_object ("media-db",
+                                                        "media-db",
+                                                        "media-db",
+                                                        RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE,
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_BLURB |
+                                                        G_PARAM_READABLE));
 
   g_type_class_add_private (klass,
-			    sizeof (RygelMediaExportDBContainerPrivate));
+                            sizeof (RygelMediaExportDBContainerPrivate));
 }
 
 static void
diff --git a/src/media-export/rygel-media-export-db-container.h b/src/media-export/rygel-media-export-db-container.h
index 05828ed..cb86a3e 100644
--- a/src/media-export/rygel-media-export-db-container.h
+++ b/src/media-export/rygel-media-export-db-container.h
@@ -50,9 +50,8 @@ GType
 rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
 
 RygelMediaExportDBContainer *
-rygel_media_export_db_container_new (RygelMediaExportMediaCache *media_db,
-				     const gchar                *id,
-				     const gchar                *title);
+rygel_media_export_db_container_new (const gchar *id,
+                                     const gchar *title);
 
 RygelMediaExportMediaCache *
 rygel_media_export_db_container_get_media_db (RygelMediaExportDBContainer *self);
diff --git a/src/media-export/rygel-media-export-dummy-container.c b/src/media-export/rygel-media-export-dummy-container.c
index fdf4cae..10de2c5 100644
--- a/src/media-export/rygel-media-export-dummy-container.c
+++ b/src/media-export/rygel-media-export-dummy-container.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-dummy-container.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-dummy-container.vala, do not modify */
-
 /*
  * Copyright (C) 2009,2010 Jens Georg <mail jensge org>.
  *
@@ -24,150 +21,212 @@
 #include "rygel-media-export-dummy-container.h"
 #include "rygel-media-export-media-cache.h"
 
-G_DEFINE_TYPE (RygelMediaExportDummyContainer, rygel_media_export_dummy_container, RYGEL_MEDIA_EXPORT_TYPE_NULL_CONTAINER)
-
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_construct (GType object_type, GFile* file, RygelMediaContainer* parent);
-
-void rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer* self, GFile* file);
-
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_construct (GType object_type, GFile* file, RygelMediaContainer* parent) {
-	RygelMediaExportDummyContainer * self = NULL;
-	GFile* _tmp0_;
-	gchar* _tmp1_ = NULL;
-	gchar* _tmp2_;
-	GFile* _tmp3_;
-	gchar* _tmp4_ = NULL;
-	gchar* _tmp5_;
-	RygelMediaContainer* _tmp6_;
-	GFile* _tmp7_;
-	GFile* _tmp8_;
-	GeeArrayList* _tmp9_;
-	GFile* _tmp10_;
-	gchar* _tmp11_ = NULL;
-	gchar* _tmp12_;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (file != NULL, NULL);
-	g_return_val_if_fail (parent != NULL, NULL);
-	self = (RygelMediaExportDummyContainer*) rygel_null_container_construct (object_type);
-	_tmp0_ = file;
-	_tmp1_ = rygel_media_export_media_cache_get_id (_tmp0_);
-	_tmp2_ = _tmp1_;
-	rygel_media_object_set_id ((RygelMediaObject*) self, _tmp2_);
-	g_free (_tmp2_);
-	_tmp3_ = file;
-	_tmp4_ = g_file_get_basename (_tmp3_);
-	_tmp5_ = _tmp4_;
-	rygel_media_object_set_title ((RygelMediaObject*) self, _tmp5_);
-	g_free (_tmp5_);
-	_tmp6_ = parent;
-	rygel_media_object_set_parent_ref ((RygelMediaObject*) self, _tmp6_);
-	_tmp7_ = file;
-	_tmp8_ = g_object_ref (_tmp7_);
-	g_object_unref (self->file);
-	self->file = _tmp8_;
-	_tmp9_ = ((RygelMediaObject*) self)->uris;
-	_tmp10_ = file;
-	_tmp11_ = g_file_get_uri (_tmp10_);
-	_tmp12_ = _tmp11_;
-	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, _tmp12_);
-	g_free (_tmp12_);
-	{
-		RygelMediaExportMediaCache* _tmp13_ = NULL;
-		RygelMediaExportMediaCache* _tmp14_;
-		RygelMediaExportMediaCache* _tmp15_;
-		const gchar* _tmp16_;
-		const gchar* _tmp17_;
-		GeeArrayList* _tmp18_ = NULL;
-		GeeArrayList* _tmp19_;
-		GeeArrayList* _tmp20_;
-		GeeList* _tmp21_;
-		gint _tmp22_;
-		gint _tmp23_;
-		_tmp13_ = rygel_media_export_media_cache_get_default (&_inner_error_);
-		_tmp14_ = _tmp13_;
-		if (_inner_error_ != NULL) {
-			goto __catch25_g_error;
-		}
-		_tmp15_ = _tmp14_;
-		_tmp16_ = rygel_media_object_get_id ((RygelMediaObject*) self);
-		_tmp17_ = _tmp16_;
-		_tmp18_ = rygel_media_export_media_cache_get_child_ids (_tmp15_, _tmp17_, &_inner_error_);
-		_tmp19_ = _tmp18_;
-		g_object_unref (_tmp15_);
-		_tmp20_ = _tmp19_;
-		if (_inner_error_ != NULL) {
-			goto __catch25_g_error;
-		}
-		g_object_unref (self->children);
-		self->children = (GeeList*) _tmp20_;
-		_tmp21_ = self->children;
-		_tmp22_ = gee_collection_get_size ((GeeCollection*) _tmp21_);
-		_tmp23_ = _tmp22_;
-		((RygelMediaContainer*) self)->child_count = _tmp23_;
-	}
-	goto __finally25;
-	__catch25_g_error:
-	{
-		GError* _error_ = NULL;
-		GeeArrayList* _tmp24_;
-		_error_ = _inner_error_;
-		_inner_error_ = NULL;
-		_tmp24_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
-		g_object_unref (self->children);
-		self->children = (GeeList*) _tmp24_;
-		((RygelMediaContainer*) self)->child_count = 0;
-		g_error_free (_error_);
-	}
-	__finally25:
-	if (_inner_error_ != NULL) {
-		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-		g_clear_error (&_inner_error_);
-		return NULL;
-	}
-	return self;
+G_DEFINE_TYPE (RygelMediaExportDummyContainer,
+               rygel_media_export_dummy_container,
+               RYGEL_MEDIA_EXPORT_TYPE_NULL_CONTAINER)
+
+struct _RygelMediaExportDummyContainerPrivate {
+  GFile *file;
+  GeeList *children_list;
+};
+
+#define RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER, \
+                                RygelMediaExportDummyContainerPrivate))
+
+enum  {
+  RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_DUMMY_PROPERTY,
+  RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_CHILDREN_LIST,
+  RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_FILE
+};
+
+RygelMediaExportDummyContainer *
+rygel_media_export_dummy_container_new (GFile               *file,
+                                        RygelMediaContainer *parent) {
+  RygelMediaExportDummyContainer *self;
+  gchar *id;
+  gchar *basename;
+  gchar *uri;
+  RygelMediaExportMediaCache *media_db;
+  GError *inner_error;
+  GeeList *children_list;
+  gint child_count;
+
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+  g_return_val_if_fail (RYGEL_IS_MEDIA_CONTAINER (parent), NULL);
+
+  id = rygel_media_export_media_cache_get_id (file);
+  basename = g_file_get_basename (file);
+  // constructed
+
+  inner_error = NULL;
+  media_db = rygel_media_export_media_cache_get_default (&inner_error);
+  if (!inner_error) {
+    const gchar *media_id = rygel_media_object_get_id ((RygelMediaObject*) self);
+    GeeArrayList *child_ids = rygel_media_export_media_cache_get_child_ids (media_db,
+                                                                            media_id,
+                                                                            &inner_error);
+    g_object_unref (media_db);
+    if (!inner_error) {
+      children_list = GEE_LIST (child_ids);
+      child_count = gee_collection_get_size (GEE_COLLECTION (child_ids));
+    }
+  }
+  if (inner_error)
+  {
+    children_list = gee_array_list_new (G_TYPE_STRING,
+                                        (GBoxedCopyFunc) g_strdup,
+                                        g_free,
+                                        NULL,
+                                        NULL,
+                                        NULL);
+    child_count = 0;
+    g_error_free (inner_error);
+  }
+
+  self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER,
+                                                           "id", id,
+                                                           "parent-ref", parent,
+                                                           "title", basename,
+                                                           "child-count", child_count,
+                                                           "children-list", children_list,
+                                                           "file", file));
+  g_free (id);
+  g_free (basename);
+  return self;
 }
 
+void
+rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer *self,
+                                         GFile *file) {
+  gchar* id;
 
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_new (GFile* file, RygelMediaContainer* parent) {
-	return rygel_media_export_dummy_container_construct (RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER, file, parent);
-}
-
+  g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_DUMMY_CONTAINER (self));
+  g_return_if_fail (G_IS_FILE (file));
 
-void rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer* self, GFile* file) {
-	GeeList* _tmp0_;
-	GFile* _tmp1_;
-	gchar* _tmp2_ = NULL;
-	gchar* _tmp3_;
-	g_return_if_fail (self != NULL);
-	g_return_if_fail (file != NULL);
-	_tmp0_ = self->children;
-	_tmp1_ = file;
-	_tmp2_ = rygel_media_export_media_cache_get_id (_tmp1_);
-	_tmp3_ = _tmp2_;
-	gee_collection_remove ((GeeCollection*) _tmp0_, _tmp3_);
-	g_free (_tmp3_);
+  id = rygel_media_export_media_cache_get_id (file);
+  gee_collection_remove ((GeeCollection*) self->children, id);
+  g_free (id);
 }
 
-//TODO: Remove this?
-static void rygel_media_export_dummy_container_finalize (GObject* obj);
+static void rygel_media_export_dummy_container_dispose (GObject *object) {
+  RygelMediaExportDummyContainer *self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
 
-static void rygel_media_export_dummy_container_class_init (RygelMediaExportDummyContainerClass * klass) {
-	rygel_media_export_dummy_container_parent_class = g_type_class_peek_parent (klass);
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_dummy_container_finalize;
-}
+  if (self->file) {
+    GFile *file = self->file;
 
+    self->file = NULL;
+    g_object_unref (file);
+  }
+  if (self->children) {
+    GeeArrayList *list = self->children;
 
-static void rygel_media_export_dummy_container_init (RygelMediaExportDummyContainer * self) {
+    self->children = NULL;
+    g_object_unref (list);
+  }
+  G_OBJECT_CLASS (rygel_media_export_dummy_container_parent_class)->dispose (obj);
 }
 
+static void
+rygel_media_export_dummy_container_constructed (GObject *object)
+{
+  RygelMediaExportDummyContainer *dummy = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
+  RygelMediaCollection *media_collection = RYGEL_MEDIA_COLLECTION (object);
+  GeeAbstractCollection *uris;
+  gchar *uri = g_file_get_uri (dummy->priv->file);
+
+  G_OBJECT_CLASS (rygel_media_export_dummy_container_parent_class)->constructed (object);
+  uris = GEE_ABSTRACT_COLLECTION (media_collection->uris);
+  gee_abstract_collection_add (uris, uri);
+  g_free (uri);
+}
 
-static void rygel_media_export_dummy_container_finalize (GObject* obj) {
-	RygelMediaExportDummyContainer * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER, RygelMediaExportDummyContainer);
-	g_object_unref (self->file);
-	g_object_unref (self->children);
-	G_OBJECT_CLASS (rygel_media_export_dummy_container_parent_class)->finalize (obj);
+static void
+rygel_media_export_dummy_container_get_property (GObject    *object,
+                                                 guint       property_id,
+                                                 GValue     *value,
+                                                 GParamSpec *pspec) {
+  RygelMediaExportDummyContainer *self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
+  RygelMediaExportDummyContainerPrivate *priv = self->priv;
+
+  switch (property_id) {
+  case RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_CHILDREN_LIST:
+    g_value_set_object (value, priv->children_list);
+    break;
+
+  case RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_FILE:
+    g_value_set_object (value, priv->file);
+    break;
+
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
+static void
+rygel_media_export_dummy_container_set_property (GObject      *object,
+                                                 guint         property_id,
+                                                 const GValue *value,
+                                                 GParamSpec   *pspec) {
+  RygelMediaExportDummyContainer *self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
+  RygelMediaExportDummyContainer *priv = self->priv;
+
+  switch (property_id) {
+  case RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_CHILDREN_LIST:
+    /* construct only property */
+    priv->children_list = g_value_dup_object (value);
+    break;
+
+  case RYGEL_MEDIA_EXPORT_DB_CONTAINER_MEDIA_DB:
+    /* construct only property */
+    priv->file = g_value_dup_object (value);
+    break;
+
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
+}
 
+static void rygel_media_export_dummy_container_class_init (RygelMediaExportDummyContainerClass *dummy_class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (dummy_class);
+
+  object_class->dispose = rygel_media_export_dummy_container_dispose;
+  object_class->constructed = rygel_media_export_dummy_container_constructed;
+  object_class->get_property = rygel_media_export_dummy_container_get_property;
+  object_class->set_property = rygel_media_export_dummy_container_set_property;
+
+  g_object_class_install_property (object_class,
+                                   RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_CHILDREN_LIST,
+                                   g_param_spec_object ("children-list",
+                                                        "children-list",
+                                                        "children-list",
+                                                        GEE_TYPE_LIST,
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_BLURB |
+                                                        G_PARAM_READABLE |
+                                                        G_PARAM_WRITABLE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class,
+                                   RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_FILE,
+                                   g_param_spec_object ("file",
+                                                        "file",
+                                                        "file",
+                                                        G_TYPE_FILE,
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_BLURB |
+                                                        G_PARAM_READABLE |
+                                                        G_PARAM_WRITABLE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+
+  g_type_class_add_private (klass,
+                            sizeof (RygelMediaExportDummyContainerPrivate));
+}
 
+static void rygel_media_export_dummy_container_init (RygelMediaExportDummyContainer * self) {
+  self->priv = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_GET_PRIVATE (self);
+}
diff --git a/src/media-export/rygel-media-export-dummy-container.h b/src/media-export/rygel-media-export-dummy-container.h
index 26c8b43..3d9fe89 100644
--- a/src/media-export/rygel-media-export-dummy-container.h
+++ b/src/media-export/rygel-media-export-dummy-container.h
@@ -39,8 +39,6 @@ typedef struct _RygelMediaExportDummyContainerPrivate RygelMediaExportDummyConta
 struct _RygelMediaExportDummyContainer {
   RygelMediaExportNullContainer parent_instance;
   RygelMediaExportDummyContainerPrivate* priv;
-  GFile* file; //TODO: Move to priv.
-  GeeList* children; //TODO: Move to priv.
 };
 
 struct _RygelMediaExportDummyContainerClass {
@@ -51,6 +49,15 @@ GType rygel_media_export_dummy_container_get_type (void) G_GNUC_CONST;
 
 RygelMediaExportDummyContainer* rygel_media_export_dummy_container_new ();
 
+GFile *
+rygel_media_export_dummy_container_get_g_file (RygelMediaExportDummyContainer *self);
+
+GeeList *
+rygel_media_export_dummy_container_get_children_list (RygelMediaExportDummyContainer *self);
+
+void
+rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer* self, GFile* file);
+
 G_END_DECLS
 
 #endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DUMMY_CONTAINER_H__ */
diff --git a/src/media-export/rygel-media-export-leaf-query-container.c b/src/media-export/rygel-media-export-leaf-query-container.c
index 4d4c51f..80d12d4 100644
--- a/src/media-export/rygel-media-export-leaf-query-container.c
+++ b/src/media-export/rygel-media-export-leaf-query-container.c
@@ -21,364 +21,121 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <glib.h>
-#include <glib-object.h>
-#include <rygel-server.h>
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gee.h>
-
-
-#define RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER (rygel_media_export_db_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-
-typedef struct _RygelMediaExportDBContainer RygelMediaExportDBContainer;
-typedef struct _RygelMediaExportDBContainerClass RygelMediaExportDBContainerClass;
-typedef struct _RygelMediaExportDBContainerPrivate RygelMediaExportDBContainerPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE (rygel_media_export_media_cache_get_type ())
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCache))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-
-typedef struct _RygelMediaExportMediaCache RygelMediaExportMediaCache;
-typedef struct _RygelMediaExportMediaCacheClass RygelMediaExportMediaCacheClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER (rygel_media_export_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainer))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-
-typedef struct _RygelMediaExportQueryContainer RygelMediaExportQueryContainer;
-typedef struct _RygelMediaExportQueryContainerClass RygelMediaExportQueryContainerClass;
-typedef struct _RygelMediaExportQueryContainerPrivate RygelMediaExportQueryContainerPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER (rygel_media_export_leaf_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainer))
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
-
-typedef struct _RygelMediaExportLeafQueryContainer RygelMediaExportLeafQueryContainer;
-typedef struct _RygelMediaExportLeafQueryContainerClass RygelMediaExportLeafQueryContainerClass;
-typedef struct _RygelMediaExportLeafQueryContainerPrivate RygelMediaExportLeafQueryContainerPrivate;
-typedef struct _RygelMediaExportLeafQueryContainerGetChildrenData RygelMediaExportLeafQueryContainerGetChildrenData;
-
-struct _RygelMediaExportDBContainer {
-	RygelMediaContainer parent_instance;
-	RygelMediaExportDBContainerPrivate * priv;
-	RygelMediaExportMediaCache* media_db;
-};
-
-struct _RygelMediaExportDBContainerClass {
-	RygelMediaContainerClass parent_class;
-	void (*search) (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-	RygelMediaObjects* (*search_finish) (RygelMediaExportDBContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
-};
-
-struct _RygelMediaExportQueryContainer {
-	RygelMediaExportDBContainer parent_instance;
-	RygelMediaExportQueryContainerPrivate * priv;
-	RygelSearchExpression* expression;
-};
-
-struct _RygelMediaExportQueryContainerClass {
-	RygelMediaExportDBContainerClass parent_class;
-	gint (*count_children) (RygelMediaExportQueryContainer* self, GError** error);
-};
-
-struct _RygelMediaExportLeafQueryContainer {
-	RygelMediaExportQueryContainer parent_instance;
-	RygelMediaExportLeafQueryContainerPrivate * priv;
-};
-
-struct _RygelMediaExportLeafQueryContainerClass {
-	RygelMediaExportQueryContainerClass parent_class;
-};
-
-struct _RygelMediaExportLeafQueryContainerGetChildrenData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportLeafQueryContainer* self;
-	guint offset;
-	guint max_count;
-	gchar* sort_criteria;
-	GCancellable* cancellable;
-	RygelMediaObjects* result;
-	guint total_matches;
-	guint _tmp0_;
-	guint _tmp1_;
-	const gchar* _tmp2_;
-	GCancellable* _tmp3_;
-	guint _tmp4_;
-	RygelMediaObjects* _tmp5_;
-	RygelMediaObjects* children;
-	RygelMediaObjects* _tmp6_;
-	RygelMediaObjects* _child_list;
-	RygelMediaObjects* _tmp7_;
-	gint _tmp8_;
-	gint _tmp9_;
-	gint _child_size;
-	gint _child_index;
-	gint _tmp10_;
-	gint _tmp11_;
-	gint _tmp12_;
-	RygelMediaObjects* _tmp13_;
-	gint _tmp14_;
-	gpointer _tmp15_;
-	RygelMediaObject* child;
-	RygelMediaObject* _tmp16_;
-	GError * _inner_error_;
-};
-
-
-static gpointer rygel_media_export_leaf_query_container_parent_class = NULL;
-
-GType rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_query_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_leaf_query_container_get_type (void) G_GNUC_CONST;
-enum  {
-	RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_DUMMY_PROPERTY
-};
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-RygelMediaExportQueryContainer* rygel_media_export_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-static void rygel_media_export_leaf_query_container_real_get_children_data_free (gpointer _data);
-static void rygel_media_export_leaf_query_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_leaf_query_container_real_get_children_co (RygelMediaExportLeafQueryContainerGetChildrenData* _data_);
-void rygel_media_export_db_container_search (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-RygelMediaObjects* rygel_media_export_db_container_search_finish (RygelMediaExportDBContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
-static void rygel_media_export_leaf_query_container_get_children_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
-static gint rygel_media_export_leaf_query_container_real_count_children (RygelMediaExportQueryContainer* base, GError** error);
-glong rygel_media_export_media_cache_get_object_count_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, GError** error);
-
-
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name) {
-	RygelMediaExportLeafQueryContainer * self = NULL;
-	RygelMediaExportMediaCache* _tmp0_;
-	RygelSearchExpression* _tmp1_;
-	const gchar* _tmp2_;
-	const gchar* _tmp3_;
-	g_return_val_if_fail (cache != NULL, NULL);
-	g_return_val_if_fail (expression != NULL, NULL);
-	g_return_val_if_fail (id != NULL, NULL);
-	g_return_val_if_fail (name != NULL, NULL);
-	_tmp0_ = cache;
-	_tmp1_ = expression;
-	_tmp2_ = id;
-	_tmp3_ = name;
-	self = (RygelMediaExportLeafQueryContainer*) rygel_media_export_query_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_);
-	return self;
+#include "rygel-media-export-leaf-query-container.h"
+
+RygelMediaExportLeafQueryContainer*
+rygel_media_export_leaf_query_container_new (RygelSearchExpression *expression,
+                                             const gchar           *id,
+                                             const gchar           *name) {
+  return RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER,
+                                                                "id", id,
+                                                                "title", name,
+                                                                "child-count", 0,
+                                                                "expression", expression,
+                                                                NULL));
 }
 
-
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name) {
-	return rygel_media_export_leaf_query_container_construct (RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, cache, expression, id, name);
-}
-
-
-static void rygel_media_export_leaf_query_container_real_get_children_data_free (gpointer _data) {
-	RygelMediaExportLeafQueryContainerGetChildrenData* _data_;
-	_data_ = _data;
-	g_free (_data_->sort_criteria);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->result);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportLeafQueryContainerGetChildrenData, _data_);
-}
-
-
-static void rygel_media_export_leaf_query_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportLeafQueryContainer * self;
-	RygelMediaExportLeafQueryContainerGetChildrenData* _data_;
-	RygelMediaExportLeafQueryContainer* _tmp0_;
-	guint _tmp1_;
-	guint _tmp2_;
-	const gchar* _tmp3_;
-	gchar* _tmp4_;
-	GCancellable* _tmp5_;
-	GCancellable* _tmp6_;
-	self = (RygelMediaExportLeafQueryContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportLeafQueryContainerGetChildrenData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_leaf_query_container_real_get_children);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_leaf_query_container_real_get_children_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = offset;
-	_data_->offset = _tmp1_;
-	_tmp2_ = max_count;
-	_data_->max_count = _tmp2_;
-	_tmp3_ = sort_criteria;
-	_tmp4_ = g_strdup (_tmp3_);
-	g_free (_data_->sort_criteria);
-	_data_->sort_criteria = _tmp4_;
-	_tmp5_ = cancellable;
-	_tmp6_ = g_object_ref (_tmp5_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp6_;
-	rygel_media_export_leaf_query_container_real_get_children_co (_data_);
-}
-
-
-static RygelMediaObjects* rygel_media_export_leaf_query_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaObjects* result;
-	RygelMediaExportLeafQueryContainerGetChildrenData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return NULL;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-	result = _data_->result;
-	_data_->result = NULL;
-	return result;
+static void
+rygel_media_export_leaf_query_container_get_children_ready (GObject      *source_object,
+                                                            GAsyncResult *res,
+                                                            gpointer      user_data) {
+  RygelSearchableContainer *container = RYGEL_SEARCHABLE_CONTAINER (source_object);
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
+  GError *error = NULL;
+  RygelMediaObjects *children = rygel_searchable_container_search_finish (container, res, NULL, error);
+
+  if (error) {
+    g_simple_async_result_take_error (simple, error);
+  } else {
+    gint iter;
+    gint size = gee_abstract_collection_get_size (GEE_ABSTRACT_COLLECTION (children));
+    RygelMediaContainer *media_container = RYGEL_MEDIA_CONTAINER (source_object);
+
+    for (iter = 0; iter < size; ++iter) {
+      RygelMediaObject *child = RYGEL_MEDIA_OBJECT (gee_abstract_list_get (GEE_ABSTRACT_LIST (children), iter));
+
+      rygel_media_object_set_parent (child, media_container);
+      g_object_unref (child);
+    }
+
+    g_simple_async_result_set_op_res_pointer (simple, children, g_object_unref);
+  }
+  g_simple_async_result_complete (simple);
+  g_object_unref (simple);
 }
 
-
-static void rygel_media_export_leaf_query_container_get_children_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
-	RygelMediaExportLeafQueryContainerGetChildrenData* _data_;
-	_data_ = _user_data_;
-	_data_->_source_object_ = source_object;
-	_data_->_res_ = _res_;
-	rygel_media_export_leaf_query_container_real_get_children_co (_data_);
+static void
+rygel_media_export_leaf_query_container_real_get_children (RygelMediaContainer *base,
+                                                           guint                offset,
+                                                           guint                max_count,
+                                                           const gchar         *sort_criteria,
+                                                           GCancellable        *cancellable,
+                                                           GAsyncReadyCallback  callback,
+                                                           gpointer             user_data) {
+  GSimpleAsyncResult *simple = g_simple_async_result_new (G_OBJECT (base),
+                                                          callback,
+                                                          user_data,
+                                                          rygel_media_export_leaf_query_container_real_get_children);
+  RygelSearchableContainer *searchable = RYGEL_SEARCHABLE_CONTAINER (base);
+
+  rygel_searchable_container_search (searchable,
+                                     NULL,
+                                     offset,
+                                     max_count,
+                                     sort_criteria,
+                                     cancellable,
+                                     rygel_media_export_leaf_query_container_get_children_ready,
+                                     simple);
 }
 
-
-static gboolean rygel_media_export_leaf_query_container_real_get_children_co (RygelMediaExportLeafQueryContainerGetChildrenData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		case 1:
-		goto _state_1;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->_tmp0_ = _data_->offset;
-	_data_->_tmp1_ = _data_->max_count;
-	_data_->_tmp2_ = _data_->sort_criteria;
-	_data_->_tmp3_ = _data_->cancellable;
-	_data_->_tmp4_ = 0U;
-	_data_->_state_ = 1;
-	rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, _data_->_tmp0_, _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, rygel_media_export_leaf_query_container_get_children_ready, _data_);
-	return FALSE;
-	_state_1:
-	_data_->_tmp5_ = NULL;
-	_data_->_tmp5_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp4_, &_data_->_inner_error_);
-	_data_->total_matches = _data_->_tmp4_;
-	_data_->children = _data_->_tmp5_;
-	if (_data_->_inner_error_ != NULL) {
-		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-		g_error_free (_data_->_inner_error_);
-		if (_data_->_state_ == 0) {
-			g_simple_async_result_complete_in_idle (_data_->_async_result);
-		} else {
-			g_simple_async_result_complete (_data_->_async_result);
-		}
-		g_object_unref (_data_->_async_result);
-		return FALSE;
-	}
-	{
-		_data_->_tmp6_ = g_object_ref (_data_->children);
-		_data_->_child_list = _data_->_tmp6_;
-		_data_->_tmp7_ = _data_->_child_list;
-		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp7_);
-		_data_->_tmp9_ = _data_->_tmp8_;
-		_data_->_child_size = _data_->_tmp9_;
-		_data_->_child_index = -1;
-		while (TRUE) {
-			_data_->_tmp10_ = _data_->_child_index;
-			_data_->_child_index = _data_->_tmp10_ + 1;
-			_data_->_tmp11_ = _data_->_child_index;
-			_data_->_tmp12_ = _data_->_child_size;
-			if (!(_data_->_tmp11_ < _data_->_tmp12_)) {
-				break;
-			}
-			_data_->_tmp13_ = _data_->_child_list;
-			_data_->_tmp14_ = _data_->_child_index;
-			_data_->_tmp15_ = NULL;
-			_data_->_tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp13_, _data_->_tmp14_);
-			_data_->child = (RygelMediaObject*) _data_->_tmp15_;
-			_data_->_tmp16_ = _data_->child;
-			_data_->_tmp16_->parent = (RygelMediaContainer*) _data_->self;
-			g_object_unref (_data_->child);
-		}
-		g_object_unref (_data_->_child_list);
-	}
-	_data_->result = _data_->children;
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-	g_object_unref (_data_->children);
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-}
-
-
-static gint rygel_media_export_leaf_query_container_real_count_children (RygelMediaExportQueryContainer* base, GError** error) {
-	RygelMediaExportLeafQueryContainer * self;
-	gint result = 0;
-	RygelMediaExportMediaCache* _tmp0_;
-	RygelSearchExpression* _tmp1_;
-	glong _tmp2_ = 0L;
-	glong _tmp3_;
-	GError * _inner_error_ = NULL;
-	self = (RygelMediaExportLeafQueryContainer*) base;
-	_tmp0_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER(self);
-	_tmp1_ = ((RygelMediaExportQueryContainer*) self)->expression;
-	_tmp2_ = rygel_media_export_media_cache_get_object_count_by_search_expression (_tmp0_, _tmp1_, NULL, &_inner_error_);
-	_tmp3_ = _tmp2_;
-	if (_inner_error_ != NULL) {
-		g_propagate_error (error, _inner_error_);
-		return 0;
-	}
-	result = (gint) _tmp3_;
-	return result;
+static RygelMediaObjects *
+rygel_media_export_leaf_query_container_real_get_children_finish (RygelMediaContainer  *base,
+                                                                  GAsyncResult         *res,
+                                                                  GError              **error) {
+  RygelMediaObjects* result;
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+  if (g_simple_async_result_propagate_error (simple, error)) {
+    return NULL;
+  }
+  result = RYGEL_MEDIA_OBJECTS (g_simple_async_result_get_op_res_gpointer (simple));
+  if (result) {
+    g_object_ref (result);
+  }
+
+  return result;
 }
 
-
-static void rygel_media_export_leaf_query_container_class_init (RygelMediaExportLeafQueryContainerClass * klass) {
-	rygel_media_export_leaf_query_container_parent_class = g_type_class_peek_parent (klass);
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children = rygel_media_export_leaf_query_container_real_get_children;
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children_finish = rygel_media_export_leaf_query_container_real_get_children_finish;
-	RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS (klass)->count_children = rygel_media_export_leaf_query_container_real_count_children;
+static gint
+rygel_media_export_leaf_query_container_real_count_children (RygelMediaExportQueryContainer  *base,
+                                                             GError                         **error) {
+  GError *inner_error = NULL;
+  RygelMediaExportDBContainer *db_container = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
+  RygelMediaExportQueryCOntainer *query_container = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (base);
+  RygelMediaExportMediaCache *cache = rygel_media_export_db_container_get_media_db (db_container);
+  RygelSearchExpression *expression = rygel_media_export_query_container_get_expression (query_container);
+  gint result = (gint) rygel_media_export_media_cache_get_object_count_by_search_expression (cache,
+                                                                                             expression,
+                                                                                             NULL,
+                                                                                             &inner_error);
+
+  if (inner_error) {
+    g_propagate_error (error, inner_error);
+    return 0;
+  }
+
+  return result;
 }
 
+static void
+rygel_media_export_leaf_query_container_class_init (RygelMediaExportLeafQueryContainerClass *leaf_class) {
+  RygelMediaContainerClass *container_class = RYGEL_MEDIA_CONTAINER_CLASS (leaf_class):
+  RygelMediaExportQueryContainer *query_class = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS (leaf_class);
 
-static void rygel_media_export_leaf_query_container_init (RygelMediaExportLeafQueryContainer * self) {
+  container_class->get_children = rygel_media_export_leaf_query_container_real_get_children;
+  container_class->get_children_finish = rygel_media_export_leaf_query_container_real_get_children_finish;
+  query_class->count_children = rygel_media_export_leaf_query_container_real_count_children;
 }
 
-
-GType rygel_media_export_leaf_query_container_get_type (void) {
-	static volatile gsize rygel_media_export_leaf_query_container_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_leaf_query_container_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportLeafQueryContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_leaf_query_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportLeafQueryContainer), 0, (GInstanceInitFunc) rygel_media_export_leaf_query_container_init, NULL };
-		GType rygel_media_export_leaf_query_container_type_id;
-		rygel_media_export_leaf_query_container_type_id = g_type_register_static (RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, "RygelMediaExportLeafQueryContainer", &g_define_type_info, 0);
-		g_once_init_leave (&rygel_media_export_leaf_query_container_type_id__volatile, rygel_media_export_leaf_query_container_type_id);
-	}
-	return rygel_media_export_leaf_query_container_type_id__volatile;
+static void
+rygel_media_export_leaf_query_container_init (RygelMediaExportLeafQueryContainer *self G_GNUC_UNUSED) {
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-leaf-query-container.h b/src/media-export/rygel-media-export-leaf-query-container.h
new file mode 100644
index 0000000..007021a
--- /dev/null
+++ b/src/media-export/rygel-media-export-leaf-query-container.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DB_CONTAINER_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DB_CONTAINER_H__
+
+#include "rygel-media-export-query-container.h"
+
+G_BEGIN_DECLS
+
+#define RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER (rygel_media_export_leaf_query_container_get_type ())
+#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainer))
+#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
+#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
+
+typedef struct _RygelMediaExportLeafQueryContainer RygelMediaExportLeafQueryContainer;
+typedef struct _RygelMediaExportLeafQueryContainerClass RygelMediaExportLeafQueryContainerClass;
+typedef struct _RygelMediaExportLeafQueryContainerPrivate RygelMediaExportLeafQueryContainerPrivate;
+
+struct _RygelMediaExportLeafQueryContainer {
+  RygelMediaExportQueryContainer parent_instance;
+  RygelMediaExportLeafQueryContainerPrivate *priv;
+};
+
+struct _RygelMediaExportLeafQueryContainerClass {
+  RygelMediaExportQueryContainerClass parent_class;
+};
+
+GType
+rygel_media_export_leaf_query_container_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportLeafQueryContainer *
+rygel_media_export_leaf_query_container_new (RygelSearchExpression *expression,
+                                             const gchar           *id,
+                                             const gchar           *name);
+
+G_END_DECLS
+
+#endif
diff --git a/src/media-export/rygel-media-export-node-query-container.c b/src/media-export/rygel-media-export-node-query-container.c
index fb2733e..04bcd05 100644
--- a/src/media-export/rygel-media-export-node-query-container.c
+++ b/src/media-export/rygel-media-export-node-query-container.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-node-query-container.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-node-query-container.vala, do not modify */
-
 /*
  * Copyright (C) 2011 Jens Georg <mail jensge org>.
  *
@@ -21,181 +18,82 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <glib.h>
-#include <glib-object.h>
-#include <rygel-server.h>
-#include <gio/gio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gee.h>
-
-
-#define RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER (rygel_media_export_db_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-
-typedef struct _RygelMediaExportDBContainer RygelMediaExportDBContainer;
-typedef struct _RygelMediaExportDBContainerClass RygelMediaExportDBContainerClass;
-typedef struct _RygelMediaExportDBContainerPrivate RygelMediaExportDBContainerPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE (rygel_media_export_media_cache_get_type ())
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCache))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-
-typedef struct _RygelMediaExportMediaCache RygelMediaExportMediaCache;
-typedef struct _RygelMediaExportMediaCacheClass RygelMediaExportMediaCacheClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER (rygel_media_export_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainer))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-
-typedef struct _RygelMediaExportQueryContainer RygelMediaExportQueryContainer;
-typedef struct _RygelMediaExportQueryContainerClass RygelMediaExportQueryContainerClass;
-typedef struct _RygelMediaExportQueryContainerPrivate RygelMediaExportQueryContainerPrivate;
+#include "rygel-media-export-node-query-container.h"
 
-#define RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER (rygel_media_export_node_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainer))
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
-
-typedef struct _RygelMediaExportNodeQueryContainer RygelMediaExportNodeQueryContainer;
-typedef struct _RygelMediaExportNodeQueryContainerClass RygelMediaExportNodeQueryContainerClass;
-typedef struct _RygelMediaExportNodeQueryContainerPrivate RygelMediaExportNodeQueryContainerPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY (rygel_media_export_query_container_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactory))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
-
-typedef struct _RygelMediaExportQueryContainerFactory RygelMediaExportQueryContainerFactory;
-typedef struct _RygelMediaExportQueryContainerFactoryClass RygelMediaExportQueryContainerFactoryClass;
 typedef struct _RygelMediaExportNodeQueryContainerGetChildrenData RygelMediaExportNodeQueryContainerGetChildrenData;
 
-struct _RygelMediaExportDBContainer {
-	RygelMediaContainer parent_instance;
-	RygelMediaExportDBContainerPrivate * priv;
-	RygelMediaExportMediaCache* media_db;
-};
-
-struct _RygelMediaExportDBContainerClass {
-	RygelMediaContainerClass parent_class;
-	void (*search) (RygelMediaExportDBContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-	RygelMediaObjects* (*search_finish) (RygelMediaExportDBContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
-};
-
-struct _RygelMediaExportQueryContainer {
-	RygelMediaExportDBContainer parent_instance;
-	RygelMediaExportQueryContainerPrivate * priv;
-	RygelSearchExpression* expression;
-};
-
-struct _RygelMediaExportQueryContainerClass {
-	RygelMediaExportDBContainerClass parent_class;
-	gint (*count_children) (RygelMediaExportQueryContainer* self, GError** error);
-};
-
-struct _RygelMediaExportNodeQueryContainer {
-	RygelMediaExportQueryContainer parent_instance;
-	RygelMediaExportNodeQueryContainerPrivate * priv;
-};
-
-struct _RygelMediaExportNodeQueryContainerClass {
-	RygelMediaExportQueryContainerClass parent_class;
-};
-
 struct _RygelMediaExportNodeQueryContainerPrivate {
-	gchar* template;
-	gchar* attribute;
+  gchar *template;
+  gchar *attribute;
 };
 
 struct _RygelMediaExportNodeQueryContainerGetChildrenData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportNodeQueryContainer* self;
-	guint offset;
-	guint max_count;
-	gchar* sort_criteria;
-	GCancellable* cancellable;
-	RygelMediaObjects* result;
-	RygelMediaObjects* _tmp0_;
-	RygelMediaObjects* children;
-	RygelMediaExportMediaCache* _tmp1_;
-	const gchar* _tmp2_;
-	RygelSearchExpression* _tmp3_;
-	guint _tmp4_;
-	guint _tmp5_;
-	GeeList* _tmp6_;
-	GeeList* data;
-	GeeList* _tmp7_;
-	GeeList* _meta_data_list;
-	GeeList* _tmp8_;
-	gint _tmp9_;
-	gint _tmp10_;
-	gint _meta_data_size;
-	gint _meta_data_index;
-	gint _tmp11_;
-	gint _tmp12_;
-	gint _tmp13_;
-	GeeList* _tmp14_;
-	gint _tmp15_;
-	gpointer _tmp16_;
-	gchar* meta_data;
-	const gchar* _tmp17_;
-	gchar* _tmp18_;
-	gchar* new_id;
-	const gchar* _tmp19_;
-	const gchar* _tmp20_;
-	gchar* _tmp21_;
-	RygelMediaExportQueryContainerFactory* _tmp22_;
-	RygelMediaExportQueryContainerFactory* factory;
-	RygelMediaExportQueryContainerFactory* _tmp23_;
-	RygelMediaExportMediaCache* _tmp24_;
-	const gchar* _tmp25_;
-	const gchar* _tmp26_;
-	RygelMediaExportQueryContainer* _tmp27_;
-	RygelMediaExportQueryContainer* container;
-	RygelMediaExportQueryContainer* _tmp28_;
-	RygelMediaExportQueryContainer* _tmp29_;
-	GError * _inner_error_;
+  int _state_;
+  GObject* _source_object_;
+  GAsyncResult* _res_;
+  GSimpleAsyncResult* _async_result;
+  RygelMediaExportNodeQueryContainer* self;
+  guint offset;
+  guint max_count;
+  gchar* sort_criteria;
+  GCancellable* cancellable;
+  RygelMediaObjects* result;
+  RygelMediaObjects* _tmp0_;
+  RygelMediaObjects* children;
+  RygelMediaExportMediaCache* _tmp1_;
+  const gchar* _tmp2_;
+  RygelSearchExpression* _tmp3_;
+  guint _tmp4_;
+  guint _tmp5_;
+  GeeList* _tmp6_;
+  GeeList* data;
+  GeeList* _tmp7_;
+  GeeList* _meta_data_list;
+  GeeList* _tmp8_;
+  gint _tmp9_;
+  gint _tmp10_;
+  gint _meta_data_size;
+  gint _meta_data_index;
+  gint _tmp11_;
+  gint _tmp12_;
+  gint _tmp13_;
+  GeeList* _tmp14_;
+  gint _tmp15_;
+  gpointer _tmp16_;
+  gchar* meta_data;
+  const gchar* _tmp17_;
+  gchar* _tmp18_;
+  gchar* new_id;
+  const gchar* _tmp19_;
+  const gchar* _tmp20_;
+  gchar* _tmp21_;
+  RygelMediaExportQueryContainerFactory* _tmp22_;
+  RygelMediaExportQueryContainerFactory* factory;
+  RygelMediaExportQueryContainerFactory* _tmp23_;
+  RygelMediaExportMediaCache* _tmp24_;
+  const gchar* _tmp25_;
+  const gchar* _tmp26_;
+  RygelMediaExportQueryContainer* _tmp27_;
+  RygelMediaExportQueryContainer* container;
+  RygelMediaExportQueryContainer* _tmp28_;
+  RygelMediaExportQueryContainer* _tmp29_;
+  GError * _inner_error_;
 };
 
 
-static gpointer rygel_media_export_node_query_container_parent_class = NULL;
-
-GType rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_query_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_node_query_container_get_type (void) G_GNUC_CONST;
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerPrivate))
+#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+				RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, \
+				RygelMediaExportNodeQueryContainerPrivate))
 enum  {
-	RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_DUMMY_PROPERTY
+  RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_DUMMY_PROPERTY,
+  RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_TEMPLATE,
+  RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_ATTRIBUTE
 };
-RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute);
 RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute);
-RygelMediaExportQueryContainer* rygel_media_export_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-gint rygel_media_export_query_container_count_children (RygelMediaExportQueryContainer* self, GError** error);
 static void rygel_media_export_node_query_container_real_get_children_data_free (gpointer _data);
 static void rygel_media_export_node_query_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_node_query_container_real_get_children_co (RygelMediaExportNodeQueryContainerGetChildrenData* _data_);
-GeeList* rygel_media_export_media_cache_get_object_attribute_by_search_expression (RygelMediaExportMediaCache* self, const gchar* attribute, RygelSearchExpression* expression, glong offset, guint max_count, GError** error);
-GType rygel_media_export_query_container_factory_get_type (void) G_GNUC_CONST;
-RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_get_default (void);
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory* self, RygelMediaExportMediaCache* cache, const gchar* definition, const gchar* name);
 static gint rygel_media_export_node_query_container_real_count_children (RygelMediaExportQueryContainer* base, GError** error);
 static void rygel_media_export_node_query_container_finalize (GObject* obj);
 
@@ -257,7 +155,6 @@ RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_cons
 	return self;
 }
 
-
 RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute) {
 	return rygel_media_export_node_query_container_construct (RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, cache, expression, id, name, template, attribute);
 }
diff --git a/src/media-export/rygel-media-export-node-query-container.h b/src/media-export/rygel-media-export-node-query-container.h
new file mode 100644
index 0000000..486d774
--- /dev/null
+++ b/src/media-export/rygel-media-export-node-query-container.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2011 Jens Georg <mail jensge org>.
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
+
+#include "rygel-media-export-query-container.h"
+
+G_BEGIN_DECLS
+
+#define RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER (rygel_media_export_node_query_container_get_type ())
+#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainer))
+#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
+#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
+
+typedef struct _RygelMediaExportNodeQueryContainer RygelMediaExportNodeQueryContainer;
+typedef struct _RygelMediaExportNodeQueryContainerClass RygelMediaExportNodeQueryContainerClass;
+typedef struct _RygelMediaExportNodeQueryContainerPrivate RygelMediaExportNodeQueryContainerPrivate;
+
+struct _RygelMediaExportNodeQueryContainer {
+  RygelMediaExportQueryContainer parent_instance;
+  RygelMediaExportNodeQueryContainerPrivate *priv;
+};
+
+struct _RygelMediaExportNodeQueryContainerClass {
+  RygelMediaExportQueryContainerClass parent_class;
+};
+
+GType
+rygel_media_export_node_query_container_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportNodeQueryContainer *
+rygel_media_export_node_query_container_new (RygelSearchExpression *expression,
+					     const gchar           *id,
+					     const gchar           *name,
+					     const gchar           *template,
+					     const gchar           *attribute);
+
+G_END_DECLS
+
+#endif
diff --git a/src/media-export/rygel-media-export-null-container.c b/src/media-export/rygel-media-export-null-container.c
index 982cbde..4f7e90a 100644
--- a/src/media-export/rygel-media-export-null-container.c
+++ b/src/media-export/rygel-media-export-null-container.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-null-container.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-null-container.vala, do not modify */
-
 /*
  * Copyright (C) 2009 Jens Georg <mail jensge org>.
  *
@@ -21,7 +18,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-
 #include "rygel-media-export-null-container.h"
 
 /**
@@ -29,229 +25,88 @@
  * created
  */
 
-G_DEFINE_TYPE (RygelMediaExportNullContainer, rygel_media_export_null_container, RYGEL_TYPE_MEDIA_CONTAINER)
-
-typedef struct _RygelMediaExportNullContainerGetChildrenData RygelMediaExportNullContainerGetChildrenData;
-
-struct _RygelMediaExportNullContainerGetChildrenData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportNullContainer* self;
-	guint offset;
-	guint max_count;
-	gchar* sort_criteria;
-	GCancellable* cancellable;
-	RygelMediaObjects* result;
-	RygelMediaObjects* _tmp0_;
-};
-
-typedef struct _RygelMediaExportNullContainerFindObjectData RygelMediaExportNullContainerFindObjectData;
-
-struct _RygelMediaExportNullContainerFindObjectData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportNullContainer* self;
-	gchar* id;
-	GCancellable* cancellable;
-	RygelMediaObject* result;
-};
-
-
-RygelMediaExportNullContainer* rygel_media_export_null_container_construct (GType object_type);
-static void rygel_media_export_null_container_real_get_children_data_free (gpointer _data);
-static void rygel_media_export_null_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_null_container_real_get_children_co (RygelMediaExportNullContainerGetChildrenData* _data_);
-static void rygel_media_export_null_container_real_find_object_data_free (gpointer _data);
-static void rygel_media_export_null_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_null_container_real_find_object_co (RygelMediaExportNullContainerFindObjectData* _data_);
-
-
-RygelMediaExportNullContainer* rygel_media_export_null_container_construct (GType object_type) {
-	RygelMediaExportNullContainer * self = NULL;
-	self = (RygelMediaExportNullContainer*) rygel_media_container_construct_root (object_type, "MediaExport", 0);
-	return self;
-}
-
-
-RygelMediaExportNullContainer* rygel_media_export_null_container_new (void) {
-	return rygel_media_export_null_container_construct (RYGEL_MEDIA_EXPORT_TYPE_NULL_CONTAINER);
+G_DEFINE_TYPE (RygelMediaExportNullContainer,
+               rygel_media_export_null_container,
+               RYGEL_TYPE_MEDIA_CONTAINER)
+
+RygelMediaExportNullContainer *
+rygel_media_export_null_container_new (void) {
+  return RYGEL_MEDIA_EXPORT_NULL_CONTAINER (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_NULL_CONTAINER,
+                                                          "id", "0",
+                                                          "parent", NULL,
+                                                          "title", "MediaExport",
+                                                          "child-count", 0,
+                                                          NULL));
 }
 
-
-static void rygel_media_export_null_container_real_get_children_data_free (gpointer _data) {
-	RygelMediaExportNullContainerGetChildrenData* _data_;
-	_data_ = _data;
-	g_free (_data_->sort_criteria);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->result);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportNullContainerGetChildrenData, _data_);
+static void
+rygel_media_export_null_container_real_get_children (RygelMediaContainer *base,
+                                                     guint                offset G_GNUC_UNUSED,
+                                                     guint                max_count G_GNUC_UNUSED,
+                                                     const gchar         *sort_criteria G_GNUC_UNUSED,
+                                                     GCancellable        *cancellable G_GNUC_UNUSED,
+                                                     GAsyncReadyCallback  callback,
+                                                     gpointer             user_data) {
+  GSimpleAsyncResult *simple = g_simple_async_result_new (G_OBJECT (base),
+                                                          callback,
+                                                          user_data,
+                                                          rygel_media_export_null_container_real_get_children);
+
+  g_simple_async_result_set_op_res_pointer (simple,
+                                            rygel_media_objects_new (),
+                                            g_object_unref);
+  g_simple_async_result_complete_in_idle (simple);
+  g_object_unref (simple);
 }
 
-static void rygel_media_export_null_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportNullContainer * self;
-	RygelMediaExportNullContainerGetChildrenData* _data_;
-	RygelMediaExportNullContainer* _tmp0_;
-	guint _tmp1_;
-	guint _tmp2_;
-	const gchar* _tmp3_;
-	gchar* _tmp4_;
-	GCancellable* _tmp5_;
-	GCancellable* _tmp6_;
-	self = (RygelMediaExportNullContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportNullContainerGetChildrenData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_null_container_real_get_children);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_null_container_real_get_children_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = offset;
-	_data_->offset = _tmp1_;
-	_tmp2_ = max_count;
-	_data_->max_count = _tmp2_;
-	_tmp3_ = sort_criteria;
-	_tmp4_ = g_strdup (_tmp3_);
-	g_free (_data_->sort_criteria);
-	_data_->sort_criteria = _tmp4_;
-	_tmp5_ = cancellable;
-	_tmp6_ = g_object_ref (_tmp5_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp6_;
-	rygel_media_export_null_container_real_get_children_co (_data_);
+static RygelMediaObjects *
+rygel_media_export_null_container_real_get_children_finish (RygelMediaContainer  *base,
+                                                            GAsyncResult         *res,
+                                                            GError              **error) {
+  RygelMediaObjects *result;
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+
+  if (g_simple_async_result_propagate_error (simple, error)) {
+    return NULL;
+  }
+  result = RYGEL_MEDIA_OBJECTS (g_simple_async_result_get_op_res_gpointer (simple));
+  if (result) {
+    g_object_ref (result);
+  }
+  return result;
 }
 
-
-static RygelMediaObjects* rygel_media_export_null_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaObjects* result;
-	RygelMediaExportNullContainerGetChildrenData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return NULL;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-	result = _data_->result;
-	_data_->result = NULL;
-	return result;
+static void
+rygel_media_export_null_container_real_find_object (RygelMediaContainer *base,
+                                                    const gchar         *id G_GNUC_UNUSED,
+                                                    GCancellable        *cancellable G_GNUC_UNUSED,
+                                                    GAsyncReadyCallback  callback,
+                                                    gpointer             user_data) {
+  GSimpleAsyncResult *simple = g_simple_async_result_new (G_OBJECT (base),
+                                                          callback,
+                                                          user_data,
+                                                          rygel_media_export_null_container_real_find_object);
+
+  g_simple_async_result_complete_in_idle (simple);
+  g_object_unref (simple);
 }
 
-
-static gboolean rygel_media_export_null_container_real_get_children_co (RygelMediaExportNullContainerGetChildrenData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->_tmp0_ = rygel_media_objects_new ();
-	_data_->result = _data_->_tmp0_;
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
+static RygelMediaObject *
+rygel_media_export_null_container_real_find_object_finish (RygelMediaContainer *base G_GNUC_UNUSED,
+                                                           GAsyncResult *res,
+                                                           GError **error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) {
+  return NULL;
 }
 
+static void rygel_media_export_null_container_class_init (RygelMediaExportNullContainerClass *null_class) {
+  RygelMediaContainerClass *container_class = RYGEL_MEDIA_CONTAINER_CLASS (null_class);
 
-static void rygel_media_export_null_container_real_find_object_data_free (gpointer _data) {
-	RygelMediaExportNullContainerFindObjectData* _data_;
-	_data_ = _data;
-	g_free (_data_->id);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->result);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportNullContainerFindObjectData, _data_);
+  container_class->get_children = rygel_media_export_null_container_real_get_children;
+  container_class->get_children_finish = rygel_media_export_null_container_real_get_children_finish;
+  container_class->find_object = rygel_media_export_null_container_real_find_object;
+  container_class->find_object_finish = rygel_media_export_null_container_real_find_object_finish;
 }
 
-
-static void rygel_media_export_null_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportNullContainer * self;
-	RygelMediaExportNullContainerFindObjectData* _data_;
-	RygelMediaExportNullContainer* _tmp0_;
-	const gchar* _tmp1_;
-	gchar* _tmp2_;
-	GCancellable* _tmp3_;
-	GCancellable* _tmp4_;
-	self = (RygelMediaExportNullContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportNullContainerFindObjectData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_null_container_real_find_object);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_null_container_real_find_object_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = id;
-	_tmp2_ = g_strdup (_tmp1_);
-	g_free (_data_->id);
-	_data_->id = _tmp2_;
-	_tmp3_ = cancellable;
-	_tmp4_ = g_object_ref (_tmp3_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp4_;
-	rygel_media_export_null_container_real_find_object_co (_data_);
+static void rygel_media_export_null_container_init (RygelMediaExportNullContainer *self G_GNUC_UNUSED) {
 }
-
-
-static RygelMediaObject* rygel_media_export_null_container_real_find_object_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaObject* result;
-	RygelMediaExportNullContainerFindObjectData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return NULL;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-	result = _data_->result;
-	_data_->result = NULL;
-	return result;
-}
-
-
-static gboolean rygel_media_export_null_container_real_find_object_co (RygelMediaExportNullContainerFindObjectData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->result = NULL;
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-}
-
-
-static void rygel_media_export_null_container_class_init (RygelMediaExportNullContainerClass * klass) {
-	rygel_media_export_null_container_parent_class = g_type_class_peek_parent (klass);
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children = rygel_media_export_null_container_real_get_children;
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children_finish = rygel_media_export_null_container_real_get_children_finish;
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object = rygel_media_export_null_container_real_find_object;
-	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object_finish = rygel_media_export_null_container_real_find_object_finish;
-}
-
-
-static void rygel_media_export_null_container_init (RygelMediaExportNullContainer * self) {
-}
-
-
-
-
diff --git a/src/media-export/rygel-media-export-null-container.h b/src/media-export/rygel-media-export-null-container.h
index 919a469..388f18b 100644
--- a/src/media-export/rygel-media-export-null-container.h
+++ b/src/media-export/rygel-media-export-null-container.h
@@ -43,9 +43,11 @@ struct _RygelMediaExportNullContainerClass {
   RygelMediaContainerClass parent_class;
 };
 
-GType rygel_media_export_null_container_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_null_container_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportNullContainer* rygel_media_export_null_container_new ();
+RygelMediaExportNullContainer *
+rygel_media_export_null_container_new (void);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-query-container-factory.c b/src/media-export/rygel-media-export-query-container-factory.c
index 4100c07..111df1f 100644
--- a/src/media-export/rygel-media-export-query-container-factory.c
+++ b/src/media-export/rygel-media-export-query-container-factory.c
@@ -30,79 +30,13 @@
 #include <libgupnp-av/gupnp-av.h>
 
 
-#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY (rygel_media_export_query_container_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactory))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
-
 typedef struct _RygelMediaExportQueryContainerFactory RygelMediaExportQueryContainerFactory;
 typedef struct _RygelMediaExportQueryContainerFactoryClass RygelMediaExportQueryContainerFactoryClass;
-typedef struct _RygelMediaExportQueryContainerFactoryPrivate RygelMediaExportQueryContainerFactoryPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE (rygel_media_export_media_cache_get_type ())
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCache))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
-
-typedef struct _RygelMediaExportMediaCache RygelMediaExportMediaCache;
-typedef struct _RygelMediaExportMediaCacheClass RygelMediaExportMediaCacheClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER (rygel_media_export_db_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainerClass))
-
-typedef struct _RygelMediaExportDBContainer RygelMediaExportDBContainer;
-typedef struct _RygelMediaExportDBContainerClass RygelMediaExportDBContainerClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER (rygel_media_export_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainer))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainerClass))
-
-typedef struct _RygelMediaExportQueryContainer RygelMediaExportQueryContainer;
-typedef struct _RygelMediaExportQueryContainerClass RygelMediaExportQueryContainerClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER (rygel_media_export_leaf_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainer))
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_LEAF_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_LEAF_QUERY_CONTAINER, RygelMediaExportLeafQueryContainerClass))
-
-typedef struct _RygelMediaExportLeafQueryContainer RygelMediaExportLeafQueryContainer;
-typedef struct _RygelMediaExportLeafQueryContainerClass RygelMediaExportLeafQueryContainerClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER (rygel_media_export_node_query_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainer))
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_NODE_QUERY_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_NODE_QUERY_CONTAINER, RygelMediaExportNodeQueryContainerClass))
-
-typedef struct _RygelMediaExportNodeQueryContainer RygelMediaExportNodeQueryContainer;
-typedef struct _RygelMediaExportNodeQueryContainerClass RygelMediaExportNodeQueryContainerClass;
-#define rygel_search_expression_unref(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
-
-struct _RygelMediaExportQueryContainerFactory {
-	GObject parent_instance;
-	RygelMediaExportQueryContainerFactoryPrivate * priv;
-};
 
-struct _RygelMediaExportQueryContainerFactoryClass {
-	GObjectClass parent_class;
-};
+#define rygel_search_expression_unref(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
 
 struct _RygelMediaExportQueryContainerFactoryPrivate {
-	GeeHashMap* virtual_container_map;
+  GeeHashMap *virtual_container_map;
 };
 
 
@@ -110,29 +44,13 @@ static gpointer rygel_media_export_query_container_factory_parent_class = NULL;
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_instance;
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_instance = NULL;
 
-GType rygel_media_export_query_container_factory_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_DUMMY_PROPERTY
 };
-RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_get_default (void);
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_new (void);
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_construct (GType object_type);
-void rygel_media_export_query_container_factory_register_id (RygelMediaExportQueryContainerFactory* self, gchar** id);
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
-gchar* rygel_media_export_query_container_factory_get_virtual_container_definition (RygelMediaExportQueryContainerFactory* self, const gchar* hash);
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_query_container_get_type (void) G_GNUC_CONST;
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_id (RygelMediaExportQueryContainerFactory* self, RygelMediaExportMediaCache* cache, const gchar* id, const gchar* name);
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory* self, RygelMediaExportMediaCache* cache, const gchar* definition, const gchar* name);
 static RygelSearchExpression* rygel_media_export_query_container_factory_parse_description (RygelMediaExportQueryContainerFactory* self, const gchar* description, gchar** pattern, gchar** attribute, gchar** upnp_class, gchar** name);
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-RygelMediaExportLeafQueryContainer* rygel_media_export_leaf_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
-GType rygel_media_export_leaf_query_container_get_type (void) G_GNUC_CONST;
-RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_new (RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute);
-RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute);
-GType rygel_media_export_node_query_container_get_type (void) G_GNUC_CONST;
 static gchar* rygel_media_export_query_container_factory_map_upnp_class (RygelMediaExportQueryContainerFactory* self, const gchar* attribute);
 static void rygel_media_export_query_container_factory_update_search_expression (RygelMediaExportQueryContainerFactory* self, RygelSearchExpression** expression, const gchar* key, const gchar* value);
 static void rygel_media_export_query_container_factory_finalize (GObject* obj);
diff --git a/src/media-export/rygel-media-export-query-container-factory.h b/src/media-export/rygel-media-export-query-container-factory.h
new file mode 100644
index 0000000..d9fd9e5
--- /dev/null
+++ b/src/media-export/rygel-media-export-query-container-factory.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 Jens Georg <mail jensge org>.
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
+
+#include "rygel-media-export-query-container.h"
+
+G_BEGIN_DECLS
+
+#define RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY (rygel_media_export_query_container_factory_get_type ())
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactory))
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
+#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
+#define RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY))
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryClass))
+
+typedef struct _RygelMediaExportQueryContainerFactory RygelMediaExportQueryContainerFactory;
+typedef struct _RygelMediaExportQueryContainerFactoryClass RygelMediaExportQueryContainerFactoryClass;
+typedef struct _RygelMediaExportQueryContainerFactoryPrivate RygelMediaExportQueryContainerFactoryPrivate;
+
+struct _RygelMediaExportQueryContainerFactory {
+  GObject parent_instance;
+  RygelMediaExportQueryContainerFactoryPrivate *priv;
+};
+
+struct _RygelMediaExportQueryContainerFactoryClass {
+  GObjectClass parent_class;
+};
+
+GType
+rygel_media_export_query_container_factory_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportQueryContainerFactory *
+rygel_media_export_query_container_factory_get_default (void);
+
+RygelMediaExportQueryContainer *
+rygel_media_export_query_container_factory_create_from_id (RygelMediaExportQueryContainerFactory *self,
+							   RygelMediaExportMediaCache            *cache,
+							   const gchar                           *id,
+							   const gchar                           *name);
+
+RygelMediaExportQueryContainer *
+rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory *self,
+								    RygelMediaExportMediaCache            *cache,
+								    const gchar                           *definition,
+								    const gchar                           *name);
+
+void
+rygel_media_export_query_container_factory_register_id (RygelMediaExportQueryContainerFactory  *self,
+							gchar                                 **id);
+
+gchar *
+rygel_media_export_query_container_factory_get_virtual_container_definition (RygelMediaExportQueryContainerFactory *self,
+									     const gchar                           *hash);
+
+G_END_DECLS
+
+#endif
diff --git a/src/media-export/rygel-media-export-query-container.c b/src/media-export/rygel-media-export-query-container.c
index 8453da4..a46e431 100644
--- a/src/media-export/rygel-media-export-query-container.c
+++ b/src/media-export/rygel-media-export-query-container.c
@@ -21,330 +21,271 @@
 
 #include "rygel-media-export-query-container.h"
 
-G_DEFINE_TYPE (RygelMediaExportQueryContainer, rygel_media_export_query_container, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER)
+static void
+rygel_media_export_query_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface *iface);
 
-#define rygel_search_expression_unref(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
-typedef struct _RygelMediaExportQueryContainerSearchData RygelMediaExportQueryContainerSearchData;
+G_DEFINE_TYPE_WITH_CODE (RygelMediaExportQueryContainer,
+                         rygel_media_export_query_container,
+                         RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER,
+                         G_IMPLEMENT_INTERFACE (RYGEL_TYPE_SEARCHABLE_CONTAINER,
+                                                rygel_media_export_query_container_rygel_searchable_container_interface_init))
+
+struct _RygelMediaExportQueryContainerPrivate {
+  RygelSearchExpression *expression;
+};
 
+typedef struct _RygelMediaExportQueryContainerSearchData RygelMediaExportQueryContainerSearchData;
 
 struct _RygelMediaExportQueryContainerSearchData {
-	int _state_;
-	GObject* _source_object_;
-	GAsyncResult* _res_;
-	GSimpleAsyncResult* _async_result;
-	RygelMediaExportQueryContainer* self;
-	RygelSearchExpression* expression;
-	guint offset;
-	guint max_count;
-	guint total_matches;
-	gchar* sort_criteria;
-	GCancellable* cancellable;
-	RygelMediaObjects* result;
-	RygelMediaObjects* children;
-	RygelSearchExpression* combined_expression;
-	RygelSearchExpression* _tmp0_;
-	RygelSearchExpression* _tmp1_;
-	RygelSearchExpression* _tmp2_;
-	RygelLogicalExpression* _tmp3_;
-	RygelLogicalExpression* local_expression;
-	RygelLogicalExpression* _tmp4_;
-	RygelSearchExpression* _tmp5_;
-	RygelSearchExpression* _tmp6_;
-	RygelLogicalExpression* _tmp7_;
-	RygelLogicalExpression* _tmp8_;
-	RygelSearchExpression* _tmp9_;
-	RygelSearchExpression* _tmp10_;
-	RygelLogicalExpression* _tmp11_;
-	RygelSearchExpression* _tmp12_;
-	RygelMediaExportMediaCache* _tmp13_;
-	RygelSearchExpression* _tmp14_;
-	const gchar* _tmp15_;
-	guint _tmp16_;
-	guint _tmp17_;
-	guint _tmp18_;
-	RygelMediaObjects* _tmp19_;
-	RygelMediaObjects* _tmp20_;
-	GError* _error_;
-	GError* _tmp21_;
-	RygelMediaObjects* _tmp22_;
-	GError* _tmp23_;
-	GError* _tmp24_;
-	GError * _inner_error_;
+  guint total_matches;
+  RygelMediaObjects *result;
 };
 
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
-RygelMediaExportQueryContainer* rygel_media_export_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name);
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, \
+                                RygelMediaExportQueryContainerPrivate))
 
-gint rygel_media_export_query_container_count_children (RygelMediaExportQueryContainer* self, GError** error);
-static void rygel_media_export_query_container_real_search_data_free (gpointer _data);
-static void rygel_media_export_query_container_real_search (RygelMediaExportDBContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static gboolean rygel_media_export_query_container_real_search_co (RygelMediaExportQueryContainerSearchData* _data_);
-RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, const gchar* sort_criteria, guint offset, guint max_count, guint* total_matches, GError** error);
-GQuark rygel_media_export_media_cache_error_quark (void);
-static gint rygel_media_export_query_container_real_count_children (RygelMediaExportQueryContainer* self, GError** error);
-static void rygel_media_export_query_container_finalize (GObject* obj);
+enum  {
+  RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_DUMMY_PROPERTY,
+  RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_EXPRESSION
+};
 
+static void
+rygel_media_export_query_container_constructed (GObject *object)
+{
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (object);
+  gint child_count;
+  GError *error = NULL;
 
-static gpointer _rygel_search_expression_ref0 (gpointer self) {
-	return self ? rygel_search_expression_ref (self) : NULL;
+  G_OBJECT_CLASS (rygel_media_export_query_container_parent_class)->constructed (object);
+  child_count = rygel_media_export_query_container_count_children (self, &error);
+  if (error) {
+    g_error_free (error);
+    child_count = 0;
+  }
+  RYGEL_MEDIA_CONTAINER (self)->child_count = child_count;
 }
 
+static void
+rygel_media_export_query_container_real_search_data_free (gpointer user_data) {
+  RygelMediaExportQueryContainerSearchData *data = (RygelMediaExportQueryContainerSearchData *) user_data;
 
-RygelMediaExportQueryContainer* rygel_media_export_query_container_construct (GType object_type, RygelMediaExportMediaCache* cache, RygelSearchExpression* expression, const gchar* id, const gchar* name) {
-	RygelMediaExportQueryContainer * self = NULL;
-	RygelMediaExportMediaCache* _tmp0_;
-	const gchar* _tmp1_;
-	const gchar* _tmp2_;
-	RygelSearchExpression* _tmp3_;
-	RygelSearchExpression* _tmp4_;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (cache != NULL, NULL);
-	g_return_val_if_fail (expression != NULL, NULL);
-	g_return_val_if_fail (id != NULL, NULL);
-	g_return_val_if_fail (name != NULL, NULL);
-	_tmp0_ = cache;
-	_tmp1_ = id;
-	_tmp2_ = name;
-	self = (RygelMediaExportQueryContainer*) rygel_media_export_db_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
-	_tmp3_ = expression;
-	_tmp4_ = _rygel_search_expression_ref0 (_tmp3_);
-	rygel_search_expression_unref (self->expression);
-	self->expression = _tmp4_;
-	{
-		gint _tmp5_ = 0;
-		gint _tmp6_;
-		_tmp5_ = rygel_media_export_query_container_count_children (self, &_inner_error_);
-		_tmp6_ = _tmp5_;
-		if (_inner_error_ != NULL) {
-			goto __catch38_g_error;
-		}
-		((RygelMediaContainer*) self)->child_count = _tmp6_;
-	}
-	goto __finally38;
-	__catch38_g_error:
-	{
-		GError* _error_ = NULL;
-		_error_ = _inner_error_;
-		_inner_error_ = NULL;
-		((RygelMediaContainer*) self)->child_count = 0;
-		g_error_free (_error_);
-	}
-	__finally38:
-	if (_inner_error_ != NULL) {
-		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-		g_clear_error (&_inner_error_);
-		return NULL;
-	}
-	return self;
+  if (data->result) {
+    g_object_unref (data->result);
+  }
 }
 
 
-static void rygel_media_export_query_container_real_search_data_free (gpointer _data) {
-	RygelMediaExportQueryContainerSearchData* _data_;
-	_data_ = _data;
-	rygel_search_expression_unref (_data_->expression);
-	g_free (_data_->sort_criteria);
-	g_object_unref (_data_->cancellable);
-	g_object_unref (_data_->result);
-	g_object_unref (_data_->self);
-	g_slice_free (RygelMediaExportQueryContainerSearchData, _data_);
-}
+static void
+rygel_media_export_query_container_real_search (RygelMediaExportSearchableContainer *base,
+                                                RygelSearchExpression               *expression,
+                                                guint                                offset,
+                                                guint                                max_count,
+                                                const gchar                         *sort_criteria,
+                                                GCancellable                        *cancellable,
+                                                GAsyncReadyCallback                  callback,
+                                                gpointer                             user_data) {
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (base);
+  GSimpleAsyncResult *simple;
+  guint matches = 0;
+  RygelMediaObjects *objects;
+  RygelSearchExpression *combined_expression;
+  GError *error = NULL;
+  RygelMediaExportMediaCache *cache = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
 
+  if (!expression) {
+    combined_expression = rygel_search_expression_ref (self->priv->expression);
+  } else {
+    combined = rygel_logical_expression_new ();
+    combined->operand1 = rygel_search_expression_ref (self->priv->expression);
+    combined->op = RYGEL_LOGICAL_OPERATOR_AND;
+    combined->operand2 = rygel_search_expression_ref (expression);
+  }
 
-static void rygel_media_export_query_container_real_search (RygelMediaExportDBContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
-	RygelMediaExportQueryContainer * self;
-	RygelMediaExportQueryContainerSearchData* _data_;
-	RygelMediaExportQueryContainer* _tmp0_;
-	RygelSearchExpression* _tmp1_;
-	RygelSearchExpression* _tmp2_;
-	guint _tmp3_;
-	guint _tmp4_;
-	const gchar* _tmp5_;
-	gchar* _tmp6_;
-	GCancellable* _tmp7_;
-	GCancellable* _tmp8_;
-	self = (RygelMediaExportQueryContainer*) base;
-	_data_ = g_slice_new0 (RygelMediaExportQueryContainerSearchData);
-	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_media_export_query_container_real_search);
-	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_media_export_query_container_real_search_data_free);
-	_tmp0_ = g_object_ref (self);
-	_data_->self = _tmp0_;
-	_tmp1_ = expression;
-	_tmp2_ = _rygel_search_expression_ref0 (_tmp1_);
-	rygel_search_expression_unref (_data_->expression);
-	_data_->expression = _tmp2_;
-	_tmp3_ = offset;
-	_data_->offset = _tmp3_;
-	_tmp4_ = max_count;
-	_data_->max_count = _tmp4_;
-	_tmp5_ = sort_criteria;
-	_tmp6_ = g_strdup (_tmp5_);
-	g_free (_data_->sort_criteria);
-	_data_->sort_criteria = _tmp6_;
-	_tmp7_ = cancellable;
-	_tmp8_ = g_object_ref (_tmp7_);
-	g_object_unref (_data_->cancellable);
-	_data_->cancellable = _tmp8_;
-	rygel_media_export_query_container_real_search_co (_data_);
+  objects = rygel_media_export_media_cache_get_objects_by_search_expression (cache,
+                                                                             combined_expression,
+                                                                             NULL,
+                                                                             sort_criteria,
+                                                                             offset,
+                                                                             max_count,
+                                                                             &matches,
+                                                                             &error);
+
+  if (error) {
+    if (g_error_matches (error,
+                         RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR,
+                         RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UNSUPPORTED_SEARCH)) {
+      objects = rygel_media_objects_new ();
+      matches = 0;
+      g_error_free (error);
+      error = NULL;
+    }
+  }
+
+  if (error) {
+    simple = g_simple_async_result_new_take_error (G_OBJECT (self),
+                                                   callback,
+                                                   user_data,
+                                                   error);
+  } else {
+    RygelMediaExportQueryContainerSearchData *data = g_slice_new0 (RygelMediaExportQueryContainerSearchData);
+
+    simple = g_simple_async_result_new (G_OBJECT (self),
+                                        callback,
+                                        user_data,
+                                        rygel_media_export_query_container_real_search);
+    data->result = objects;
+    data->total_matches = matches;
+    g_simple_async_result_set_op_res_pointer (simple,
+                                              data,
+                                              rygel_media_export_query_container_real_search_data_free);
+  }
+  g_simple_async_result_complete_in_idle (simple);
+  g_object_unref (simple);
+  rygel_search_expression_unref (combined_expression);
 }
 
 
-static RygelMediaObjects* rygel_media_export_query_container_real_search_finish (RygelMediaExportDBContainer* base, GAsyncResult* _res_, guint* total_matches, GError** error) {
-	RygelMediaObjects* result;
-	RygelMediaExportQueryContainerSearchData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return NULL;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-	if (total_matches) {
-		*total_matches = _data_->total_matches;
-	}
-	result = _data_->result;
-	_data_->result = NULL;
-	return result;
+static RygelMediaObjects *
+rygel_media_export_query_container_real_search_finish (RygelMediaExportDBContainer  *base,
+                                                       GAsyncResult                 *res,
+                                                       guint                        *total_matches,
+                                                       GError                      **error) {
+  RygelMediaObjects* result;
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+  RygelMediaExportQueryContainerSearchData* data;
+
+  if (g_simple_async_result_propagate_error (simple, error)) {
+    return NULL;
+  }
+  data = g_simple_async_result_get_op_res_gpointer (simple);
+  if (total_matches) {
+    *total_matches = data->total_matches;
+  }
+  result = data->result;
+  data->result = NULL;
+
+  return result;
 }
 
-static gboolean rygel_media_export_query_container_real_search_co (RygelMediaExportQueryContainerSearchData* _data_) {
-	switch (_data_->_state_) {
-		case 0:
-		goto _state_0;
-		default:
-		g_assert_not_reached ();
-	}
-	_state_0:
-	_data_->children = NULL;
-	_data_->_tmp0_ = _data_->expression;
-	if (_data_->_tmp0_ == NULL) {
-		_data_->_tmp1_ = _data_->self->expression;
-		_data_->_tmp2_ = _rygel_search_expression_ref0 (_data_->_tmp1_);
-		rygel_search_expression_unref (_data_->combined_expression);
-		_data_->combined_expression = _data_->_tmp2_;
-	} else {
-		_data_->_tmp3_ = rygel_logical_expression_new ();
-		_data_->local_expression = _data_->_tmp3_;
-		_data_->_tmp4_ = _data_->local_expression;
-		_data_->_tmp5_ = _data_->self->expression;
-		_data_->_tmp6_ = _rygel_search_expression_ref0 (_data_->_tmp5_);
-		rygel_search_expression_unref (((RygelSearchExpression*) _data_->_tmp4_)->operand1);
-		((RygelSearchExpression*) _data_->_tmp4_)->operand1 = _data_->_tmp6_;
-		_data_->_tmp7_ = _data_->local_expression;
-		((RygelSearchExpression*) _data_->_tmp7_)->op = (gpointer) ((gintptr) RYGEL_LOGICAL_OPERATOR_AND);
-		_data_->_tmp8_ = _data_->local_expression;
-		_data_->_tmp9_ = _data_->expression;
-		_data_->_tmp10_ = _rygel_search_expression_ref0 (_data_->_tmp9_);
-		rygel_search_expression_unref (((RygelSearchExpression*) _data_->_tmp8_)->operand2);
-		((RygelSearchExpression*) _data_->_tmp8_)->operand2 = _data_->_tmp10_;
-		_data_->_tmp11_ = _data_->local_expression;
-		_data_->_tmp12_ = _rygel_search_expression_ref0 ((RygelSearchExpression*) _data_->_tmp11_);
-		rygel_search_expression_unref (_data_->combined_expression);
-		_data_->combined_expression = _data_->_tmp12_;
-		rygel_search_expression_unref (_data_->local_expression);
-	}
-	{
-		_data_->_tmp13_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (_data_->self));
-		_data_->_tmp14_ = _data_->combined_expression;
-		_data_->_tmp15_ = _data_->sort_criteria;
-		_data_->_tmp16_ = _data_->offset;
-		_data_->_tmp17_ = _data_->max_count;
-		_data_->_tmp18_ = 0U;
-		_data_->_tmp19_ = NULL;
-		_data_->_tmp19_ = rygel_media_export_media_cache_get_objects_by_search_expression (_data_->_tmp13_, _data_->_tmp14_, NULL, _data_->_tmp15_, _data_->_tmp16_, _data_->_tmp17_, &_data_->_tmp18_, &_data_->_inner_error_);
-		_data_->total_matches = _data_->_tmp18_;
-		_data_->_tmp20_ = _data_->_tmp19_;
-		if (_data_->_inner_error_ != NULL) {
-			if (_data_->_inner_error_->domain == RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR) {
-				goto __catch39_rygel_media_export_media_cache_error;
-			}
-			goto __finally39;
-		}
-		g_object_unref (_data_->children);
-		_data_->children = _data_->_tmp20_;
-	}
-	goto __finally39;
-	__catch39_rygel_media_export_media_cache_error:
-	{
-		_data_->_error_ = _data_->_inner_error_;
-		_data_->_inner_error_ = NULL;
-		_data_->_tmp21_ = _data_->_error_;
-		if (g_error_matches (_data_->_tmp21_, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
-			_data_->_tmp22_ = rygel_media_objects_new ();
-			g_object_unref (_data_->children);
-			_data_->children = _data_->_tmp22_;
-			_data_->total_matches = (guint) 0;
-		} else {
-			_data_->_tmp23_ = _data_->_error_;
-			_data_->_tmp24_ = g_error_copy (_data_->_tmp23_);
-			_data_->_inner_error_ = _data_->_tmp24_;
-			g_error_free (_data_->_error_);
-			goto __finally39;
-		}
-		g_error_free (_data_->_error_);
-	}
-	__finally39:
-	if (_data_->_inner_error_ != NULL) {
-		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
-		g_error_free (_data_->_inner_error_);
-		rygel_search_expression_unref (_data_->combined_expression);
-		g_object_unref (_data_->children);
-		if (_data_->_state_ == 0) {
-			g_simple_async_result_complete_in_idle (_data_->_async_result);
-		} else {
-			g_simple_async_result_complete (_data_->_async_result);
-		}
-		g_object_unref (_data_->_async_result);
-		return FALSE;
-	}
-	_data_->result = _data_->children;
-	rygel_search_expression_unref (_data_->combined_expression);
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
-	rygel_search_expression_unref (_data_->combined_expression);
-	g_object_unref (_data_->children);
-	if (_data_->_state_ == 0) {
-		g_simple_async_result_complete_in_idle (_data_->_async_result);
-	} else {
-		g_simple_async_result_complete (_data_->_async_result);
-	}
-	g_object_unref (_data_->_async_result);
-	return FALSE;
+static gint
+rygel_media_export_query_container_real_count_children (RygelMediaExportQueryContainer* self, GError** error) {
+  g_critical ("Type `%s' does not implement abstract method `rygel_media_export_query_container_count_children'",
+              g_type_name (G_TYPE_FROM_INSTANCE (self)));
+  return 0;
 }
 
 
-static gint rygel_media_export_query_container_real_count_children (RygelMediaExportQueryContainer* self, GError** error) {
-	g_critical ("Type `%s' does not implement abstract method `rygel_media_export_query_container_count_children'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
-	return 0;
+gint
+rygel_media_export_query_container_count_children (RygelMediaExportQueryContainer* self,
+                                                   GError** error) {
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER (self), 0);
+
+  return RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_CLASS (self)->count_children (self, error);
 }
 
+static void rygel_media_export_query_container_dispose (GObject *object) {
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (object);
+  RygelMediaExportQueryContainerPrivate *priv = self->priv;
 
-gint rygel_media_export_query_container_count_children (RygelMediaExportQueryContainer* self, GError** error) {
-	g_return_val_if_fail (self != NULL, 0);
-	return RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_CLASS (self)->count_children (self, error);
+  if (priv->expression) {
+    RygelSearchExpression *expression = priv->expression;
+
+    priv->expression = NULL;
+    rygel_search_expression_unref (priv->expression);
+  }
+  G_OBJECT_CLASS (rygel_media_export_query_container_parent_class)->dispose (object);
 }
 
+static void
+rygel_media_export_query_container_get_property (GObject    *object,
+                                                 guint       property_id,
+                                                 GValue     *value,
+                                                 GParamSpec *pspec) {
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
+  RygelMediaExportQueryContainerPrivate *priv = self->priv;
+
+  switch (property_id) {
+  case RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_EXPRESSION:
+    rygel_value_set_search_expression (value, priv->expression);
+    break;
 
-static void rygel_media_export_query_container_class_init (RygelMediaExportQueryContainerClass * klass) {
-	rygel_media_export_query_container_parent_class = g_type_class_peek_parent (klass);
-	RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (klass)->search = rygel_media_export_query_container_real_search;
-	RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (klass)->search_finish = rygel_media_export_query_container_real_search_finish;
-	RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS (klass)->count_children = rygel_media_export_query_container_real_count_children;
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_query_container_finalize;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
+static void
+rygel_media_export_query_container_set_property (GObject      *object,
+                                                 guint         property_id,
+                                                 const GValue *value,
+                                                 GParamSpec   *pspec) {
+  RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
+  RygelMediaExportDBContainerPrivate *priv = self->priv;
+
+  switch (property_id) {
+  case RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_EXPRESSION:
+    /* construct only property */
+    priv->expression = rygel_value_get_search_expression (value);
+    rygel_search_expression_ref (priv->expression);
+    break;
 
-static void rygel_media_export_query_container_init (RygelMediaExportQueryContainer * self) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    break;
+  }
 }
 
+static void
+rygel_media_export_query_container_class_init (RygelMediaExportQueryContainerClass *query_container_class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (query_container_class);
 
-static void rygel_media_export_query_container_finalize (GObject* obj) {
-	RygelMediaExportQueryContainer * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, RygelMediaExportQueryContainer);
-	rygel_search_expression_unref (self->expression);
-	G_OBJECT_CLASS (rygel_media_export_query_container_parent_class)->finalize (obj);
+  query_container_class->count_children = rygel_media_export_query_container_real_count_children;
+  object_class->dispose = rygel_media_export_query_container_dispose;
+  object_class->constructed = rygel_media_export_query_container_constructed;
+  object_class->set_property = rygel_media_export_container_set_property;
+  object_class->get_property = rygel_media_export_container_get_property;
+
+  g_object_class_install_property (object_class,
+                                   RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_EXPRESSION,
+                                   rygel_param_spec_search_expression ("expression",
+                                                                       "expression",
+                                                                       "expression",
+                                                                       RYGEL_MEDIA_EXPORT_TYPE_SEARCH_EXPRESSION,
+                                                                       G_PARAM_STATIC_NAME |
+                                                                       G_PARAM_STATIC_NICK |
+                                                                       G_PARAM_STATIC_BLURB |
+                                                                       G_PARAM_READABLE |
+                                                                       G_PARAM_WRITABLE |
+                                                                       G_PARAM_CONSTRUCT_ONLY));
+
+  g_type_class_add_private (klass,
+                            sizeof (RygelMediaExportQueryContainerPrivate));
 }
 
 
+static void rygel_media_export_query_container_init (RygelMediaExportQueryContainer *self) {
+  self->priv = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_GET_PRIVATE (self);
+}
+
+static void
+rygel_media_export_query_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface *iface) {
+  iface->search = rygel_media_export_query_container_real_search;
+  iface->search_finish = rygel_media_export_query_container_real_search_finish;
+  /* iface should be a copy of parent_searchable_container_iface, so
+   * we don't have to override the {get,set}_search_classes funcs.
+   *
+   * iface->get_search_classes = parent_searchable_container_iface->get_search_classes;
+   * iface->set_search_classes = parent_searchable_container_iface->set_search_classes;
+   */
+}
+
+RygelSearchExpression *
+rygel_media_export_query_container_get_expression (RygelMediaExportQueryContainer *self)
+{
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER (self), NULL);
+
+  return self->priv->expression;
+}
diff --git a/src/media-export/rygel-media-export-query-container.h b/src/media-export/rygel-media-export-query-container.h
index 2590c1d..fe11c25 100644
--- a/src/media-export/rygel-media-export-query-container.h
+++ b/src/media-export/rygel-media-export-query-container.h
@@ -37,20 +37,28 @@ typedef struct _RygelMediaExportQueryContainer RygelMediaExportQueryContainer;
 typedef struct _RygelMediaExportQueryContainerClass RygelMediaExportQueryContainerClass;
 typedef struct _RygelMediaExportQueryContainerPrivate RygelMediaExportQueryContainerPrivate;
 
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
+
 struct _RygelMediaExportQueryContainer {
-	RygelMediaExportDBContainer parent_instance;
-	RygelMediaExportQueryContainerPrivate * priv;
-	RygelSearchExpression* expression;
+        RygelMediaExportDBContainer parent_instance;
+        RygelMediaExportQueryContainerPrivate *priv;
 };
 
 struct _RygelMediaExportQueryContainerClass {
-	RygelMediaExportDBContainerClass parent_class;
-	gint (*count_children) (RygelMediaExportQueryContainer* self, GError** error);
+        RygelMediaExportDBContainerClass parent_class;
+        gint (* count_children) (RygelMediaExportQueryContainer  *self,
+                                 GError                         **error);
 };
 
-GType rygel_media_export_query_container_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_query_container_get_type (void) G_GNUC_CONST;
+
+gint
+rygel_media_export_query_container_count_children (RygelMediaExportQueryContainer *self,
+                                                   GError **error);
 
-RygelMediaExportQueryContainer* rygel_media_export_query_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
+RygelSearchExpression *
+rygel_media_export_query_container_get_expression (RygelMediaExportQueryContainer *self);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-root-container.c b/src/media-export/rygel-media-export-root-container.c
index 5b5e20c..b4b1d5a 100644
--- a/src/media-export/rygel-media-export-root-container.c
+++ b/src/media-export/rygel-media-export-root-container.c
@@ -25,7 +25,14 @@
  * Represents the root container.
  */
 
-G_DEFINE_TYPE (RygelMediaExportRootContainer, rygel_media_export_root_container, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER)
+static void
+rygel_media_export_root_container_searchable_container_interface_init (RygelSearchableContainerIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (RygelMediaExportRootContainer,
+			 rygel_media_export_root_container,
+			 RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER,
+			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_SEARCHABLE_CONTAINER,
+						rygel_media_export_root_container_searchable_container_interface_init))
 
 #define RYGEL_MEDIA_EXPORT_TYPE_FOLDER_DEFINITION (rygel_media_export_folder_definition_get_type ())
 typedef struct _RygelMediaExportFolderDefinition RygelMediaExportFolderDefinition;
@@ -557,7 +564,7 @@ static gpointer _rygel_search_expression_ref0 (gpointer self) {
 }
 
 
-static void rygel_media_export_root_container_real_search (RygelMediaExportDBContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+static void rygel_media_export_root_container_real_search (RygelSearchableContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 	RygelMediaExportRootContainer * self;
 	RygelMediaExportRootContainerSearchData* _data_;
 	RygelMediaExportRootContainer* _tmp0_;
@@ -643,11 +650,11 @@ static gboolean rygel_media_export_root_container_real_search_co (RygelMediaExpo
 		_data_->_tmp5_ = _data_->cancellable;
 		_data_->_tmp6_ = 0U;
 		_data_->_state_ = 1;
-		RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (rygel_media_export_root_container_parent_class)->search (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer), _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, rygel_media_export_root_container_search_ready, _data_);
+		parent_searchable_container_iface->search (RYGEL_SEARCHABLE_CONTAINER (_data_->self), _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, rygel_media_export_root_container_search_ready, _data_);
 		return FALSE;
 		_state_1:
 		_data_->_tmp7_ = NULL;
-		_data_->_tmp7_ = RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (rygel_media_export_root_container_parent_class)->search_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer), _data_->_res_, &_data_->_tmp6_, &_data_->_inner_error_);
+		_data_->_tmp7_ = parent_searchable_container_iface->search_finish (RYGEL_SEARCHABLE_CONTAINER (_data_->self), _data_->_res_, &_data_->_tmp6_, &_data_->_inner_error_);
 		_data_->total_matches = _data_->_tmp6_;
 		_data_->_tmp8_ = _data_->_tmp7_;
 		if (_data_->_inner_error_ != NULL) {
@@ -781,11 +788,11 @@ static gboolean rygel_media_export_root_container_real_search_co (RygelMediaExpo
 		_data_->_tmp48_ = _data_->cancellable;
 		_data_->_tmp49_ = 0U;
 		_data_->_state_ = 3;
-		RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (rygel_media_export_root_container_parent_class)->search (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer), _data_->_tmp44_, _data_->_tmp45_, _data_->_tmp46_, _data_->_tmp47_, _data_->_tmp48_, rygel_media_export_root_container_search_ready, _data_);
+		parent_searchable_container_iface->search (RYGEL_SEARCHABLE_CONTAINER (_data_->self), _data_->_tmp44_, _data_->_tmp45_, _data_->_tmp46_, _data_->_tmp47_, _data_->_tmp48_, rygel_media_export_root_container_search_ready, _data_);
 		return FALSE;
 		_state_3:
 		_data_->_tmp50_ = NULL;
-		_data_->_tmp50_ = RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (rygel_media_export_root_container_parent_class)->search_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer), _data_->_res_, &_data_->_tmp49_, &_data_->_inner_error_);
+		_data_->_tmp50_ = parent_searchable_container_iface->search_finish (RYGEL_SEARCHABLE_CONTAINER (_data_->self), _data_->_res_, &_data_->_tmp49_, &_data_->_inner_error_);
 		_data_->total_matches = _data_->_tmp49_;
 		_data_->_tmp51_ = _data_->_tmp50_;
 		if (_data_->_inner_error_ != NULL) {
@@ -2144,8 +2151,6 @@ static void rygel_media_export_root_container_class_init (RygelMediaExportRootCo
 	g_type_class_add_private (klass, sizeof (RygelMediaExportRootContainerPrivate));
 	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object = rygel_media_export_root_container_real_find_object;
 	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object_finish = rygel_media_export_root_container_real_find_object_finish;
-	RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (klass)->search = rygel_media_export_root_container_real_search;
-	RYGEL_MEDIA_EXPORT_DB_CONTAINER_CLASS (klass)->search_finish = rygel_media_export_root_container_real_search_finish;
 	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_root_container_finalize;
 }
 
@@ -2165,6 +2170,15 @@ static void rygel_media_export_root_container_finalize (GObject* obj) {
 	G_OBJECT_CLASS (rygel_media_export_root_container_parent_class)->finalize (obj);
 }
 
-
-
-
+static void
+rygel_media_export_root_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface *iface) {
+  parent_searchable_container_iface = g_type_interface_peek_parent (iface);
+  iface->search = rygel_media_export_db_container_real_search;
+  iface->search_finish = rygel_media_export_db_container_real_search_finish;
+  /* iface should be a copy of parent_searchable_container_iface, so
+   * we don't have to override the {get,set}_search_classes funcs.
+   *
+   * iface->get_search_classes = parent_searchable_container_iface->get_search_classes;
+   * iface->set_search_classes = parent_searchable_container_iface->set_search_classes;
+   */
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]