[rygel-gst-0-10-plugins] More cleanup. Project is buildable and test_simple passes.



commit d8cea11fa81827124cc6f3b13abcc8fa56593743
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Wed Jan 23 14:31:59 2013 +0100

    More cleanup. Project is buildable and test_simple passes.
    
    Still many files are not cleaned up, though.

 .gitignore                                         |    1 +
 autogen.sh                                         |    3 +-
 configure.ac                                       |    2 -
 src/media-export/Makefile.am                       |   21 +-
 src/media-export/rygel-media-export-collate.c      |    4 +-
 .../rygel-media-export-database-cursor.c           |    7 +-
 .../rygel-media-export-database-cursor.h           |    5 +-
 src/media-export/rygel-media-export-database.c     |   53 +--
 src/media-export/rygel-media-export-database.h     |    4 +
 src/media-export/rygel-media-export-db-container.c |   33 +-
 src/media-export/rygel-media-export-db-container.h |    5 +-
 .../rygel-media-export-dummy-container.c           |   60 ++-
 .../rygel-media-export-dummy-container.h           |   15 +-
 src/media-export/rygel-media-export-errors.h       |   12 +-
 src/media-export/rygel-media-export-harvester.c    |   72 +---
 src/media-export/rygel-media-export-harvester.h    |   26 +-
 .../rygel-media-export-harvesting-task.c           |   88 +---
 .../rygel-media-export-harvesting-task.h           |   20 +-
 src/media-export/rygel-media-export-item-factory.c |  138 ++----
 src/media-export/rygel-media-export-item-factory.h |   66 +++-
 src/media-export/rygel-media-export-jpeg-writer.c  |   10 +-
 src/media-export/rygel-media-export-jpeg-writer.h  |   18 +-
 .../rygel-media-export-leaf-query-container.c      |   20 +-
 .../rygel-media-export-leaf-query-container.h      |   10 +-
 .../rygel-media-export-media-cache-upgrader.c      |  174 +-------
 .../rygel-media-export-media-cache-upgrader.h      |   34 ++-
 src/media-export/rygel-media-export-media-cache.c  |  471 +++----------------
 src/media-export/rygel-media-export-media-cache.h  |  129 ++++++-
 .../rygel-media-export-metadata-extractor.c        |   29 +-
 .../rygel-media-export-metadata-extractor.h        |   17 +-
 src/media-export/rygel-media-export-music-item.c   |   42 +--
 src/media-export/rygel-media-export-music-item.h   |   13 +-
 .../rygel-media-export-node-query-container.c      |   54 +--
 .../rygel-media-export-node-query-container.h      |    3 +
 .../rygel-media-export-null-container.c            |   16 +-
 .../rygel-media-export-null-container.h            |    2 +
 .../rygel-media-export-object-factory.c            |  200 +--------
 .../rygel-media-export-object-factory.h            |   91 ++++
 src/media-export/rygel-media-export-photo-item.c   |   19 +-
 src/media-export/rygel-media-export-photo-item.h   |   13 +-
 src/media-export/rygel-media-export-plugin.c       |   17 +-
 src/media-export/rygel-media-export-plugin.h       |   17 +-
 .../rygel-media-export-query-container-factory.c   |   41 +--
 .../rygel-media-export-query-container-factory.h   |    8 +-
 .../rygel-media-export-query-container.c           |   63 ++--
 .../rygel-media-export-query-container.h           |    3 +
 .../rygel-media-export-recursive-file-monitor.c    |   23 +-
 .../rygel-media-export-recursive-file-monitor.h    |   26 +-
 .../rygel-media-export-root-container.c            |  204 +++------
 .../rygel-media-export-root-container.h            |   30 ++-
 src/media-export/rygel-media-export-sql-factory.c  |   66 +---
 src/media-export/rygel-media-export-sql-factory.h  |   74 +++-
 src/media-export/rygel-media-export-sql-function.c |    4 +-
 src/media-export/rygel-media-export-sql-function.h |    3 +
 src/media-export/rygel-media-export-sql-operator.c |    2 +-
 src/media-export/rygel-media-export-sql-operator.h |    6 +-
 .../rygel-media-export-sqlite-wrapper.c            |   16 +-
 src/media-export/rygel-media-export-video-item.c   |   28 +-
 src/media-export/rygel-media-export-video-item.h   |   13 +-
 .../rygel-media-export-writable-db-container.c     |  147 ++-----
 .../rygel-media-export-writable-db-container.h     |   63 +++
 tests/Makefile.am                                  |    2 +
 tests/test_simple.c                                |    9 +-
 63 files changed, 1158 insertions(+), 1707 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0c5db41..90b17ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,4 @@ src/rygel-media-engine-gst-0-10.h
 src/rygel-media-engine-gst-0-10.vapi
 src/*.c
 
+tests/test_simple
diff --git a/autogen.sh b/autogen.sh
index 4bdf01c..78959dc 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -32,5 +32,4 @@ REQUIRED_AUTOMAKE_VERSION=1.11 \
 REQUIRED_AUTOCONF_VERSION=2.64 \
 REQUIRED_LIBTOOL_VERSION=2.2.6 \
 REQUIRED_INTLTOOL_VERSION=0.40.0 \
-bash gnome-autogen.sh --enable-vala --enable-maintainer-mode --enable-debug \
-                 --enable-strict-valac "$@"
+bash gnome-autogen.sh --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
index 5fa2600..b225dad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,8 +65,6 @@ AC_ARG_ENABLE(strict-cc,
         enable_strict_cc=no)
 if test "x$enable_strict_cc" = "xyes"; then
         CFLAGS="$CFLAGS -Wall -Werror"
-else
-        CFLAGS="$CFLAGS -w"
 fi
 
 
diff --git a/src/media-export/Makefile.am b/src/media-export/Makefile.am
index 2f4f443..9694806 100644
--- a/src/media-export/Makefile.am
+++ b/src/media-export/Makefile.am
@@ -5,36 +5,45 @@ exportdir = $(libdir)/rygel-2.0/exports
 
 librygel_media_export_gst_0_10_la_SOURCES = \
 	rygel-media-export-collate.c \
-	rygel-media-export-database.c \
 	rygel-media-export-database-cursor.c \
+	rygel-media-export-database.c \
 	rygel-media-export-db-container.c \
 	rygel-media-export-dummy-container.c \
+	rygel-media-export-errors.c \
 	rygel-media-export-harvester.c \
 	rygel-media-export-harvesting-task.c \
 	rygel-media-export-item-factory.c \
-	rygel-media-export-media-cache.c \
+	rygel-media-export-jpeg-writer.c \
+	rygel-media-export-leaf-query-container.c \
 	rygel-media-export-media-cache-upgrader.c \
+	rygel-media-export-media-cache.c \
 	rygel-media-export-metadata-extractor.c \
 	rygel-media-export-music-item.c \
+	rygel-media-export-node-query-container.c \
 	rygel-media-export-null-container.c \
+	rygel-media-export-object-factory.c \
 	rygel-media-export-photo-item.c \
 	rygel-media-export-plugin.c \
+	rygel-media-export-query-container-factory.c \
 	rygel-media-export-query-container.c \
+	rygel-media-export-recursive-file-monitor.c \
 	rygel-media-export-root-container.c \
 	rygel-media-export-sql-factory.c \
 	rygel-media-export-sql-function.c \
 	rygel-media-export-sql-operator.c \
 	rygel-media-export-sqlite-wrapper.c \
-	rygel-media-export-video-item.c
+	rygel-media-export-video-item.c \
+	rygel-media-export-writable-db-container.c
 
 librygel_media_export_gst_0_10_la_CFLAGS = \
 	-DG_LOG_DOMAIN='"MediaExport-GStreamer-0.10"' \
 	-DPRESET_DIR='"$(presetdir)"' \
 	-include config.h \
-	$(DEPS_CFLAGS)
+	$(DEPS_CFLAGS) \
+	$(COLLATION_CFLAGS)
 
 librygel_media_export_gst_0_10_la_LIBADD = \
-	$(DEPS_LIBS)
+	$(DEPS_LIBS) \
+	$(COLLATION_LIBS)
 
 librygel_media_export_gst_0_10_la_LDFLAGS = $(RYGEL_PLUGIN_LINKER_FLAGS)
-
diff --git a/src/media-export/rygel-media-export-collate.c b/src/media-export/rygel-media-export-collate.c
index bedf940..ba2f1a6 100644
--- a/src/media-export/rygel-media-export-collate.c
+++ b/src/media-export/rygel-media-export-collate.c
@@ -29,7 +29,7 @@ gint
 rygel_media_export_utf8_collate_str (const char *a,
                                      const char *b)
 {
-    return u8_strcoll (a, b);
+  return u8_strcoll ((const uint8_t *) a, (const uint8_t *) b);
 }
 
 #else
@@ -38,6 +38,6 @@ gint
 rygel_media_export_utf8_collate_str (const char *a,
                                      const char *b)
 {
-    return g_utf8_collate (a, b);
+  return g_utf8_collate (a, b);
 }
 #endif
diff --git a/src/media-export/rygel-media-export-database-cursor.c b/src/media-export/rygel-media-export-database-cursor.c
index 3759c3a..bcae99f 100644
--- a/src/media-export/rygel-media-export-database-cursor.c
+++ b/src/media-export/rygel-media-export-database-cursor.c
@@ -21,8 +21,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <glib/gi18n-lib.h>
+
 #include "rygel-media-export-database-cursor.h"
-#include "rygel-media-export-database.h"
 
 G_DEFINE_TYPE (RygelMediaExportDatabaseCursor,
                rygel_media_export_database_cursor,
@@ -71,7 +72,7 @@ rygel_media_export_database_cursor_new (sqlite3      *db,
   self = RYGEL_MEDIA_EXPORT_DATABASE_CURSOR (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR,
                                                            "db", db,
                                                            NULL));
-  _tmp4_ = ;
+  self_wrapper = RYGEL_MEDIA_EXPORT_SQLITE_WRAPPER (self);
   rygel_media_export_sqlite_wrapper_throw_if_code_is_error (self_wrapper,
                                                             sqlite3_prepare_v2 (db, sql, -1, &self->priv->statement, NULL),
                                                             &inner_error);
@@ -85,7 +86,7 @@ rygel_media_export_database_cursor_new (sqlite3      *db,
   }
   for (iter = 1; iter <= arguments_length; ++iter) {
     GValue *current_value = &(arguments[iter - 1]);
-    sqlite3_stmt* stmt;
+    sqlite3_stmt* stmt = self->priv->statement;
 
     if (G_VALUE_HOLDS (current_value, G_TYPE_INT)) {
       sqlite3_bind_int (stmt, iter, g_value_get_int (current_value));
diff --git a/src/media-export/rygel-media-export-database-cursor.h b/src/media-export/rygel-media-export-database-cursor.h
index e1cb77b..b708ec3 100644
--- a/src/media-export/rygel-media-export-database-cursor.h
+++ b/src/media-export/rygel-media-export-database-cursor.h
@@ -22,9 +22,12 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DATABASE_CURSOR_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DATABASE_CURSOR_H__
 
-#include "rygel-media-export-sqlite-wrapper.h"
+#include <glib.h>
+#include <glib-object.h>
 #include <sqlite3.h>
 
+#include "rygel-media-export-sqlite-wrapper.h"
+
 G_BEGIN_DECLS
 
 #define RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR (rygel_media_export_database_cursor_get_type ())
diff --git a/src/media-export/rygel-media-export-database.c b/src/media-export/rygel-media-export-database.c
index a57ee9c..5850b1b 100644
--- a/src/media-export/rygel-media-export-database.c
+++ b/src/media-export/rygel-media-export-database.c
@@ -21,10 +21,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "rygel-media-export-database.h"
-#include "rygel-media-export-database-cursor.h"
+#include <glib/gi18n-lib.h>
 #include <sqlite3.h>
 
+#include "rygel-media-export-collate.h"
+#include "rygel-media-export-database.h"
+
 /**
  * This class is a thin wrapper around SQLite's database object.
  *
@@ -38,8 +40,8 @@ G_DEFINE_TYPE (RygelMediaExportDatabase,
 
 static void rygel_media_export_database_utf8_contains (sqlite3_context* context, sqlite3_value** args, int args_length1);
 static gint rygel_media_export_database_utf8_collate (gint alen, void* a, gint blen, void* b);
-static void _rygel_media_export_database_utf8_contains_sqlite_user_func_callback (sqlite3_context* context, int values_length1, sqlite3_value** values);
-static gint _rygel_media_export_database_utf8_collate_sqlite_compare_callback (gpointer self, gint alen, void* a, gint blen, void* b);
+static void rygel_media_export_database_utf8_contains_sqlite_user_func_callback (sqlite3_context* context, int values_length1, sqlite3_value** values);
+static gint rygel_media_export_database_utf8_collate_sqlite_compare_callback (gpointer self, gint alen, void* a, gint blen, void* b);
 
 /**
  * Function to implement the custom SQL function 'contains'
@@ -54,7 +56,7 @@ void rygel_media_export_database_utf8_contains (sqlite3_context  *context,
   g_return_if_fail (context != NULL);
   g_return_if_fail (args_length == 2);
 
-  args_1_text = sqlite3_value_text (args[1]);
+  args_1_text = (const gchar *) sqlite3_value_text (args[1]);
 
   if (args_1_text == NULL) {
     sqlite3_result_int (context, 0);
@@ -62,7 +64,7 @@ void rygel_media_export_database_utf8_contains (sqlite3_context  *context,
   }
   pattern = g_regex_escape_string (args_1_text, -1);
 
-  if (g_regex_match_simple (pattern, sqlite3_value_text (args[0]), G_REGEX_CASELESS, 0)) {
+  if (g_regex_match_simple (pattern, (const gchar *) sqlite3_value_text (args[0]), G_REGEX_CASELESS, 0)) {
     sqlite3_result_int (context, 1);
   } else {
     sqlite3_result_int (context, 0);
@@ -95,7 +97,7 @@ static void
 rygel_media_export_database_utf8_contains_sqlite_user_func_callback (sqlite3_context  *context,
 								     int               values_length,
 								     sqlite3_value   **values) {
-	rygel_media_export_database_utf8_contains (context, values, values_length1);
+	rygel_media_export_database_utf8_contains (context, values, values_length);
 }
 
 static gint rygel_media_export_database_utf8_collate_sqlite_compare_callback (gpointer  self G_GNUC_UNUSED,
@@ -109,7 +111,7 @@ static gint rygel_media_export_database_utf8_collate_sqlite_compare_callback (gp
 RygelMediaExportDatabase*
 rygel_media_export_database_new (const gchar  *name,
 				 GError      **error) {
-  RygelMediaExportDatabase * self;
+  RygelMediaExportDatabase *self;
   gchar *dirname;
   gchar *dbname;
   gchar *db_file;
@@ -129,31 +131,32 @@ rygel_media_export_database_new (const gchar  *name,
   g_free (db_file);
   self = RYGEL_MEDIA_EXPORT_DATABASE (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_DATABASE,
 						    "db", db,
-						    "db-own", db,
+						    "own-db", db,
 						    NULL));
   inner_error = NULL;
-  rygel_media_export_sqlite_wrapper_throw_if_db_has_error (self, &inner_error);
+  rygel_media_export_sqlite_wrapper_throw_if_db_has_error (RYGEL_MEDIA_EXPORT_SQLITE_WRAPPER (self),
+							   &inner_error);
   if (inner_error) {
     g_propagate_error (error, inner_error);
     g_object_unref (self);
     return NULL;
   }
 
-  rygel_media_export_database_exec (self, "PRAGMA synchronous = OFF", NULL, 0, &_inner_error_);
+  rygel_media_export_database_exec (self, "PRAGMA synchronous = OFF", NULL, 0, &inner_error);
   if (inner_error) {
-    g_propagate_error (error, _inner_error_);
+    g_propagate_error (error, inner_error);
     g_object_unref (self);
     return NULL;
   }
-  rygel_media_export_database_exec (self, "PRAGMA temp_store = MEMORY", NULL, 0, &_inner_error_);
+  rygel_media_export_database_exec (self, "PRAGMA temp_store = MEMORY", NULL, 0, &inner_error);
   if (inner_error) {
-    g_propagate_error (error, _inner_error_);
+    g_propagate_error (error, inner_error);
     g_object_unref (self);
     return NULL;
   }
-  rygel_media_export_database_exec (self, "PRAGMA count_changes = OFF", NULL, 0, &_inner_error_);
+  rygel_media_export_database_exec (self, "PRAGMA count_changes = OFF", NULL, 0, &inner_error);
   if (inner_error) {
-    g_propagate_error (error, _inner_error_);
+    g_propagate_error (error, inner_error);
     g_object_unref (self);
     return NULL;
   }
@@ -162,14 +165,14 @@ rygel_media_export_database_new (const gchar  *name,
 			   2,
 			   SQLITE_UTF8,
 			   NULL,
-			   _rygel_media_export_database_utf8_contains_sqlite_user_func_callback,
+			   rygel_media_export_database_utf8_contains_sqlite_user_func_callback,
 			   NULL,
 			   NULL);
   sqlite3_create_collation (db,
 			    "CASEFOLD",
 			    SQLITE_UTF8,
 			    NULL,
-			    (int (*)(void *, int,  const void *, int,  const void *)) _rygel_media_export_database_utf8_collate_sqlite_compare_callback);
+			    (int (*)(void *, int,  const void *, int,  const void *)) rygel_media_export_database_utf8_collate_sqlite_compare_callback);
 
   return self;
 }
@@ -191,12 +194,6 @@ rygel_media_export_database_exec_cursor (RygelMediaExportDatabase  *self,
 					 GError                   **error) {
   RygelMediaExportDatabaseCursor* result = NULL;
   sqlite3* db;
-  sqlite3* _tmp1_;
-  const gchar* _tmp2_;
-  GValue* _tmp3_;
-  gint _tmp3__length1;
-  RygelMediaExportDatabaseCursor* _tmp4_;
-  RygelMediaExportDatabaseCursor* _tmp5_;
   GError * inner_error = NULL;
 
   g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_DATABASE (self), NULL);
@@ -246,7 +243,7 @@ rygel_media_export_database_exec (RygelMediaExportDatabase  *self,
 							      sqlite3_exec (db, sql, NULL, NULL, NULL),
 							      &inner_error);
     if (inner_error) {
-      g_propagate_error (error, _inner_error_);
+      g_propagate_error (error, inner_error);
     }
     return;
   }
@@ -263,7 +260,7 @@ rygel_media_export_database_exec (RygelMediaExportDatabase  *self,
   while (rygel_media_export_database_cursor_has_next (cursor)) {
     rygel_media_export_database_cursor_next (cursor, &inner_error);
     if (inner_error != NULL) {
-      g_propagate_error (error, _inner_error_);
+      g_propagate_error (error, inner_error);
       break;
     }
   }
@@ -296,12 +293,12 @@ rygel_media_export_database_query_value (RygelMediaExportDatabase  *self,
   inner_error = NULL;
   cursor = rygel_media_export_database_exec_cursor (self, sql, args, args_length, &inner_error);
   if (inner_error != NULL) {
-    g_propagate_error (error, _inner_error_);
+    g_propagate_error (error, inner_error);
     return 0;
   }
   statement = rygel_media_export_database_cursor_next (cursor, &inner_error);
   if (inner_error != NULL) {
-    g_propagate_error (error, _inner_error_);
+    g_propagate_error (error, inner_error);
     g_object_unref (cursor);
     return 0;
   }
diff --git a/src/media-export/rygel-media-export-database.h b/src/media-export/rygel-media-export-database.h
index 59dd642..a76a2a6 100644
--- a/src/media-export/rygel-media-export-database.h
+++ b/src/media-export/rygel-media-export-database.h
@@ -22,6 +22,10 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DATABASE_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DATABASE_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
+#include "rygel-media-export-database-cursor.h"
 #include "rygel-media-export-sqlite-wrapper.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-db-container.c b/src/media-export/rygel-media-export-db-container.c
index a2a6420..37e21f4 100644
--- a/src/media-export/rygel-media-export-db-container.c
+++ b/src/media-export/rygel-media-export-db-container.c
@@ -22,7 +22,7 @@
  */
 
 #include "rygel-media-export-db-container.h"
-#include "rygel-media-export-database.h"
+#include "rygel-media-export-errors.h"
 
 static void
 rygel_media_export_db_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface *iface);
@@ -61,7 +61,7 @@ static void
 rygel_media_export_db_container_count_children (RygelMediaExportDBContainer* self) {
   GError *inner_error = NULL;
   gint count;
-  gint id;
+  const gchar *id;
 
   g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_DB_CONTAINER (self));
 
@@ -75,15 +75,15 @@ rygel_media_export_db_container_count_children (RygelMediaExportDBContainer* sel
     count = 0;
     g_error_free (inner_error);
   }
-  rygel_media_object_set_child_count (RYGEL_MEDIA_CONTAINER (self), count);
+  rygel_media_container_set_child_count (RYGEL_MEDIA_CONTAINER (self), count);
 }
 
 static void
-on_media_container_updated (RygelMediaContainer  *sender,
-                            RygelMediaContainer  *container,
-                            RygelMediaObject     *object,
-                            RygelObjectEventType  event_type,
-                            gboolean              sub_tree_update,
+on_media_container_updated (RygelMediaContainer  *sender G_GNUC_UNUSED,
+                            RygelMediaContainer  *container G_GNUC_UNUSED,
+                            RygelMediaObject     *object G_GNUC_UNUSED,
+                            RygelObjectEventType  event_type G_GNUC_UNUSED,
+                            gboolean              sub_tree_update G_GNUC_UNUSED,
                             gpointer              user_data) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (user_data);
 
@@ -100,7 +100,7 @@ rygel_media_export_db_container_constructed (GObject *object)
                                               g_free,
                                               NULL,
                                               NULL,
-                                              NULL)
+                                              NULL);
 
   rygel_searchable_container_set_search_classes (RYGEL_SEARCHABLE_CONTAINER (self),
                                                  classes);
@@ -130,7 +130,7 @@ rygel_media_export_db_container_real_get_children (RygelMediaContainer *base,
                                                    guint                offset,
                                                    guint                max_count,
                                                    const gchar         *sort_criteria,
-                                                   GCancellable        *cancellable,
+                                                   GCancellable        *cancellable G_GNUC_UNUSED,
                                                    GAsyncReadyCallback  callback,
                                                    gpointer             user_data) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
@@ -163,7 +163,7 @@ rygel_media_export_db_container_real_get_children (RygelMediaContainer *base,
 }
 
 static RygelMediaObjects *
-rygel_media_export_db_container_real_get_children_finish (RygelMediaContainer  *base,
+rygel_media_export_db_container_real_get_children_finish (RygelMediaContainer  *base G_GNUC_UNUSED,
                                                           GAsyncResult         *res,
                                                           GError              **error) {
   RygelMediaObjects *result;
@@ -226,7 +226,7 @@ rygel_media_export_db_container_real_search (RygelSearchableContainer *base,
                                              GAsyncReadyCallback       callback,
                                              gpointer                  user_data) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
-  gint id = rygel_media_object_get_id (RYGEL_MEDIA_OBJECT (self));
+  const gchar *id = rygel_media_object_get_id (RYGEL_MEDIA_OBJECT (self));
   GError *inner_error = NULL;
   guint total_matches = 0;
   GSimpleAsyncResult *simple;
@@ -310,10 +310,11 @@ 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,
+                                                  GCancellable        *cancellable G_GNUC_UNUSED,
                                                   GAsyncReadyCallback  callback,
                                                   gpointer             user_data) {
   GError *inner_error = NULL;
+  RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
   RygelMediaObject *object = rygel_media_export_media_cache_get_object (self->priv->media_db,
                                                                         id,
                                                                         &inner_error);
@@ -339,7 +340,7 @@ rygel_media_export_db_container_real_find_object (RygelMediaContainer *base,
 
 
 static RygelMediaObject *
-rygel_media_export_db_container_real_find_object_finish (RygelMediaContainer  *base,
+rygel_media_export_db_container_real_find_object_finish (RygelMediaContainer  *base G_GNUC_UNUSED,
                                                          GAsyncResult         *res,
                                                          GError              **error) {
   RygelMediaObject *result;
@@ -432,7 +433,6 @@ rygel_media_export_db_container_set_property (GObject      *object,
                                               const GValue *value,
                                               GParamSpec   *pspec) {
   RygelMediaExportDBContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
-  RygelMediaExportDBContainerPrivate *priv = self->priv;
 
   switch (property_id) {
   case RYGEL_MEDIA_EXPORT_DB_CONTAINER_SEARCH_CLASSES:
@@ -458,6 +458,7 @@ rygel_media_export_db_container_class_init (RygelMediaExportDBContainerClass *db
   object_class->get_property = rygel_media_export_db_container_get_property;
   object_class->set_property = rygel_media_export_db_container_set_property;
   object_class->dispose = rygel_media_export_db_container_dispose;
+  object_class->constructed = rygel_media_export_db_container_constructed;
 
   g_object_class_install_property (object_class,
                                    RYGEL_MEDIA_EXPORT_DB_CONTAINER_SEARCH_CLASSES,
@@ -481,7 +482,7 @@ rygel_media_export_db_container_class_init (RygelMediaExportDBContainerClass *db
                                                         G_PARAM_STATIC_BLURB |
                                                         G_PARAM_READABLE));
 
-  g_type_class_add_private (klass,
+  g_type_class_add_private (db_container_class,
                             sizeof (RygelMediaExportDBContainerPrivate));
 }
 
diff --git a/src/media-export/rygel-media-export-db-container.h b/src/media-export/rygel-media-export-db-container.h
index cb86a3e..b7f06ca 100644
--- a/src/media-export/rygel-media-export-db-container.h
+++ b/src/media-export/rygel-media-export-db-container.h
@@ -21,7 +21,10 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DB_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DB_CONTAINER_H__
 
-#include "rygel-media-export-sqlite-wrapper.h"
+#include <glib.h>
+#include <glib-object.h>
+#include <rygel-server.h>
+
 #include "rygel-media-export-media-cache.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-dummy-container.c b/src/media-export/rygel-media-export-dummy-container.c
index 10de2c5..96dbfc0 100644
--- a/src/media-export/rygel-media-export-dummy-container.c
+++ b/src/media-export/rygel-media-export-dummy-container.c
@@ -47,7 +47,6 @@ rygel_media_export_dummy_container_new (GFile               *file,
   RygelMediaExportDummyContainer *self;
   gchar *id;
   gchar *basename;
-  gchar *uri;
   RygelMediaExportMediaCache *media_db;
   GError *inner_error;
   GeeList *children_list;
@@ -58,14 +57,12 @@ rygel_media_export_dummy_container_new (GFile               *file,
 
   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,
+                                                                            id,
                                                                             &inner_error);
     g_object_unref (media_db);
     if (!inner_error) {
@@ -75,12 +72,12 @@ rygel_media_export_dummy_container_new (GFile               *file,
   }
   if (inner_error)
   {
-    children_list = gee_array_list_new (G_TYPE_STRING,
-                                        (GBoxedCopyFunc) g_strdup,
-                                        g_free,
-                                        NULL,
-                                        NULL,
-                                        NULL);
+    children_list = GEE_LIST (gee_array_list_new (G_TYPE_STRING,
+                                                  (GBoxedCopyFunc) g_strdup,
+                                                  g_free,
+                                                  NULL,
+                                                  NULL,
+                                                  NULL));
     child_count = 0;
     g_error_free (inner_error);
   }
@@ -106,38 +103,39 @@ rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer *self,
   g_return_if_fail (G_IS_FILE (file));
 
   id = rygel_media_export_media_cache_get_id (file);
-  gee_collection_remove ((GeeCollection*) self->children, id);
+  gee_collection_remove ((GeeCollection*) self->priv->children_list, id);
   g_free (id);
 }
 
 static void rygel_media_export_dummy_container_dispose (GObject *object) {
   RygelMediaExportDummyContainer *self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
+  RygelMediaExportDummyContainerPrivate *priv = self->priv;
 
-  if (self->file) {
-    GFile *file = self->file;
+  if (priv->file) {
+    GFile *file = priv->file;
 
-    self->file = NULL;
+    priv->file = NULL;
     g_object_unref (file);
   }
-  if (self->children) {
-    GeeArrayList *list = self->children;
+  if (priv->children_list) {
+    GeeList *list = priv->children_list;
 
-    self->children = NULL;
+    priv->children_list = NULL;
     g_object_unref (list);
   }
-  G_OBJECT_CLASS (rygel_media_export_dummy_container_parent_class)->dispose (obj);
+  G_OBJECT_CLASS (rygel_media_export_dummy_container_parent_class)->dispose (object);
 }
 
 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);
+  RygelMediaObject *media_object = RYGEL_MEDIA_OBJECT (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);
+  uris = GEE_ABSTRACT_COLLECTION (media_object->uris);
   gee_abstract_collection_add (uris, uri);
   g_free (uri);
 }
@@ -171,7 +169,7 @@ rygel_media_export_dummy_container_set_property (GObject      *object,
                                                  const GValue *value,
                                                  GParamSpec   *pspec) {
   RygelMediaExportDummyContainer *self = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER (object);
-  RygelMediaExportDummyContainer *priv = self->priv;
+  RygelMediaExportDummyContainerPrivate *priv = self->priv;
 
   switch (property_id) {
   case RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_CHILDREN_LIST:
@@ -179,7 +177,7 @@ rygel_media_export_dummy_container_set_property (GObject      *object,
     priv->children_list = g_value_dup_object (value);
     break;
 
-  case RYGEL_MEDIA_EXPORT_DB_CONTAINER_MEDIA_DB:
+  case RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_FILE:
     /* construct only property */
     priv->file = g_value_dup_object (value);
     break;
@@ -223,10 +221,26 @@ static void rygel_media_export_dummy_container_class_init (RygelMediaExportDummy
                                                         G_PARAM_WRITABLE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
-  g_type_class_add_private (klass,
+  g_type_class_add_private (dummy_class,
                             sizeof (RygelMediaExportDummyContainerPrivate));
 }
 
 static void rygel_media_export_dummy_container_init (RygelMediaExportDummyContainer * self) {
   self->priv = RYGEL_MEDIA_EXPORT_DUMMY_CONTAINER_GET_PRIVATE (self);
 }
+
+GFile *
+rygel_media_export_dummy_container_get_g_file (RygelMediaExportDummyContainer *self)
+{
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_DUMMY_CONTAINER (self), NULL);
+
+  return self->priv->file;
+}
+
+GeeList *
+rygel_media_export_dummy_container_get_children_list (RygelMediaExportDummyContainer *self)
+{
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_DUMMY_CONTAINER (self), NULL);
+
+  return self->priv->children_list;
+}
diff --git a/src/media-export/rygel-media-export-dummy-container.h b/src/media-export/rygel-media-export-dummy-container.h
index 3d9fe89..24c189d 100644
--- a/src/media-export/rygel-media-export-dummy-container.h
+++ b/src/media-export/rygel-media-export-dummy-container.h
@@ -21,6 +21,11 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DUMMY_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DUMMY_CONTAINER_H__
 
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <gee.h>
+
 #include "rygel-media-export-null-container.h"
 
 G_BEGIN_DECLS
@@ -45,9 +50,12 @@ struct _RygelMediaExportDummyContainerClass {
   RygelMediaExportNullContainerClass parent_class;
 };
 
-GType rygel_media_export_dummy_container_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_dummy_container_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_new ();
+RygelMediaExportDummyContainer *
+rygel_media_export_dummy_container_new (GFile               *file,
+                                        RygelMediaContainer *parent);
 
 GFile *
 rygel_media_export_dummy_container_get_g_file (RygelMediaExportDummyContainer *self);
@@ -56,7 +64,8 @@ GeeList *
 rygel_media_export_dummy_container_get_children_list (RygelMediaExportDummyContainer *self);
 
 void
-rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer* self, GFile* file);
+rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer *self,
+                                         GFile                          *file);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-errors.h b/src/media-export/rygel-media-export-errors.h
index 93dfb43..2cb08a9 100644
--- a/src/media-export/rygel-media-export-errors.h
+++ b/src/media-export/rygel-media-export-errors.h
@@ -27,8 +27,8 @@
 G_BEGIN_DECLS
 
 typedef enum  {
-	RYGEL_MEDIA_EXPORT_DATABASE_ERROR_IO_ERROR,
-	RYGEL_MEDIA_EXPORT_DATABASE_ERROR_SQLITE_ERROR
+  RYGEL_MEDIA_EXPORT_DATABASE_ERROR_IO_ERROR,
+  RYGEL_MEDIA_EXPORT_DATABASE_ERROR_SQLITE_ERROR
 } RygelMediaExportDatabaseError;
 
 #define RYGEL_MEDIA_EXPORT_DATABASE_ERROR (rygel_media_export_database_error_quark ())
@@ -36,10 +36,10 @@ GQuark
 rygel_media_export_database_error_quark (void);
 
 typedef enum  {
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_SQLITE_ERROR,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_GENERAL_ERROR,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_INVALID_TYPE,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH
+  RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_SQLITE_ERROR,
+  RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_GENERAL_ERROR,
+  RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_INVALID_TYPE,
+  RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH
 } RygelMediaExportMediaCacheError;
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR rygel_media_export_media_cache_error_quark ()
 GQuark
diff --git a/src/media-export/rygel-media-export-harvester.c b/src/media-export/rygel-media-export-harvester.c
index 60c8b1e..cc4af55 100644
--- a/src/media-export/rygel-media-export-harvester.c
+++ b/src/media-export/rygel-media-export-harvester.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-harvester.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-harvester.vala, do not modify */
-
 /*
  * Copyright (C) 2010 Jens Georg <mail jensge org>.
  * Copyright (C) 2012 Intel Corporation.
@@ -22,10 +19,17 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <glib/gi18n-lib.h>
+#include <rygel-core.h>
+
+#include "rygel-media-export-errors.h"
 #include "rygel-media-export-harvester.h"
 #include "rygel-media-export-harvesting-task.h"
-#include "rygel-media-export-database.h"
+#include "rygel-media-export-metadata-extractor.h"
 #include "rygel-media-export-media-cache.h"
+#include "rygel-media-export-recursive-file-monitor.h"
+#include "rygel-media-export-root-container.h"
+
 
 /**
  * This class takes care of the book-keeping of running and finished
@@ -34,27 +38,6 @@
 
 G_DEFINE_TYPE (RygelMediaExportHarvester, rygel_media_export_harvester, G_TYPE_OBJECT)
 
-#define RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR (rygel_media_export_metadata_extractor_get_type ())
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractor))
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractorClass))
-#define RYGEL_MEDIA_EXPORT_IS_METADATA_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR))
-#define RYGEL_MEDIA_EXPORT_IS_METADATA_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR))
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractorClass))
-
-typedef struct _RygelMediaExportMetadataExtractor RygelMediaExportMetadataExtractor;
-typedef struct _RygelMediaExportMetadataExtractorClass RygelMediaExportMetadataExtractorClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR (rygel_media_export_recursive_file_monitor_get_type ())
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitor))
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))
-#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
-#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))
-
-typedef struct _RygelMediaExportRecursiveFileMonitor RygelMediaExportRecursiveFileMonitor;
-typedef struct _RygelMediaExportRecursiveFileMonitorClass RygelMediaExportRecursiveFileMonitorClass;
-
-
 typedef struct _Block3Data Block3Data;
 
 
@@ -74,8 +57,6 @@ struct _Block3Data {
 	GFile* file;
 };
 
-GType rygel_media_export_metadata_extractor_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_recursive_file_monitor_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_HARVESTER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER, RygelMediaExportHarvesterPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_HARVESTER_DUMMY_PROPERTY,
@@ -83,33 +64,18 @@ enum  {
 };
 #define RYGEL_MEDIA_EXPORT_HARVESTER_FILE_CHANGE_DEFAULT_GRACE_PERIOD ((guint) 5)
 
-RygelMediaExportHarvester* rygel_media_export_harvester_construct (GType object_type, GCancellable* cancellable, GeeArrayList* locations);
 static void rygel_media_export_harvester_set_locations (RygelMediaExportHarvester* self, GeeArrayList* value);
-GeeArrayList* rygel_media_export_harvester_get_locations (RygelMediaExportHarvester* self);
 RygelMediaExportMetadataExtractor* rygel_media_export_metadata_extractor_new (void);
 RygelMediaExportMetadataExtractor* rygel_media_export_metadata_extractor_construct (GType object_type);
 RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_new (GCancellable* cancellable);
 RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_construct (GType object_type, GCancellable* cancellable);
 static void rygel_media_export_harvester_on_file_changed (RygelMediaExportHarvester* self, GFile* file, GFile* other, GFileMonitorEvent event);
 static void _rygel_media_export_harvester_on_file_changed_rygel_media_export_recursive_file_monitor_changed (RygelMediaExportRecursiveFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
-void rygel_media_export_harvester_schedule (RygelMediaExportHarvester* self, GFile* file, RygelMediaContainer* parent, const gchar* flag);
-void rygel_media_export_harvester_cancel (RygelMediaExportHarvester* self, GFile* file);
-RygelMediaExportHarvestingTask* rygel_media_export_harvesting_task_new (RygelMediaExportMetadataExtractor* extractor, RygelMediaExportRecursiveFileMonitor* monitor, GFile* file, RygelMediaContainer* parent, const gchar* flag);
-RygelMediaExportHarvestingTask* rygel_media_export_harvesting_task_construct (GType object_type, RygelMediaExportMetadataExtractor* extractor, RygelMediaExportRecursiveFileMonitor* monitor, GFile* file, RygelMediaContainer* parent, const gchar* flag);
 static void rygel_media_export_harvester_on_file_harvested (RygelMediaExportHarvester* self, RygelStateMachine* state_machine);
 static void _rygel_media_export_harvester_on_file_harvested_rygel_state_machine_completed (RygelStateMachine* _sender, gpointer self);
-void rygel_media_export_harvesting_task_cancel (RygelMediaExportHarvestingTask* self);
 static void rygel_media_export_harvester_on_changes_done (RygelMediaExportHarvester* self, GFile* file, GError** error);
 static void rygel_media_export_harvester_on_file_removed (RygelMediaExportHarvester* self, GFile* file, GError** error);
 static void rygel_media_export_harvester_on_file_added (RygelMediaExportHarvester* self, GFile* file);
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (GError** error);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-GQuark rygel_media_export_database_error_quark (void);
-RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMediaCache* self, const gchar* object_id, GError** error);
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
-GQuark rygel_media_export_media_cache_error_quark (void);
-void rygel_media_export_media_cache_remove_object (RygelMediaExportMediaCache* self, RygelMediaObject* object, GError** error);
 static Block3Data* block3_data_ref (Block3Data* _data3_);
 static void block3_data_unref (void * _userdata_);
 static gboolean __lambda3_ (Block3Data* _data3_);
@@ -119,11 +85,11 @@ static void _vala_rygel_media_export_harvester_get_property (GObject * object, g
 static void _vala_rygel_media_export_harvester_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
 
-static void _rygel_media_export_harvester_on_file_changed_rygel_media_export_recursive_file_monitor_changed (RygelMediaExportRecursiveFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
+static void _rygel_media_export_harvester_on_file_changed_rygel_media_export_recursive_file_monitor_changed (RygelMediaExportRecursiveFileMonitor* _sender G_GNUC_UNUSED, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
 	rygel_media_export_harvester_on_file_changed (self, file, other_file, event_type);
 }
 
-
+static
 RygelMediaExportHarvester* rygel_media_export_harvester_construct (GType object_type, GCancellable* cancellable, GeeArrayList* locations) {
 	RygelMediaExportHarvester * self = NULL;
 	GCancellable* _tmp0_;
@@ -160,7 +126,7 @@ RygelMediaExportHarvester* rygel_media_export_harvester_construct (GType object_
 		_tmp5_ = g_object_ref (_tmp4_);
 		_file_list = _tmp5_;
 		_tmp6_ = _file_list;
-		_tmp7_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp6_);
+		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
 		_tmp8_ = _tmp7_;
 		_file_size = _tmp8_;
 		_file_index = -1;
@@ -388,7 +354,7 @@ static void rygel_media_export_harvester_on_file_harvested (RygelMediaExportHarv
 }
 
 
-static void rygel_media_export_harvester_on_file_changed (RygelMediaExportHarvester* self, GFile* file, GFile* other, GFileMonitorEvent event) {
+static void rygel_media_export_harvester_on_file_changed (RygelMediaExportHarvester* self, GFile* file, GFile* other G_GNUC_UNUSED, GFileMonitorEvent event) {
 	GError * _inner_error_ = NULL;
 	g_return_if_fail (self != NULL);
 	g_return_if_fail (file != NULL);
@@ -789,7 +755,7 @@ static void rygel_media_export_harvester_on_file_removed (RygelMediaExportHarves
 				break;
 			}
 			_tmp16_ = object;
-			_tmp17_ = _tmp16_->parent;
+			_tmp17_ = rygel_media_object_get_parent (_tmp16_);
 			_tmp18_ = g_object_ref (_tmp17_);
 			g_object_unref (parent);
 			parent = _tmp18_;
@@ -806,10 +772,10 @@ static void rygel_media_export_harvester_on_file_removed (RygelMediaExportHarves
 				break;
 			}
 			_tmp21_ = parent;
-			_tmp22_ = _tmp21_->child_count;
-			_tmp21_->child_count = _tmp22_ - 1;
+			_tmp22_ = rygel_media_container_get_child_count (_tmp21_);
+			rygel_media_container_set_child_count (_tmp21_, _tmp22_ - 1);
 			_tmp23_ = parent;
-			_tmp24_ = _tmp23_->child_count;
+			_tmp24_ = rygel_media_container_get_child_count (_tmp23_);
 			if (_tmp24_ != 0) {
 				break;
 			}
@@ -891,7 +857,7 @@ static gboolean ___lambda3__gsource_func (gpointer self) {
 }
 
 
-static void rygel_media_export_harvester_on_changes_done (RygelMediaExportHarvester* self, GFile* file, GError** error) {
+static void rygel_media_export_harvester_on_changes_done (RygelMediaExportHarvester* self, GFile* file, GError** error G_GNUC_UNUSED) {
 	Block3Data* _data3_;
 	GFile* _tmp0_;
 	GFile* _tmp1_;
@@ -983,7 +949,6 @@ static void rygel_media_export_harvester_set_locations (RygelMediaExportHarveste
 
 
 static void rygel_media_export_harvester_class_init (RygelMediaExportHarvesterClass * klass) {
-	rygel_media_export_harvester_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (RygelMediaExportHarvesterPrivate));
 	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_harvester_get_property;
 	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_harvester_set_property;
@@ -1038,6 +1003,3 @@ static void _vala_rygel_media_export_harvester_set_property (GObject * object, g
 		break;
 	}
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-harvester.h b/src/media-export/rygel-media-export-harvester.h
index f5bad4b..1224dcc 100644
--- a/src/media-export/rygel-media-export-harvester.h
+++ b/src/media-export/rygel-media-export-harvester.h
@@ -24,11 +24,9 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
-#include <rygel-server.h>
+#include <gio/gio.h>
 #include <gee.h>
+#include <rygel-server.h>
 
 G_BEGIN_DECLS
 
@@ -52,9 +50,25 @@ struct _RygelMediaExportHarvesterClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_harvester_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_harvester_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportHarvester *
+rygel_media_export_harvester_new (GCancellable *cancellable,
+				  GeeArrayList *locations);
+
+GeeArrayList *
+rygel_media_export_harvester_get_locations (RygelMediaExportHarvester *self);
+
+void
+rygel_media_export_harvester_schedule (RygelMediaExportHarvester *self,
+				       GFile                     *file,
+				       RygelMediaContainer       *parent,
+				       const gchar               *flag);
 
-RygelMediaExportHarvester* rygel_media_export_harvester_new (GCancellable* cancellable, GeeArrayList* locations);
+void
+rygel_media_export_harvester_cancel (RygelMediaExportHarvester *self,
+				     GFile                     *file);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-harvesting-task.c b/src/media-export/rygel-media-export-harvesting-task.c
index 67baacd..8e13d10 100644
--- a/src/media-export/rygel-media-export-harvesting-task.c
+++ b/src/media-export/rygel-media-export-harvesting-task.c
@@ -22,40 +22,27 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "rygel-media-export-harvesting-task.h"
-#include "rygel-media-export-database.h"
-#include "rygel-media-export-dummy-container.h"
-#include "rygel-media-export-media-cache.h"
-#include <libgupnp-dlna/gupnp-dlna-information.h>
 #include <glib/gi18n-lib.h>
+#include <libgupnp-dlna/gupnp-dlna-information.h>
 
-G_DEFINE_TYPE (RygelMediaExportHarvestingTask, rygel_media_export_harvesting_task, G_TYPE_OBJECT)
-
-
-#define RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR (rygel_media_export_metadata_extractor_get_type ())
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractor))
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractorClass))
-#define RYGEL_MEDIA_EXPORT_IS_METADATA_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR))
-#define RYGEL_MEDIA_EXPORT_IS_METADATA_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR))
-#define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractorClass))
-
-typedef struct _RygelMediaExportMetadataExtractor RygelMediaExportMetadataExtractor;
-typedef struct _RygelMediaExportMetadataExtractorClass RygelMediaExportMetadataExtractorClass;
+#include "rygel-media-export-dummy-container.h"
+#include "rygel-media-export-errors.h"
+#include "rygel-media-export-harvesting-task.h"
+#include "rygel-media-export-item-factory.h"
+#include "rygel-media-export-media-cache.h"
 
+static void
+rygel_media_export_harvesting_task_rygel_state_machine_interface_init (RygelStateMachineIface *iface);
 
-#define RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR (rygel_media_export_recursive_file_monitor_get_type ())
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitor))
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))
-#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
-#define RYGEL_MEDIA_EXPORT_IS_RECURSIVE_FILE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR))
-#define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorClass))
+G_DEFINE_TYPE_WITH_CODE (RygelMediaExportHarvestingTask,
+			 rygel_media_export_harvesting_task,
+			 G_TYPE_OBJECT,
+			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_STATE_MACHINE,
+						rygel_media_export_harvesting_task_rygel_state_machine_interface_init))
 
-typedef struct _RygelMediaExportRecursiveFileMonitor RygelMediaExportRecursiveFileMonitor;
-typedef struct _RygelMediaExportRecursiveFileMonitorClass RygelMediaExportRecursiveFileMonitorClass;
 #define __g_queue_free_g_object_unref_0(var) ((var == NULL) ? NULL : (var = (_g_queue_free_g_object_unref_ (var), NULL)))
 typedef struct _RygelMediaExportHarvestingTaskRunData RygelMediaExportHarvestingTaskRunData;
 
-
 #define __g_list_free_g_object_unref_0(var) ((var == NULL) ? NULL : (var = (_g_list_free_g_object_unref_ (var), NULL)))
 typedef struct _RygelMediaExportHarvestingTaskEnumerateDirectoryData RygelMediaExportHarvestingTaskEnumerateDirectoryData;
 
@@ -140,8 +127,6 @@ struct _RygelMediaExportHarvestingTaskEnumerateDirectoryData {
 };
 
 
-static RygelStateMachineIface* rygel_media_export_harvesting_task_rygel_state_machine_parent_iface = NULL;
-
 #define RYGEL_MEDIA_EXPORT_HARVESTING_TASK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_HARVESTING_TASK, RygelMediaExportHarvestingTaskPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_HARVESTING_TASK_DUMMY_PROPERTY,
@@ -151,14 +136,10 @@ static void g_object_unref_ (gpointer var);
 static void _g_queue_free_g_object_unref_ (GQueue* self);
 #define RYGEL_MEDIA_EXPORT_HARVESTING_TASK_BATCH_SIZE 256
 #define RYGEL_MEDIA_EXPORT_HARVESTING_TASK_HARVESTER_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_TIME_MODIFIED "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SIZE
-RygelMediaExportHarvestingTask* rygel_media_export_harvesting_task_new (RygelMediaExportMetadataExtractor* extractor, RygelMediaExportRecursiveFileMonitor* monitor, GFile* file, RygelMediaContainer* parent, const gchar* flag);
-RygelMediaExportHarvestingTask* rygel_media_export_harvesting_task_construct (GType object_type, RygelMediaExportMetadataExtractor* extractor, RygelMediaExportRecursiveFileMonitor* monitor, GFile* file, RygelMediaContainer* parent, const gchar* flag);
-RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (GError** error);
 static void rygel_media_export_harvesting_task_on_extracted_cb (RygelMediaExportHarvestingTask* self, GFile* file, GUPnPDLNAInformation* dlna, GFileInfo* file_info);
 static void _rygel_media_export_harvesting_task_on_extracted_cb_rygel_media_export_metadata_extractor_extraction_done (RygelMediaExportMetadataExtractor* _sender, GFile* file, GUPnPDLNAInformation* dlna, GFileInfo* file_info, gpointer self);
 static void rygel_media_export_harvesting_task_on_extractor_error_cb (RygelMediaExportHarvestingTask* self, GFile* file, GError* _error_);
 static void _rygel_media_export_harvesting_task_on_extractor_error_cb_rygel_media_export_metadata_extractor_error (RygelMediaExportMetadataExtractor* _sender, GFile* file, GError* err, gpointer self);
-void rygel_media_export_harvesting_task_cancel (RygelMediaExportHarvestingTask* self);
 static void rygel_media_export_harvesting_task_real_run_data_free (gpointer _data);
 static void rygel_media_export_harvesting_task_real_run (RygelStateMachine* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_harvesting_task_real_run_co (RygelMediaExportHarvestingTaskRunData* _data_);
@@ -166,31 +147,14 @@ static void rygel_media_export_harvesting_task_run_ready (GObject* source_object
 static gboolean rygel_media_export_harvesting_task_process_file (RygelMediaExportHarvestingTask* self, GFile* file, GFileInfo* info, RygelMediaContainer* parent);
 static gboolean rygel_media_export_harvesting_task_on_idle (RygelMediaExportHarvestingTask* self);
 static gboolean rygel_media_export_harvesting_task_push_if_changed_or_unknown (RygelMediaExportHarvestingTask* self, GFile* file, GFileInfo* info);
-GQuark rygel_media_export_database_error_quark (void);
-gboolean rygel_media_export_media_cache_exists (RygelMediaExportMediaCache* self, GFile* file, gint64* timestamp, gint64* size, GError** error);
-void rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self, GAsyncResult* _res_);
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_new (GFile* file, RygelMediaContainer* parent);
-RygelMediaExportDummyContainer* rygel_media_export_dummy_container_construct (GType object_type, GFile* file, RygelMediaContainer* parent);
-
-void rygel_media_export_media_cache_save_container (RygelMediaExportMediaCache* self, RygelMediaContainer* container, GError** error);
 static gboolean rygel_media_export_harvesting_task_process_children (RygelMediaExportHarvestingTask* self, GList* list);
-void rygel_media_export_dummy_container_seen (RygelMediaExportDummyContainer* self, GFile* file);
 static void rygel_media_export_harvesting_task_enumerate_directory_data_free (gpointer _data);
 static void rygel_media_export_harvesting_task_enumerate_directory (RygelMediaExportHarvestingTask* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
-static void rygel_media_export_harvesting_task_enumerate_directory_finish (RygelMediaExportHarvestingTask* self, GAsyncResult* _res_);
 static gboolean rygel_media_export_harvesting_task_enumerate_directory_co (RygelMediaExportHarvestingTaskEnumerateDirectoryData* _data_);
 static void rygel_media_export_harvesting_task_enumerate_directory_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 static void _g_list_free_g_object_unref_ (GList* self);
 static void rygel_media_export_harvesting_task_cleanup_database (RygelMediaExportHarvestingTask* self);
 static void rygel_media_export_harvesting_task_do_update (RygelMediaExportHarvestingTask* self);
-void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* self, const gchar* id, GError** error);
-void rygel_media_export_metadata_extractor_extract (RygelMediaExportMetadataExtractor* self, GFile* file);
-void rygel_media_export_media_cache_flag_object (RygelMediaExportMediaCache* self, GFile* file, const gchar* flag, GError** error);
-RygelMediaItem* rygel_media_export_item_factory_create_simple (RygelMediaContainer* parent, GFile* file, GFileInfo* info);
-RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaContainer* parent, GFile* file, GUPnPDLNAInformation* dlna_info, GFileInfo* file_info);
-void rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
-gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
 static void rygel_media_export_harvesting_task_finalize (GObject* obj);
 static void _vala_rygel_media_export_harvesting_task_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 static void _vala_rygel_media_export_harvesting_task_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
@@ -207,12 +171,12 @@ static void _g_queue_free_g_object_unref_ (GQueue* self) {
 }
 
 
-static void _rygel_media_export_harvesting_task_on_extracted_cb_rygel_media_export_metadata_extractor_extraction_done (RygelMediaExportMetadataExtractor* _sender, GFile* file, GUPnPDLNAInformation* dlna, GFileInfo* file_info, gpointer self) {
+static void _rygel_media_export_harvesting_task_on_extracted_cb_rygel_media_export_metadata_extractor_extraction_done (RygelMediaExportMetadataExtractor* _sender G_GNUC_UNUSED, GFile* file, GUPnPDLNAInformation* dlna, GFileInfo* file_info, gpointer self) {
 	rygel_media_export_harvesting_task_on_extracted_cb (self, file, dlna, file_info);
 }
 
 
-static void _rygel_media_export_harvesting_task_on_extractor_error_cb_rygel_media_export_metadata_extractor_error (RygelMediaExportMetadataExtractor* _sender, GFile* file, GError* err, gpointer self) {
+static void _rygel_media_export_harvesting_task_on_extractor_error_cb_rygel_media_export_metadata_extractor_error (RygelMediaExportMetadataExtractor* _sender G_GNUC_UNUSED, GFile* file, GError* err, gpointer self) {
 	rygel_media_export_harvesting_task_on_extractor_error_cb (self, file, err);
 }
 
@@ -342,9 +306,7 @@ static void rygel_media_export_harvesting_task_real_run (RygelStateMachine* base
 }
 
 
-static void rygel_media_export_harvesting_task_real_run_finish (RygelStateMachine* base, GAsyncResult* _res_) {
-	RygelMediaExportHarvestingTaskRunData* _data_;
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_harvesting_task_real_run_finish (RygelStateMachine* base G_GNUC_UNUSED, GAsyncResult* _res_ G_GNUC_UNUSED) {
 }
 
 
@@ -776,7 +738,7 @@ static gboolean rygel_media_export_harvesting_task_process_children (RygelMediaE
 				GFileInfo* _tmp19_;
 				RygelMediaExportDummyContainer* _tmp20_;
 				_tmp11_ = container;
-				_tmp12_ = _tmp11_->file;
+				_tmp12_ = rygel_media_export_dummy_container_get_g_file (_tmp11_);
 				_tmp13_ = info;
 				_tmp14_ = g_file_info_get_name (_tmp13_);
 				_tmp15_ = g_file_get_child (_tmp12_, _tmp14_);
@@ -819,12 +781,6 @@ static void rygel_media_export_harvesting_task_enumerate_directory (RygelMediaEx
 }
 
 
-static void rygel_media_export_harvesting_task_enumerate_directory_finish (RygelMediaExportHarvestingTask* self, GAsyncResult* _res_) {
-	RygelMediaExportHarvestingTaskEnumerateDirectoryData* _data_;
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
-}
-
-
 static void rygel_media_export_harvesting_task_enumerate_directory_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 	RygelMediaExportHarvestingTaskEnumerateDirectoryData* _data_;
 	_data_ = _user_data_;
@@ -857,7 +813,7 @@ static gboolean rygel_media_export_harvesting_task_enumerate_directory_co (Rygel
 	_data_->_tmp0_ = _data_->self->priv->containers;
 	_data_->_tmp1_ = NULL;
 	_data_->_tmp1_ = g_queue_peek_head (_data_->_tmp0_);
-	_data_->_tmp2_ = (G_TYPE_CHECK_INSTANCE_TYPE ((RygelMediaContainer*) _data_->_tmp1_, RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER) ? ((RygelMediaExportDummyContainer*) ((RygelMediaContainer*) _data_->_tmp1_)) : NULL)->file;
+	_data_->_tmp2_ = rygel_media_export_dummy_container_get_g_file (G_TYPE_CHECK_INSTANCE_TYPE ((RygelMediaContainer*) _data_->_tmp1_, RYGEL_MEDIA_EXPORT_TYPE_DUMMY_CONTAINER) ? ((RygelMediaExportDummyContainer*) ((RygelMediaContainer*) _data_->_tmp1_)) : NULL);
 	_data_->_tmp3_ = g_object_ref (_data_->_tmp2_);
 	_data_->directory = _data_->_tmp3_;
 	{
@@ -978,7 +934,7 @@ static void rygel_media_export_harvesting_task_cleanup_database (RygelMediaExpor
 			gint _child_size;
 			gint _child_index;
 			_tmp3_ = container;
-			_tmp4_ = _tmp3_->children;
+			_tmp4_ = rygel_media_export_dummy_container_get_children_list (_tmp3_);
 			_tmp5_ = g_object_ref (_tmp4_);
 			_child_list = _tmp5_;
 			_tmp6_ = _child_list;
@@ -1483,8 +1439,7 @@ static void rygel_media_export_harvesting_task_class_init (RygelMediaExportHarve
 
 
 static void rygel_media_export_harvesting_task_rygel_state_machine_interface_init (RygelStateMachineIface * iface) {
-	rygel_media_export_harvesting_task_rygel_state_machine_parent_iface = g_type_interface_peek_parent (iface);
-	iface->run = (void (*)(RygelStateMachine*)) rygel_media_export_harvesting_task_real_run;
+	iface->run = rygel_media_export_harvesting_task_real_run;
 	iface->run_finish = rygel_media_export_harvesting_task_real_run_finish;
 	iface->get_cancellable = rygel_media_export_harvesting_task_real_get_cancellable;
 	iface->set_cancellable = rygel_media_export_harvesting_task_real_set_cancellable;
@@ -1538,6 +1493,3 @@ static void _vala_rygel_media_export_harvesting_task_set_property (GObject * obj
 		break;
 	}
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-harvesting-task.h b/src/media-export/rygel-media-export-harvesting-task.h
index f23b455..eda3292 100644
--- a/src/media-export/rygel-media-export-harvesting-task.h
+++ b/src/media-export/rygel-media-export-harvesting-task.h
@@ -22,6 +22,11 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_HARVESTING_TASK_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_HARVESTING_TASK_H__
 
+#include <glib.h>
+#include <glib-object.h>
+#include <rygel-server.h>
+#include <gio/gio.h>
+
 #include "rygel-media-export-metadata-extractor.h"
 #include "rygel-media-export-recursive-file-monitor.h"
 
@@ -41,16 +46,25 @@ typedef struct _RygelMediaExportHarvestingTaskPrivate RygelMediaExportHarvesting
 struct _RygelMediaExportHarvestingTask {
   GObject parent_instance;
   RygelMediaExportHarvestingTaskPrivate *priv;
-  GFile* origin;
+  GFile* origin;  /* TODO: Move to priv. */
 };
 
 struct _RygelMediaExportHarvestingTaskClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_harvesting_task_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_harvesting_task_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportHarvestingTask *
+rygel_media_export_harvesting_task_new (RygelMediaExportMetadataExtractor    *extractor,
+					RygelMediaExportRecursiveFileMonitor *monitor,
+					GFile                                *file,
+					RygelMediaContainer                  *parent,
+					const gchar                          *flag);
 
-RygelMediaExportHarvestingTask* rygel_media_export_harvesting_task_new (RygelMediaExportMetadataExtractor* extractor, RygelMediaExportRecursiveFileMonitor* monitor, GFile* file, RygelMediaContainer* parent, const gchar* flag);
+void
+rygel_media_export_harvesting_task_cancel (RygelMediaExportHarvestingTask *self);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-item-factory.c b/src/media-export/rygel-media-export-item-factory.c
index 3bac2bb..224fbb0 100644
--- a/src/media-export/rygel-media-export-item-factory.c
+++ b/src/media-export/rygel-media-export-item-factory.c
@@ -24,52 +24,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <gst/tag/tag.h>
+
 #include "rygel-media-export-item-factory.h"
 #include "rygel-media-export-jpeg-writer.h"
-#include <libgupnp-dlna/gupnp-dlna-information.h>
-#include <libgupnp-av/gupnp-av.h>
-#include <libgupnp-dlna/gupnp-dlna-information.h>
-#include <gst/pbutils/codec-utils.h>
-#include <gst/pbutils/descriptions.h>
-#include <gst/pbutils/encoding-profile.h>
-#include <gst/pbutils/encoding-target.h>
-#include <gst/pbutils/gstdiscoverer.h>
-#include <gst/pbutils/gstpluginsbaseversion.h>
-#include <gst/pbutils/install-plugins.h>
-#include <gst/pbutils/missing-plugins.h>
-#include <gst/pbutils/pbutils-enumtypes.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/gst.h>
-#include <gst/tag/gsttagdemux.h>
-#include <gst/tag/gsttagmux.h>
-#include <gst/tag/tag.h>
-#include <gst/tag/xmpwriter.h>
 
 #define _gst_structure_free0(var) ((var == NULL) ? NULL : (var = (gst_structure_free (var), NULL)))
-typedef struct _RygelMediaExportMusicItemPrivate RygelMediaExportMusicItemPrivate;
-
-RygelMediaItem* rygel_media_export_item_factory_create_simple (RygelMediaContainer* parent, GFile* file, GFileInfo* info);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-RygelMediaExportVideoItem* rygel_media_export_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportVideoItem* rygel_media_export_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
-RygelMediaExportPhotoItem* rygel_media_export_photo_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportPhotoItem* rygel_media_export_photo_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_photo_item_get_type (void) G_GNUC_CONST;
-RygelMediaExportMusicItem* rygel_media_export_music_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportMusicItem* rygel_media_export_music_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_music_item_get_type (void) G_GNUC_CONST;
-RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaContainer* parent, GFile* file, GUPnPDLNAInformation* dlna_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_photo_item (RygelMediaExportPhotoItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererVideoInfo* video_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_video_item (RygelMediaExportVideoItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererVideoInfo* video_info, GstDiscovererAudioInfo* audio_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_music_item (RygelMediaExportMusicItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererAudioInfo* audio_info, GFileInfo* file_info);
-void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPnPDLNAInformation* dlna_info, GstDiscovererAudioInfo* audio_info);
-void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GFileInfo* file_info);
-RygelMediaExportJPEGWriter* rygel_media_export_jpeg_writer_new (GError** error);
-RygelMediaExportJPEGWriter* rygel_media_export_jpeg_writer_construct (GType object_type, GError** error);
-GType rygel_media_export_jpeg_writer_get_type (void) G_GNUC_CONST;
-void rygel_media_export_jpeg_writer_write (RygelMediaExportJPEGWriter* self, GstBuffer* buffer, GFile* file);
-
 
 RygelMediaItem* rygel_media_export_item_factory_create_simple (RygelMediaContainer* parent, GFile* file, GFileInfo* info) {
 	RygelMediaItem* result = NULL;
@@ -187,7 +147,7 @@ RygelMediaItem* rygel_media_export_item_factory_create_simple (RygelMediaContain
 	return result;
 }
 
-static void _g_list_free__gst_mini_object_unref0_ (GList* self) {
+static void __g_list_free__gst_mini_object_unref0_0 (GList* self) {
 	g_list_foreach (self, (GFunc) gst_mini_object_unref, NULL);
 	g_list_free (self);
 }
@@ -207,12 +167,12 @@ RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaCont
 	GList* audio_streams = NULL;
 	GList* video_streams = NULL;
 	GUPnPDLNAInformation* _tmp2_;
-	GstDiscovererInfo* _tmp3_;
-	GstDiscovererInfo* _tmp4_;
+	const GstDiscovererInfo* _tmp3_;
+	const GstDiscovererInfo* _tmp4_;
 	GList* _tmp5_ = NULL;
 	GUPnPDLNAInformation* _tmp6_;
-	GstDiscovererInfo* _tmp7_;
-	GstDiscovererInfo* _tmp8_;
+	const GstDiscovererInfo* _tmp7_;
+	const GstDiscovererInfo* _tmp8_;
 	GList* _tmp9_ = NULL;
 	gboolean _tmp10_ = FALSE;
 	GList* _tmp11_;
@@ -230,13 +190,13 @@ RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaCont
 	_tmp2_ = dlna_info;
 	_tmp3_ = gupnp_dlna_information_get_info (_tmp2_);
 	_tmp4_ = _tmp3_;
-	_tmp5_ = gst_discoverer_info_get_audio_streams (_tmp4_);
+	_tmp5_ = gst_discoverer_info_get_audio_streams ((GstDiscovererInfo *)_tmp4_);
 	__g_list_free__gst_mini_object_unref0_0 (audio_streams);
 	audio_streams = _tmp5_;
 	_tmp6_ = dlna_info;
 	_tmp7_ = gupnp_dlna_information_get_info (_tmp6_);
 	_tmp8_ = _tmp7_;
-	_tmp9_ = gst_discoverer_info_get_video_streams (_tmp8_);
+	_tmp9_ = gst_discoverer_info_get_video_streams ((GstDiscovererInfo *)_tmp8_);
 	__g_list_free__gst_mini_object_unref0_0 (video_streams);
 	video_streams = _tmp9_;
 	_tmp11_ = audio_streams;
@@ -339,7 +299,7 @@ RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaCont
 				_tmp39_ = audio_streams;
 				_tmp40_ = _tmp39_->data;
 				_tmp41_ = _gst_mini_object_ref0 ((GstDiscovererAudioInfo*) _tmp40_);
-				gst_mini_object_unref (audio_info);
+				gst_mini_object_unref (GST_MINI_OBJECT (audio_info));
 				audio_info = _tmp41_;
 			}
 			_tmp42_ = item;
@@ -351,7 +311,7 @@ RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaCont
 			_tmp48_ = file_info;
 			_tmp49_ = rygel_media_export_item_factory_fill_video_item (G_TYPE_CHECK_INSTANCE_TYPE (_tmp42_, RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM) ? ((RygelMediaExportVideoItem*) _tmp42_) : NULL, _tmp43_, _tmp44_, (GstDiscovererVideoInfo*) _tmp46_, _tmp47_, _tmp48_);
 			result = _tmp49_;
-			gst_mini_object_unref (audio_info);
+			gst_mini_object_unref (GST_MINI_OBJECT (audio_info));
 			__g_list_free__gst_mini_object_unref0_0 (video_streams);
 			__g_list_free__gst_mini_object_unref0_0 (audio_streams);
 			g_free (id);
@@ -408,8 +368,8 @@ RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaCont
 
 void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPnPDLNAInformation* dlna_info, GstDiscovererAudioInfo* audio_info) {
 	GUPnPDLNAInformation* _tmp0_;
-	GstDiscovererInfo* _tmp1_;
-	GstDiscovererInfo* _tmp2_;
+	const GstDiscovererInfo* _tmp1_;
+	const GstDiscovererInfo* _tmp2_;
 	GstClockTime _tmp3_ = 0ULL;
 	GstDiscovererAudioInfo* _tmp10_;
 	g_return_if_fail (item != NULL);
@@ -421,8 +381,8 @@ void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPn
 	if (_tmp3_ > ((GstClockTime) 0)) {
 		RygelAudioItem* _tmp4_;
 		GUPnPDLNAInformation* _tmp5_;
-		GstDiscovererInfo* _tmp6_;
-		GstDiscovererInfo* _tmp7_;
+		const GstDiscovererInfo* _tmp6_;
+		const GstDiscovererInfo* _tmp7_;
 		GstClockTime _tmp8_ = 0ULL;
 		_tmp4_ = item;
 		_tmp5_ = dlna_info;
@@ -438,7 +398,7 @@ void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPn
 	_tmp10_ = audio_info;
 	if (_tmp10_ != NULL) {
 		GstDiscovererAudioInfo* _tmp11_;
-		GstTagList* _tmp12_ = NULL;
+		const GstTagList* _tmp12_ = NULL;
 		RygelAudioItem* _tmp18_;
 		GstDiscovererAudioInfo* _tmp19_;
 		guint _tmp20_ = 0U;
@@ -450,7 +410,7 @@ void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPn
 		if (_tmp12_ != NULL) {
 			guint tmp = 0U;
 			GstDiscovererAudioInfo* _tmp13_;
-			GstTagList* _tmp14_ = NULL;
+			const GstTagList* _tmp14_ = NULL;
 			guint _tmp15_ = 0U;
 			RygelAudioItem* _tmp16_;
 			guint _tmp17_;
@@ -601,7 +561,7 @@ RygelMediaItem* rygel_media_export_item_factory_fill_photo_item (RygelMediaExpor
 }
 
 
-static gpointer _gst_structure_copy0 (gpointer self) {
+static gpointer _gst_structure_copy0 (gconstpointer self) {
 	return self ? gst_structure_copy (self) : NULL;
 }
 
@@ -635,43 +595,43 @@ RygelMediaItem* rygel_media_export_item_factory_fill_music_item (RygelMediaExpor
 	_tmp7_ = audio_info;
 	if (_tmp7_ != NULL) {
 		GstDiscovererAudioInfo* _tmp8_;
-		GstTagList* _tmp9_ = NULL;
+		const GstTagList* _tmp9_ = NULL;
 		gchar* artist = NULL;
 		GUPnPDLNAInformation* _tmp29_;
-		GstDiscovererInfo* _tmp30_;
-		GstDiscovererInfo* _tmp31_;
-		GstTagList* _tmp32_ = NULL;
+		const GstDiscovererInfo* _tmp30_;
+		const GstDiscovererInfo* _tmp31_;
+		const GstTagList* _tmp32_ = NULL;
 		gchar* _tmp33_ = NULL;
 		RygelMediaExportMusicItem* _tmp34_;
 		const gchar* _tmp35_;
 		gchar* album = NULL;
 		GUPnPDLNAInformation* _tmp36_;
-		GstDiscovererInfo* _tmp37_;
-		GstDiscovererInfo* _tmp38_;
-		GstTagList* _tmp39_ = NULL;
+		const GstDiscovererInfo* _tmp37_;
+		const GstDiscovererInfo* _tmp38_;
+		const GstTagList* _tmp39_ = NULL;
 		gchar* _tmp40_ = NULL;
 		RygelMediaExportMusicItem* _tmp41_;
 		const gchar* _tmp42_;
 		gchar* genre = NULL;
 		GUPnPDLNAInformation* _tmp43_;
-		GstDiscovererInfo* _tmp44_;
-		GstDiscovererInfo* _tmp45_;
-		GstTagList* _tmp46_ = NULL;
+		const GstDiscovererInfo* _tmp44_;
+		const GstDiscovererInfo* _tmp45_;
+		const GstTagList* _tmp46_ = NULL;
 		gchar* _tmp47_ = NULL;
 		RygelMediaExportMusicItem* _tmp48_;
 		const gchar* _tmp49_;
 		guint tmp = 0U;
 		GUPnPDLNAInformation* _tmp50_;
-		GstDiscovererInfo* _tmp51_;
-		GstDiscovererInfo* _tmp52_;
-		GstTagList* _tmp53_ = NULL;
+		const GstDiscovererInfo* _tmp51_;
+		const GstDiscovererInfo* _tmp52_;
+		const GstTagList* _tmp53_ = NULL;
 		guint _tmp54_ = 0U;
 		RygelMediaExportMusicItem* _tmp55_;
 		guint _tmp56_;
 		GUPnPDLNAInformation* _tmp57_;
-		GstDiscovererInfo* _tmp58_;
-		GstDiscovererInfo* _tmp59_;
-		GstTagList* _tmp60_ = NULL;
+		const GstDiscovererInfo* _tmp58_;
+		const GstDiscovererInfo* _tmp59_;
+		const GstTagList* _tmp60_ = NULL;
 		guint _tmp61_ = 0U;
 		RygelMediaExportMusicItem* _tmp62_;
 		guint _tmp63_;
@@ -680,7 +640,7 @@ RygelMediaItem* rygel_media_export_item_factory_fill_music_item (RygelMediaExpor
 		if (_tmp9_ != NULL) {
 			GstBuffer* buffer = NULL;
 			GstDiscovererAudioInfo* _tmp10_;
-			GstTagList* _tmp11_ = NULL;
+			const GstTagList* _tmp11_ = NULL;
 			GstBuffer* _tmp12_ = NULL;
 			GstBuffer* _tmp13_;
 			_tmp10_ = audio_info;
@@ -832,16 +792,16 @@ void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFil
 	gchar* title;
 	gboolean _tmp0_ = FALSE;
 	GUPnPDLNAInformation* _tmp1_;
-	GstDiscovererInfo* _tmp2_;
-	GstDiscovererInfo* _tmp3_;
-	GstTagList* _tmp4_ = NULL;
+	const GstDiscovererInfo* _tmp2_;
+	const GstDiscovererInfo* _tmp3_;
+	const GstTagList* _tmp4_ = NULL;
 	gboolean _tmp11_;
 	RygelMediaItem* _tmp15_;
 	const gchar* _tmp16_;
 	GUPnPDLNAInformation* _tmp17_;
-	GstDiscovererInfo* _tmp18_;
-	GstDiscovererInfo* _tmp19_;
-	GstTagList* _tmp20_ = NULL;
+	const GstDiscovererInfo* _tmp18_;
+	const GstDiscovererInfo* _tmp19_;
+	const GstTagList* _tmp20_ = NULL;
 	GFileInfo* _tmp32_;
 	guint64 _tmp33_ = 0ULL;
 	guint64 mtime;
@@ -873,9 +833,9 @@ void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFil
 		_tmp0_ = TRUE;
 	} else {
 		GUPnPDLNAInformation* _tmp5_;
-		GstDiscovererInfo* _tmp6_;
-		GstDiscovererInfo* _tmp7_;
-		GstTagList* _tmp8_ = NULL;
+		const GstDiscovererInfo* _tmp6_;
+		const GstDiscovererInfo* _tmp7_;
+		const GstTagList* _tmp8_ = NULL;
 		gchar* _tmp9_ = NULL;
 		gboolean _tmp10_ = FALSE;
 		_tmp5_ = dlna_info;
@@ -908,9 +868,9 @@ void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFil
 	if (_tmp20_ != NULL) {
 		GDate* date = NULL;
 		GUPnPDLNAInformation* _tmp21_;
-		GstDiscovererInfo* _tmp22_;
-		GstDiscovererInfo* _tmp23_;
-		GstTagList* _tmp24_ = NULL;
+		const GstDiscovererInfo* _tmp22_;
+		const GstDiscovererInfo* _tmp23_;
+		const GstTagList* _tmp24_ = NULL;
 		GDate* _tmp25_ = NULL;
 		gboolean _tmp26_ = FALSE;
 		_tmp21_ = dlna_info;
@@ -924,24 +884,20 @@ void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFil
 			gchar* _tmp27_ = NULL;
 			gchar* datestr;
 			gint datestr_length1;
-			gint _datestr_size_;
 			GDate* _tmp28_;
 			gchar* _tmp29_;
 			gint _tmp29__length1;
 			RygelMediaItem* _tmp30_;
 			gchar* _tmp31_;
-			gint _tmp31__length1;
 			_tmp27_ = g_new0 (gchar, 30);
 			datestr = _tmp27_;
 			datestr_length1 = 30;
-			_datestr_size_ = datestr_length1;
 			_tmp28_ = date;
 			_tmp29_ = datestr;
 			_tmp29__length1 = datestr_length1;
 			g_date_strftime (_tmp29_, _tmp29__length1, "%F", _tmp28_);
 			_tmp30_ = item;
 			_tmp31_ = datestr;
-			_tmp31__length1 = datestr_length1;
 			rygel_media_item_set_date (_tmp30_, (const gchar*) _tmp31_);
 			datestr = (g_free (datestr), NULL);
 		}
diff --git a/src/media-export/rygel-media-export-item-factory.h b/src/media-export/rygel-media-export-item-factory.h
index 5a1a983..951418c 100644
--- a/src/media-export/rygel-media-export-item-factory.h
+++ b/src/media-export/rygel-media-export-item-factory.h
@@ -22,24 +22,68 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_ITEM_FACTORY_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_ITEM_FACTORY_H__
 
+#include <glib.h>
+#include <gio/gio.h>
+#include <rygel-server.h>
+#include <libgupnp-dlna/gupnp-dlna-information.h>
+
 #include "rygel-media-export-music-item.h"
 #include "rygel-media-export-photo-item.h"
 #include "rygel-media-export-video-item.h"
-#include <rygel-server.h>
-#include <libgupnp-dlna/gupnp-dlna-information.h>
 
 G_BEGIN_DECLS
 
+RygelMediaItem *
+rygel_media_export_item_factory_create_simple (RygelMediaContainer *parent,
+					       GFile               *file,
+					       GFileInfo           *info);
+
+gchar *
+rygel_media_export_media_cache_get_id (GFile *file);
+
+RygelMediaItem *
+rygel_media_export_item_factory_create_playlist_item (GFile *file,
+						      RygelMediaContainer *parent,
+						      const gchar *fallback_title);
+
+RygelMediaItem *
+rygel_media_export_item_factory_create_from_info (RygelMediaContainer  *parent,
+						  GFile                *file,
+						  GUPnPDLNAInformation *dlna_info,
+						  GFileInfo            *file_info);
+
+RygelMediaItem *
+rygel_media_export_item_factory_fill_photo_item (RygelMediaExportPhotoItem *item,
+						 GFile                     *file,
+						 GUPnPDLNAInformation      *dlna_info,
+						 GstDiscovererVideoInfo    *video_info,
+						 GFileInfo                 *file_info);
+
+RygelMediaItem *
+rygel_media_export_item_factory_fill_video_item (RygelMediaExportVideoItem *item,
+						 GFile                     *file,
+						 GUPnPDLNAInformation      *dlna_info,
+						 GstDiscovererVideoInfo    *video_info,
+						 GstDiscovererAudioInfo    *audio_info,
+						 GFileInfo                 *file_info);
+
+RygelMediaItem *
+rygel_media_export_item_factory_fill_music_item (RygelMediaExportMusicItem *item,
+						 GFile                     *file,
+						 GUPnPDLNAInformation      *dlna_info,
+						 GstDiscovererAudioInfo    *audio_info,
+						 GFileInfo                 *file_info);
+
+void
+rygel_media_export_item_factory_fill_audio_item (RygelAudioItem         *item,
+						 GUPnPDLNAInformation   *dlna_info,
+						 GstDiscovererAudioInfo *audio_info);
 
-RygelMediaItem* rygel_media_export_item_factory_create_simple (RygelMediaContainer* parent, GFile* file, GFileInfo* info);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-RygelMediaItem* rygel_media_export_item_factory_create_playlist_item (GFile* file, RygelMediaContainer* parent, const gchar* fallback_title);
-RygelMediaItem* rygel_media_export_item_factory_create_from_info (RygelMediaContainer* parent, GFile* file, GUPnPDLNAInformation* dlna_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_photo_item (RygelMediaExportPhotoItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererVideoInfo* video_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_video_item (RygelMediaExportVideoItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererVideoInfo* video_info, GstDiscovererAudioInfo* audio_info, GFileInfo* file_info);
-RygelMediaItem* rygel_media_export_item_factory_fill_music_item (RygelMediaExportMusicItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GstDiscovererAudioInfo* audio_info, GFileInfo* file_info);
-void rygel_media_export_item_factory_fill_audio_item (RygelAudioItem* item, GUPnPDLNAInformation* dlna_info, GstDiscovererAudioInfo* audio_info);
-void rygel_media_export_item_factory_fill_media_item (RygelMediaItem* item, GFile* file, GUPnPDLNAInformation* dlna_info, GFileInfo* file_info);
+void
+rygel_media_export_item_factory_fill_media_item (RygelMediaItem       *item,
+						 GFile                *file,
+						 GUPnPDLNAInformation *dlna_info,
+						 GFileInfo            *file_info);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-jpeg-writer.c b/src/media-export/rygel-media-export-jpeg-writer.c
index fe33fd9..9430b70 100644
--- a/src/media-export/rygel-media-export-jpeg-writer.c
+++ b/src/media-export/rygel-media-export-jpeg-writer.c
@@ -23,9 +23,10 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "rygel-media-export-jpeg-writer.h"
 #include <gst/app/gstappsrc.h>
 
+#include "rygel-media-export-jpeg-writer.h"
+
 /**
  * Utility class to write media-art content to JPEG files
  *
@@ -46,13 +47,10 @@ struct _RygelMediaExportJPEGWriterPrivate {
 enum  {
 	RYGEL_MEDIA_EXPORT_JPEG_WRITER_DUMMY_PROPERTY
 };
-RygelMediaExportJPEGWriter* rygel_media_export_jpeg_writer_new (GError** error);
-RygelMediaExportJPEGWriter* rygel_media_export_jpeg_writer_construct (GType object_type, GError** error);
 static void __lambda4_ (RygelMediaExportJPEGWriter* self);
 static void ___lambda4__gst_bus_message (GstBus* _sender, GstMessage* message, gpointer self);
 static void __lambda5_ (RygelMediaExportJPEGWriter* self);
 static void ___lambda5__gst_bus_message (GstBus* _sender, GstMessage* message, gpointer self);
-void rygel_media_export_jpeg_writer_write (RygelMediaExportJPEGWriter* self, GstBuffer* buffer, GFile* file);
 static inline void _dynamic_set_file0 (GstElement* obj, GFile* value);
 static void rygel_media_export_jpeg_writer_finalize (GObject* obj);
 
@@ -64,7 +62,7 @@ static void __lambda4_ (RygelMediaExportJPEGWriter* self) {
 }
 
 
-static void ___lambda4__gst_bus_message (GstBus* _sender, GstMessage* message, gpointer self) {
+static void ___lambda4__gst_bus_message (GstBus* _sender G_GNUC_UNUSED, GstMessage* message G_GNUC_UNUSED, gpointer self) {
 	__lambda4_ (self);
 }
 
@@ -76,7 +74,7 @@ static void __lambda5_ (RygelMediaExportJPEGWriter* self) {
 }
 
 
-static void ___lambda5__gst_bus_message (GstBus* _sender, GstMessage* message, gpointer self) {
+static void ___lambda5__gst_bus_message (GstBus* _sender G_GNUC_UNUSED, GstMessage* message G_GNUC_UNUSED, gpointer self) {
 	__lambda5_ (self);
 }
 
diff --git a/src/media-export/rygel-media-export-jpeg-writer.h b/src/media-export/rygel-media-export-jpeg-writer.h
index 95feca3..9eca266 100644
--- a/src/media-export/rygel-media-export-jpeg-writer.h
+++ b/src/media-export/rygel-media-export-jpeg-writer.h
@@ -24,11 +24,8 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
-#include <rygel-server.h>
-#include <gee.h>
+#include <gio/gio.h>
+#include <gst/gst.h>
 
 G_BEGIN_DECLS
 
@@ -52,9 +49,16 @@ struct _RygelMediaExportJPEGWriterClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_jpeg_writer_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_jpeg_writer_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportJPEGWriter* rygel_media_export_jpeg_writer_new (GError** error);
+RygelMediaExportJPEGWriter *
+rygel_media_export_jpeg_writer_new (GError **error);
+
+void
+rygel_media_export_jpeg_writer_write (RygelMediaExportJPEGWriter *self,
+				      GstBuffer                  *buffer,
+				      GFile                      *file);
 
 G_END_DECLS
 
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 80d12d4..14bcd37 100644
--- a/src/media-export/rygel-media-export-leaf-query-container.c
+++ b/src/media-export/rygel-media-export-leaf-query-container.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-leaf-query-container.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-leaf-query-container.vala, do not modify */
-
 /*
  * Copyright (C) 2011 Jens Georg <mail jensge org>.
  *
@@ -23,6 +20,10 @@
 
 #include "rygel-media-export-leaf-query-container.h"
 
+G_DEFINE_TYPE (RygelMediaExportLeafQueryContainer,
+	       rygel_media_export_leaf_query_container,
+	       RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER);
+
 RygelMediaExportLeafQueryContainer*
 rygel_media_export_leaf_query_container_new (RygelSearchExpression *expression,
                                              const gchar           *id,
@@ -32,6 +33,7 @@ rygel_media_export_leaf_query_container_new (RygelSearchExpression *expression,
                                                                 "title", name,
                                                                 "child-count", 0,
                                                                 "expression", expression,
+                                                                "parent", NULL,
                                                                 NULL));
 }
 
@@ -42,7 +44,7 @@ rygel_media_export_leaf_query_container_get_children_ready (GObject      *source
   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);
+  RygelMediaObjects *children = rygel_searchable_container_search_finish (container, res, NULL, &error);
 
   if (error) {
     g_simple_async_result_take_error (simple, error);
@@ -58,7 +60,7 @@ rygel_media_export_leaf_query_container_get_children_ready (GObject      *source
       g_object_unref (child);
     }
 
-    g_simple_async_result_set_op_res_pointer (simple, children, g_object_unref);
+    g_simple_async_result_set_op_res_gpointer (simple, children, g_object_unref);
   }
   g_simple_async_result_complete (simple);
   g_object_unref (simple);
@@ -89,7 +91,7 @@ rygel_media_export_leaf_query_container_real_get_children (RygelMediaContainer *
 }
 
 static RygelMediaObjects *
-rygel_media_export_leaf_query_container_real_get_children_finish (RygelMediaContainer  *base,
+rygel_media_export_leaf_query_container_real_get_children_finish (RygelMediaContainer  *base G_GNUC_UNUSED,
                                                                   GAsyncResult         *res,
                                                                   GError              **error) {
   RygelMediaObjects* result;
@@ -110,7 +112,7 @@ rygel_media_export_leaf_query_container_real_count_children (RygelMediaExportQue
                                                              GError                         **error) {
   GError *inner_error = NULL;
   RygelMediaExportDBContainer *db_container = RYGEL_MEDIA_EXPORT_DB_CONTAINER (base);
-  RygelMediaExportQueryCOntainer *query_container = RYGEL_MEDIA_EXPORT_QUERY_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,
@@ -128,8 +130,8 @@ rygel_media_export_leaf_query_container_real_count_children (RygelMediaExportQue
 
 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);
+  RygelMediaContainerClass *container_class = RYGEL_MEDIA_CONTAINER_CLASS (leaf_class);
+  RygelMediaExportQueryContainerClass *query_class = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_CLASS (leaf_class);
 
   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;
diff --git a/src/media-export/rygel-media-export-leaf-query-container.h b/src/media-export/rygel-media-export-leaf-query-container.h
index 007021a..3eb05cb 100644
--- a/src/media-export/rygel-media-export-leaf-query-container.h
+++ b/src/media-export/rygel-media-export-leaf-query-container.h
@@ -18,8 +18,12 @@
  * 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__
+#ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <rygel-server.h>
 
 #include "rygel-media-export-query-container.h"
 
@@ -55,4 +59,4 @@ rygel_media_export_leaf_query_container_new (RygelSearchExpression *expression,
 
 G_END_DECLS
 
-#endif
+#endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_LEAF_QUERY_CONTAINER_H__ */
diff --git a/src/media-export/rygel-media-export-media-cache-upgrader.c b/src/media-export/rygel-media-export-media-cache-upgrader.c
index ea52ca2..c94ab79 100644
--- a/src/media-export/rygel-media-export-media-cache-upgrader.c
+++ b/src/media-export/rygel-media-export-media-cache-upgrader.c
@@ -21,73 +21,22 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "rygel-media-export-media-cache-upgrader.h"
-#include "rygel-media-export-media-cache.h"
-#include "rygel-media-export-database-cursor.h"
+#include <glib/gi18n-lib.h>
+#include <gee.h>
 
+#include "rygel-media-export-errors.h"
+#include "rygel-media-export-media-cache-upgrader.h"
+#include "rygel-media-export-query-container.h"
+#include "rygel-media-export-root-container.h"
+#include "rygel-media-export-sql-factory.h"
 
 G_DEFINE_TYPE (RygelMediaExportMediaCacheUpgrader, rygel_media_export_media_cache_upgrader, G_TYPE_OBJECT)
 
-
-
-#define RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY (rygel_media_export_sql_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactory))
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY))
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactoryClass))
-
-typedef struct _RygelMediaExportSQLFactory RygelMediaExportSQLFactory;
-typedef struct _RygelMediaExportSQLFactoryClass RygelMediaExportSQLFactoryClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_SQL_STRING (rygel_media_export_sql_string_get_type ())
-
-typedef struct _RygelMediaExportParamSpecMediaCacheUpgrader RygelMediaExportParamSpecMediaCacheUpgrader;
-
 struct _RygelMediaExportMediaCacheUpgraderPrivate {
 	RygelMediaExportDatabase* database;
 	RygelMediaExportSQLFactory* sql;
 };
 
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SAVE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INSERT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_DELETE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_CHILDREN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_META_DATA_COLUMN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_IDS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INDEX_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SCHEMA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS_CACHE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_STATISTICS
-} RygelMediaExportSQLString;
-
-struct _RygelMediaExportParamSpecMediaCacheUpgrader {
-	GParamSpec parent_instance;
-};
-
-
-gpointer rygel_media_export_media_cache_upgrader_ref (gpointer instance);
-void rygel_media_export_media_cache_upgrader_unref (gpointer instance);
-GParamSpec* rygel_media_export_param_spec_media_cache_upgrader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void rygel_media_export_value_set_media_cache_upgrader (GValue* value, gpointer v_object);
-void rygel_media_export_value_take_media_cache_upgrader (GValue* value, gpointer v_object);
-gpointer rygel_media_export_value_get_media_cache_upgrader (const GValue* value);
-GType rygel_media_export_media_cache_upgrader_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_sqlite_wrapper_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_database_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_sql_factory_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER, RygelMediaExportMediaCacheUpgraderPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_DUMMY_PROPERTY
@@ -95,22 +44,6 @@ enum  {
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_UPDATE_V3_V4_STRING_2 "UPDATE meta_data SET object_fk = " "(SELECT upnp_id FROM Object WHERE metadata_fk = meta_data.id)"
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_UPDATE_V3_V4_STRING_3 "ALTER TABLE Object ADD timestamp INTEGER"
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_UPDATE_V3_V4_STRING_4 "UPDATE Object SET timestamp = 0"
-RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_new (RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql);
-RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_construct (GType object_type, RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql);
-gboolean rygel_media_export_media_cache_upgrader_needs_upgrade (RygelMediaExportMediaCacheUpgrader* self, gint* current_version, GError** error);
-GQuark rygel_media_export_database_error_quark (void);
-gint rygel_media_export_database_query_value (RygelMediaExportDatabase* self, const gchar* sql, GValue* args, int args_length1, GError** error);
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION "11"
-void rygel_media_export_media_cache_upgrader_fix_schema (RygelMediaExportMediaCacheUpgrader* self, GError** error);
-void rygel_media_export_database_begin (RygelMediaExportDatabase* self, GError** error);
-void rygel_media_export_database_exec (RygelMediaExportDatabase* self, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
-GType rygel_media_export_sql_string_get_type (void) G_GNUC_CONST;
-const gchar* rygel_media_export_sql_factory_make (RygelMediaExportSQLFactory* self, RygelMediaExportSQLString query);
-void rygel_media_export_database_commit (RygelMediaExportDatabase* self, GError** error);
-void rygel_media_export_database_rollback (RygelMediaExportDatabase* self);
-void rygel_media_export_media_cache_upgrader_ensure_indices (RygelMediaExportMediaCacheUpgrader* self);
-void rygel_media_export_database_analyze (RygelMediaExportDatabase* self);
-void rygel_media_export_media_cache_upgrader_upgrade (RygelMediaExportMediaCacheUpgrader* self, gint old_version);
 static void rygel_media_export_media_cache_upgrader_update_v3_v4 (RygelMediaExportMediaCacheUpgrader* self);
 static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExportMediaCacheUpgrader* self);
 static void rygel_media_export_media_cache_upgrader_update_v5_v6 (RygelMediaExportMediaCacheUpgrader* self);
@@ -120,13 +53,7 @@ static void rygel_media_export_media_cache_upgrader_update_v8_v9 (RygelMediaExpo
 static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExportMediaCacheUpgrader* self);
 static void rygel_media_export_media_cache_upgrader_update_v10_v11 (RygelMediaExportMediaCacheUpgrader* self);
 static void rygel_media_export_media_cache_upgrader_force_reindex (RygelMediaExportMediaCacheUpgrader* self, GError** error);
-GType rygel_media_export_database_cursor_get_type (void) G_GNUC_CONST;
-RygelMediaExportDatabaseCursor* rygel_media_export_database_exec_cursor (RygelMediaExportDatabase* self, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
 static void _vala_GValue_array_free (GValue* array, gint array_length);
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_NAME "Files & Folders"
-static void rygel_media_export_media_cache_upgrader_finalize (RygelMediaExportMediaCacheUpgrader* obj);
 
 
 RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_construct (GType object_type, RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql) {
@@ -712,7 +639,6 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 			GValue* _tmp21_ = NULL;
 			GValue* args;
 			gint args_length1;
-			gint _args_size_;
 			RygelMediaExportDatabase* _tmp22_;
 			GValue* _tmp23_;
 			gint _tmp23__length1;
@@ -735,7 +661,6 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 			_tmp21_[0] = _tmp20_;
 			args = _tmp21_;
 			args_length1 = 1;
-			_args_size_ = args_length1;
 			_tmp22_ = self->priv->database;
 			_tmp23_ = args;
 			_tmp23__length1 = args_length1;
@@ -753,8 +678,6 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 				return;
 			}
 			{
-				RygelMediaExportDatabaseCursor* _tmp25_;
-				_tmp25_ = cursor;
 				while (TRUE) {
 					gboolean _tmp28_ = FALSE;
 					sqlite3_stmt* _tmp30_ = NULL;
@@ -783,7 +706,7 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 					}
 					_tmp31_ = queue;
 					_tmp32_ = statement;
-					_tmp33_ = sqlite3_column_text (_tmp32_, 0);
+					_tmp33_ = (const gchar *) sqlite3_column_text (_tmp32_, 0);
 					gee_queue_offer (_tmp31_, _tmp33_);
 				}
 			}
@@ -1712,7 +1635,6 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 			GValue* _tmp34_ = NULL;
 			GValue* args;
 			gint args_length1;
-			gint _args_size_;
 			RygelMediaExportDatabase* _tmp35_;
 			GValue* _tmp36_;
 			gint _tmp36__length1;
@@ -1735,7 +1657,6 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 			_tmp34_[0] = _tmp33_;
 			args = _tmp34_;
 			args_length1 = 1;
-			_args_size_ = args_length1;
 			_tmp35_ = self->priv->database;
 			_tmp36_ = args;
 			_tmp36__length1 = args_length1;
@@ -1754,8 +1675,6 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 				return;
 			}
 			{
-				RygelMediaExportDatabaseCursor* _tmp38_;
-				_tmp38_ = cursor;
 				while (TRUE) {
 					gboolean _tmp41_ = FALSE;
 					sqlite3_stmt* _tmp43_ = NULL;
@@ -1785,7 +1704,7 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 					}
 					_tmp44_ = queue;
 					_tmp45_ = statement;
-					_tmp46_ = sqlite3_column_text (_tmp45_, 0);
+					_tmp46_ = (const gchar *) sqlite3_column_text (_tmp45_, 0);
 					gee_queue_offer ((GeeQueue*) _tmp44_, _tmp46_);
 				}
 			}
@@ -2043,77 +1962,6 @@ static void rygel_media_export_media_cache_upgrader_update_v10_v11 (RygelMediaEx
 	}
 }
 
-
-static void rygel_media_export_value_media_cache_upgrader_init (GValue* value) {
-	value->data[0].v_pointer = NULL;
-}
-
-
-static void rygel_media_export_value_media_cache_upgrader_free_value (GValue* value) {
-	if (value->data[0].v_pointer) {
-		rygel_media_export_media_cache_upgrader_unref (value->data[0].v_pointer);
-	}
-}
-
-
-static void rygel_media_export_value_media_cache_upgrader_copy_value (const GValue* src_value, GValue* dest_value) {
-	if (src_value->data[0].v_pointer) {
-		dest_value->data[0].v_pointer = rygel_media_export_media_cache_upgrader_ref (src_value->data[0].v_pointer);
-	} else {
-		dest_value->data[0].v_pointer = NULL;
-	}
-}
-
-GParamSpec* rygel_media_export_param_spec_media_cache_upgrader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
-	RygelMediaExportParamSpecMediaCacheUpgrader* spec;
-	g_return_val_if_fail (g_type_is_a (object_type, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER), NULL);
-	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
-	G_PARAM_SPEC (spec)->value_type = object_type;
-	return G_PARAM_SPEC (spec);
-}
-
-
-gpointer rygel_media_export_value_get_media_cache_upgrader (const GValue* value) {
-	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER), NULL);
-	return value->data[0].v_pointer;
-}
-
-
-void rygel_media_export_value_set_media_cache_upgrader (GValue* value, gpointer v_object) {
-	RygelMediaExportMediaCacheUpgrader* old;
-	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER));
-	old = value->data[0].v_pointer;
-	if (v_object) {
-		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER));
-		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-		value->data[0].v_pointer = v_object;
-		rygel_media_export_media_cache_upgrader_ref (value->data[0].v_pointer);
-	} else {
-		value->data[0].v_pointer = NULL;
-	}
-	if (old) {
-		rygel_media_export_media_cache_upgrader_unref (old);
-	}
-}
-
-
-void rygel_media_export_value_take_media_cache_upgrader (GValue* value, gpointer v_object) {
-	RygelMediaExportMediaCacheUpgrader* old;
-	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER));
-	old = value->data[0].v_pointer;
-	if (v_object) {
-		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER));
-		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-		value->data[0].v_pointer = v_object;
-	} else {
-		value->data[0].v_pointer = NULL;
-	}
-	if (old) {
-		rygel_media_export_media_cache_upgrader_unref (old);
-	}
-}
-
-
 static void rygel_media_export_media_cache_upgrader_class_init (RygelMediaExportMediaCacheUpgraderClass * klass) {
 	rygel_media_export_media_cache_upgrader_parent_class = g_type_class_peek_parent (klass);
 
@@ -2123,8 +1971,4 @@ static void rygel_media_export_media_cache_upgrader_class_init (RygelMediaExport
 
 static void rygel_media_export_media_cache_upgrader_init (RygelMediaExportMediaCacheUpgrader * self) {
 	self->priv = RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_GET_PRIVATE (self);
-	self->ref_count = 1;
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-media-cache-upgrader.h b/src/media-export/rygel-media-export-media-cache-upgrader.h
index ca7fb8f..41df23e 100644
--- a/src/media-export/rygel-media-export-media-cache-upgrader.h
+++ b/src/media-export/rygel-media-export-media-cache-upgrader.h
@@ -22,6 +22,9 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
 #include "rygel-media-export-database.h"
 #include "rygel-media-export-sql-factory.h"
 
@@ -39,17 +42,36 @@ typedef struct _RygelMediaExportMediaCacheUpgraderClass RygelMediaExportMediaCac
 typedef struct _RygelMediaExportMediaCacheUpgraderPrivate RygelMediaExportMediaCacheUpgraderPrivate;
 
 struct _RygelMediaExportMediaCacheUpgrader {
-	GObject parent_instance;
-	volatile int ref_count;
-	RygelMediaExportMediaCacheUpgraderPrivate * priv;
+  GObject parent_instance;
+  RygelMediaExportMediaCacheUpgraderPrivate * priv;
 };
 
 struct _RygelMediaExportMediaCacheUpgraderClass {
-	GObjectClass parent_class;
+  GObjectClass parent_class;
 };
-GType rygel_media_export_media_cache_upgrader_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_new (RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql);
+GType
+rygel_media_export_media_cache_upgrader_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportMediaCacheUpgrader *
+rygel_media_export_media_cache_upgrader_new (RygelMediaExportDatabase   *database,
+					     RygelMediaExportSQLFactory *sql);
+
+gboolean
+rygel_media_export_media_cache_upgrader_needs_upgrade (RygelMediaExportMediaCacheUpgrader  *self,
+						       gint                                *current_version,
+						       GError                             **error);
+
+void
+rygel_media_export_media_cache_upgrader_fix_schema (RygelMediaExportMediaCacheUpgrader  *self,
+						    GError                             **error);
+
+void
+rygel_media_export_media_cache_upgrader_ensure_indices (RygelMediaExportMediaCacheUpgrader *self);
+
+void
+rygel_media_export_media_cache_upgrader_upgrade (RygelMediaExportMediaCacheUpgrader *self,
+						 gint                                old_version);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-media-cache.c b/src/media-export/rygel-media-export-media-cache.c
index 330b707..6202f24 100644
--- a/src/media-export/rygel-media-export-media-cache.c
+++ b/src/media-export/rygel-media-export-media-cache.c
@@ -19,10 +19,21 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include "rygel-media-export-media-cache.h"
-#include "rygel-media-export-database.h"
+#include <glib/gi18n-lib.h>
 #include <sqlite3.h>
 
+#include "rygel-media-export-database-cursor.h"
+#include "rygel-media-export-database.h"
+#include "rygel-media-export-errors.h"
+#include "rygel-media-export-media-cache-upgrader.h"
+#include "rygel-media-export-media-cache.h"
+#include "rygel-media-export-music-item.h"
+#include "rygel-media-export-null-container.h"
+#include "rygel-media-export-object-factory.h"
+#include "rygel-media-export-sql-factory.h"
+#include "rygel-media-export-sql-function.h"
+#include "rygel-media-export-sql-operator.h"
+#include "rygel-media-export-video-item.h"
 
 /**
  * Persistent storage of media objects
@@ -36,119 +47,12 @@ G_DEFINE_TYPE (RygelMediaExportMediaCache,
 
 
 
-#define RYGEL_MEDIA_EXPORT_TYPE_OBJECT_TYPE (rygel_media_export_object_type_get_type ())
-
 #define RYGEL_MEDIA_EXPORT_TYPE_EXISTS_CACHE_ENTRY (rygel_media_export_exists_cache_entry_get_type ())
 typedef struct _RygelMediaExportExistsCacheEntry RygelMediaExportExistsCacheEntry;
 
-#define RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY (rygel_media_export_object_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactory))
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
-
-typedef struct _RygelMediaExportObjectFactory RygelMediaExportObjectFactory;
-typedef struct _RygelMediaExportObjectFactoryClass RygelMediaExportObjectFactoryClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY (rygel_media_export_sql_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactory))
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY))
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FACTORY, RygelMediaExportSQLFactoryClass))
-
-typedef struct _RygelMediaExportSQLFactory RygelMediaExportSQLFactory;
-typedef struct _RygelMediaExportSQLFactoryClass RygelMediaExportSQLFactoryClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_SQL_STRING (rygel_media_export_sql_string_get_type ())
-
-#define RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR (rygel_media_export_database_cursor_get_type ())
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, RygelMediaExportDatabaseCursor))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, RygelMediaExportDatabaseCursorClass))
-#define RYGEL_MEDIA_EXPORT_IS_DATABASE_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR))
-#define RYGEL_MEDIA_EXPORT_IS_DATABASE_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, RygelMediaExportDatabaseCursorClass))
-
-typedef struct _RygelMediaExportDatabaseCursor RygelMediaExportDatabaseCursor;
-typedef struct _RygelMediaExportDatabaseCursorClass RygelMediaExportDatabaseCursorClass;
-
 #define _rygel_media_export_exists_cache_entry_free0(var) ((var == NULL) ? NULL : (var = (rygel_media_export_exists_cache_entry_free (var), NULL)))
 #define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
 #define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
-
-#define RYGEL_MEDIA_EXPORT_TYPE_DETAIL_COLUMN (rygel_media_export_detail_column_get_type ())
-
-#define RYGEL_TYPE_NULL_CONTAINER (rygel_null_container_get_type ())
-#define RYGEL_NULL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainer))
-#define RYGEL_NULL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainerClass))
-#define RYGEL_IS_NULL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_NULL_CONTAINER))
-#define RYGEL_IS_NULL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_NULL_CONTAINER))
-#define RYGEL_NULL_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainerClass))
-
-typedef struct _RygelNullContainer RygelNullContainer;
-typedef struct _RygelNullContainerClass RygelNullContainerClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER (rygel_media_export_media_cache_upgrader_get_type ())
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER, RygelMediaExportMediaCacheUpgrader))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER, RygelMediaExportMediaCacheUpgraderClass))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_UPGRADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER))
-#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_UPGRADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER))
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UPGRADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE_UPGRADER, RygelMediaExportMediaCacheUpgraderClass))
-
-typedef struct _RygelMediaExportMediaCacheUpgrader RygelMediaExportMediaCacheUpgrader;
-typedef struct _RygelMediaExportMediaCacheUpgraderClass RygelMediaExportMediaCacheUpgraderClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM (rygel_media_export_music_item_get_type ())
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItem))
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItemClass))
-#define RYGEL_MEDIA_EXPORT_IS_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM))
-#define RYGEL_MEDIA_EXPORT_IS_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM))
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItemClass))
-
-typedef struct _RygelMediaExportMusicItem RygelMediaExportMusicItem;
-typedef struct _RygelMediaExportMusicItemClass RygelMediaExportMusicItemClass;
-typedef struct _RygelMediaExportMusicItemPrivate RygelMediaExportMusicItemPrivate;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM (rygel_media_export_video_item_get_type ())
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItem))
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))
-#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
-#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))
-
-typedef struct _RygelMediaExportVideoItem RygelMediaExportVideoItem;
-typedef struct _RygelMediaExportVideoItemClass RygelMediaExportVideoItemClass;
-
-#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_SQL_OPERATOR (rygel_media_export_sql_operator_get_type ())
-#define RYGEL_MEDIA_EXPORT_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR, RygelMediaExportSqlOperator))
-#define RYGEL_MEDIA_EXPORT_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR, RygelMediaExportSqlOperatorClass))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_OPERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_OPERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR))
-#define RYGEL_MEDIA_EXPORT_SQL_OPERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR, RygelMediaExportSqlOperatorClass))
-
-typedef struct _RygelMediaExportSqlOperator RygelMediaExportSqlOperator;
-typedef struct _RygelMediaExportSqlOperatorClass RygelMediaExportSqlOperatorClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION (rygel_media_export_sql_function_get_type ())
-#define RYGEL_MEDIA_EXPORT_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION, RygelMediaExportSqlFunction))
-#define RYGEL_MEDIA_EXPORT_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION, RygelMediaExportSqlFunctionClass))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION))
-#define RYGEL_MEDIA_EXPORT_IS_SQL_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION))
-#define RYGEL_MEDIA_EXPORT_SQL_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION, RygelMediaExportSqlFunctionClass))
-
-typedef struct _RygelMediaExportSqlFunction RygelMediaExportSqlFunction;
-typedef struct _RygelMediaExportSqlFunctionClass RygelMediaExportSqlFunctionClass;
 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
 
 typedef enum  {
@@ -169,187 +73,42 @@ struct _RygelMediaExportMediaCachePrivate {
 	GeeHashMap* exists_cache;
 };
 
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SAVE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INSERT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_DELETE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_CHILDREN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_META_DATA_COLUMN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_IDS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INDEX_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SCHEMA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS_CACHE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_STATISTICS
-} RygelMediaExportSQLString;
-
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TYPE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TITLE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SIZE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_MIME_TYPE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_WIDTH,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_HEIGHT,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CLASS,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ALBUM,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DATE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITRATE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SAMPLE_FREQ,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITS_PER_SAMPLE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CHANNELS,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TRACK,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_COLOR_DEPTH,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DURATION,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_PARENT,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TIMESTAMP,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_URI,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DLNA_PROFILE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_GENRE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DISC
-} RygelMediaExportDetailColumn;
-
-struct _RygelMediaExportMusicItem {
-	RygelMusicItem parent_instance;
-	RygelMediaExportMusicItemPrivate * priv;
-	gint disc;
-};
-
-struct _RygelMediaExportMusicItemClass {
-	RygelMusicItemClass parent_class;
-};
-
-
-static RygelMediaExportMediaCache* rygel_media_export_media_cache_instance;
 static RygelMediaExportMediaCache* rygel_media_export_media_cache_instance = NULL;
 
-GQuark rygel_media_export_media_cache_error_quark (void);
-GType rygel_media_export_object_type_get_type (void) G_GNUC_CONST;
 GType rygel_media_export_exists_cache_entry_get_type (void) G_GNUC_CONST;
 RygelMediaExportExistsCacheEntry* rygel_media_export_exists_cache_entry_dup (const RygelMediaExportExistsCacheEntry* self);
 void rygel_media_export_exists_cache_entry_free (RygelMediaExportExistsCacheEntry* self);
-GType rygel_media_export_sqlite_wrapper_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_database_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_object_factory_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_sql_factory_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCachePrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_DUMMY_PROPERTY
 };
 
 static RygelMediaExportMediaCache* rygel_media_export_media_cache_construct (GType object_type, GError** error);
-RygelMediaExportSQLFactory* rygel_media_export_sql_factory_new (void);
-RygelMediaExportSQLFactory* rygel_media_export_sql_factory_construct (GType object_type);
 static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache* self, const gchar* name, GError** error);
-RygelMediaExportObjectFactory* rygel_media_export_object_factory_new (void);
-RygelMediaExportObjectFactory* rygel_media_export_object_factory_construct (GType object_type);
-GQuark rygel_media_export_database_error_quark (void);
 static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMediaCache* self, GError** error);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (GError** error);
-void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* self, const gchar* id, GError** error);
-void rygel_media_export_database_exec (RygelMediaExportDatabase* self, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
-GType rygel_media_export_sql_string_get_type (void) G_GNUC_CONST;
-const gchar* rygel_media_export_sql_factory_make (RygelMediaExportSQLFactory* self, RygelMediaExportSQLString query);
 static void _vala_GValue_array_free (GValue* array, gint array_length);
-void rygel_media_export_media_cache_remove_object (RygelMediaExportMediaCache* self, RygelMediaObject* object, GError** error);
-void rygel_media_export_media_cache_save_container (RygelMediaExportMediaCache* self, RygelMediaContainer* container, GError** error);
-void rygel_media_export_database_begin (RygelMediaExportDatabase* self, GError** error);
 static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaCache* self, RygelMediaObject* item, GError** error);
-void rygel_media_export_database_commit (RygelMediaExportDatabase* self, GError** error);
-void rygel_media_export_database_rollback (RygelMediaExportDatabase* self);
-void rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
 static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
-RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMediaCache* self, const gchar* object_id, GError** error);
-GType rygel_media_export_database_cursor_get_type (void) G_GNUC_CONST;
 static RygelMediaExportDatabaseCursor* rygel_media_export_media_cache_exec_cursor (RygelMediaExportMediaCache* self, RygelMediaExportSQLString id, GValue* values, int values_length1, GError** error);
 static RygelMediaObject* rygel_media_export_media_cache_get_object_from_statement (RygelMediaExportMediaCache* self, RygelMediaContainer* parent, sqlite3_stmt* statement);
-RygelMediaContainer* rygel_media_export_media_cache_get_container (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
-gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
 static gint rygel_media_export_media_cache_query_value (RygelMediaExportMediaCache* self, RygelMediaExportSQLString id, GValue* values, int values_length1, GError** error);
-gboolean rygel_media_export_media_cache_exists (RygelMediaExportMediaCache* self, GFile* file, gint64* timestamp, gint64* size, GError** error);
-sqlite3_stmt* rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor* self, GError** error);
-RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExportMediaCache* self, RygelMediaContainer* container, const gchar* sort_criteria, glong offset, glong max_count, GError** error);
 static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMediaExportMediaCache* self, const gchar* sort_criteria);
-RygelMediaExportDatabaseCursor* rygel_media_export_database_exec_cursor (RygelMediaExportDatabase* self, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
-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);
 static gchar* rygel_media_export_media_cache_translate_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, const gchar* prefix, GError** error);
 static guint rygel_media_export_media_cache_modify_limit (RygelMediaExportMediaCache* self, guint max_count);
-glong rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GValueArray* args, const gchar* container_id, GError** error);
-RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMediaExportMediaCache* self, const gchar* filter, GValueArray* args, const gchar* container_id, const gchar* sort_criteria, glong offset, glong max_count, GError** error);
-glong rygel_media_export_media_cache_get_object_count_by_search_expression (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, const gchar* container_id, GError** error);
 static GValue* _g_value_dup (GValue* self);
 static void _vala_GValue_free (GValue* self);
-gint rygel_media_export_database_query_value (RygelMediaExportDatabase* self, const gchar* sql, GValue* args, int args_length1, GError** error);
-GType rygel_media_export_detail_column_get_type (void) G_GNUC_CONST;
-RygelNullContainer* rygel_null_container_new (void);
-RygelNullContainer* rygel_null_container_construct (GType object_type);
-GType rygel_null_container_get_type (void) G_GNUC_CONST;
-void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache* self);
-GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
-GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMediaExportMediaCache* self, const gchar* column, const gchar* filter, GValueArray* args, glong offset, glong max_count, GError** error);
-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);
 static gchar* rygel_media_export_media_cache_map_operand_to_column (RygelMediaExportMediaCache* self, const gchar* operand, gchar** collate, GError** error);
-void rygel_media_export_media_cache_flag_object (RygelMediaExportMediaCache* self, GFile* file, const gchar* flag, GError** error);
-GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaCache* self, const gchar* flag, GError** error);
-RygelMediaExportDatabase* rygel_media_export_database_new (const gchar* name, GError** error);
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION "11"
-RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_new (RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql);
-RygelMediaExportMediaCacheUpgrader* rygel_media_export_media_cache_upgrader_construct (GType object_type, RygelMediaExportDatabase* database, RygelMediaExportSQLFactory* sql);
-gpointer rygel_media_export_media_cache_upgrader_ref (gpointer instance);
-void rygel_media_export_media_cache_upgrader_unref (gpointer instance);
-GParamSpec* rygel_media_export_param_spec_media_cache_upgrader (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void rygel_media_export_value_set_media_cache_upgrader (GValue* value, gpointer v_object);
-void rygel_media_export_value_take_media_cache_upgrader (GValue* value, gpointer v_object);
-gpointer rygel_media_export_value_get_media_cache_upgrader (const GValue* value);
-GType rygel_media_export_media_cache_upgrader_get_type (void) G_GNUC_CONST;
-gboolean rygel_media_export_media_cache_upgrader_needs_upgrade (RygelMediaExportMediaCacheUpgrader* self, gint* current_version, GError** error);
-void rygel_media_export_media_cache_upgrader_upgrade (RygelMediaExportMediaCacheUpgrader* self, gint old_version);
-void rygel_media_export_media_cache_upgrader_fix_schema (RygelMediaExportMediaCacheUpgrader* self, GError** error);
-void rygel_media_export_media_cache_upgrader_ensure_indices (RygelMediaExportMediaCacheUpgrader* self);
 static gboolean rygel_media_export_media_cache_create_schema (RygelMediaExportMediaCache* self);
-void rygel_media_export_database_null (GValue* result);
-GType rygel_media_export_music_item_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
-void rygel_media_export_database_analyze (RygelMediaExportDatabase* self);
-GType rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
-RygelMediaExportDBContainer* rygel_media_export_object_factory_get_container (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count, const gchar* uri);
-RygelMediaItem* rygel_media_export_object_factory_get_item (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class);
 static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache* self, sqlite3_stmt* statement, RygelMediaItem* item);
 static gchar* rygel_media_export_media_cache_search_expression_to_sql (RygelMediaExportMediaCache* self, RygelSearchExpression* expression, GValueArray* args, GError** error);
 static gchar* rygel_media_export_media_cache_logical_expression_to_sql (RygelMediaExportMediaCache* self, RygelLogicalExpression* expression, GValueArray* args, GError** error);
 static gchar* rygel_media_export_media_cache_relational_expression_to_sql (RygelMediaExportMediaCache* self, RygelRelationalExpression* exp, GValueArray* args, GError** error);
-GType rygel_media_export_sql_operator_get_type (void) G_GNUC_CONST;
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_new_from_search_criteria_op (GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_construct_from_search_criteria_op (GType object_type, GUPnPSearchCriteriaOp op, const gchar* arg, const gchar* collate);
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_new (const gchar* name, const gchar* arg);
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_construct (GType object_type, const gchar* name, const gchar* arg);
-GType rygel_media_export_sql_function_get_type (void) G_GNUC_CONST;
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate);
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate);
-gchar* rygel_media_export_sql_operator_to_string (RygelMediaExportSqlOperator* self);
-static void rygel_media_export_media_cache_finalize (GObject* obj);
+static void rygel_media_export_media_cache_dispose (GObject* obj);
 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 static gint _vala_array_length (gpointer array);
 
 
-GQuark rygel_media_export_media_cache_error_quark (void) {
-	return g_quark_from_static_string ("rygel_media_export_media_cache_error-quark");
-}
-
-
 GType rygel_media_export_object_type_get_type (void) {
 	static volatile gsize rygel_media_export_object_type_type_id__volatile = 0;
 	if (g_once_init_enter (&rygel_media_export_object_type_type_id__volatile)) {
@@ -393,7 +152,6 @@ static RygelMediaExportMediaCache* rygel_media_export_media_cache_construct (GTy
 	GError * _inner_error_ = NULL;
 	self = (RygelMediaExportMediaCache*) g_object_new (object_type, NULL);
 	_tmp0_ = rygel_media_export_sql_factory_new ();
-	g_object_unref (self->priv->sql);
 	self->priv->sql = _tmp0_;
 	rygel_media_export_media_cache_open_db (self, "media-export", &_inner_error_);
 	if (_inner_error_ != NULL) {
@@ -482,7 +240,6 @@ void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* se
 	GValue* _tmp2_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	RygelMediaExportDatabase* _tmp3_;
 	RygelMediaExportSQLFactory* _tmp4_;
 	const gchar* _tmp5_ = NULL;
@@ -496,7 +253,6 @@ void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* se
 	_tmp2_[0] = _tmp1_;
 	values = _tmp2_;
 	values_length1 = 1;
-	_values_size_ = values_length1;
 	_tmp3_ = self->priv->db;
 	_tmp4_ = self->priv->sql;
 	_tmp5_ = rygel_media_export_sql_factory_make (_tmp4_, RYGEL_MEDIA_EXPORT_SQL_STRING_DELETE);
@@ -693,7 +449,6 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 	GValue* _tmp2_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	RygelMediaObject* parent;
 	GValue* _tmp3_;
 	gint _tmp3__length1;
@@ -709,7 +464,6 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 	_tmp2_[0] = _tmp1_;
 	values = _tmp2_;
 	values_length1 = 1;
-	_values_size_ = values_length1;
 	parent = NULL;
 	_tmp3_ = values;
 	_tmp3__length1 = values_length1;
@@ -730,8 +484,6 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 		}
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp5_;
-		_tmp5_ = cursor;
 		while (TRUE) {
 			gboolean _tmp8_ = FALSE;
 			sqlite3_stmt* _tmp10_ = NULL;
@@ -861,7 +613,6 @@ gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache*
 	GValue* _tmp2_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	gint _tmp3_ = 0;
 	gint _tmp4_;
 	GError * _inner_error_ = NULL;
@@ -874,7 +625,6 @@ gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache*
 	_tmp2_[0] = _tmp1_;
 	values = _tmp2_;
 	values_length1 = 1;
-	_values_size_ = values_length1;
 	_tmp3_ = rygel_media_export_media_cache_query_value (self, RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT, values, values_length1, &_inner_error_);
 	_tmp4_ = _tmp3_;
 	if (_inner_error_ != NULL) {
@@ -907,7 +657,6 @@ gboolean rygel_media_export_media_cache_exists (RygelMediaExportMediaCache* self
 	GValue* _tmp4_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	GeeHashMap* _tmp5_;
 	const gchar* _tmp6_;
 	gboolean _tmp7_ = FALSE;
@@ -937,7 +686,6 @@ gboolean rygel_media_export_media_cache_exists (RygelMediaExportMediaCache* self
 	_tmp4_[0] = _tmp3_;
 	values = _tmp4_;
 	values_length1 = 1;
-	_values_size_ = values_length1;
 	_tmp5_ = self->priv->exists_cache;
 	_tmp6_ = uri;
 	_tmp7_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp5_, _tmp6_);
@@ -1051,7 +799,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 	GValue* _tmp9_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	RygelMediaExportSQLFactory* _tmp10_;
 	const gchar* _tmp11_ = NULL;
 	gchar* _tmp12_;
@@ -1092,7 +839,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 	_tmp9_[2] = _tmp8_;
 	values = _tmp9_;
 	values_length1 = 3;
-	_values_size_ = values_length1;
 	_tmp10_ = self->priv->sql;
 	_tmp11_ = rygel_media_export_sql_factory_make (_tmp10_, RYGEL_MEDIA_EXPORT_SQL_STRING_GET_CHILDREN);
 	_tmp12_ = g_strdup (_tmp11_);
@@ -1120,8 +866,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 		return NULL;
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp23_;
-		_tmp23_ = cursor;
 		while (TRUE) {
 			gboolean _tmp26_ = FALSE;
 			sqlite3_stmt* _tmp28_ = NULL;
@@ -1646,8 +1390,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 		return NULL;
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp48_;
-		_tmp48_ = cursor;
 		while (TRUE) {
 			gboolean _tmp51_ = FALSE;
 			sqlite3_stmt* _tmp53_ = NULL;
@@ -1675,7 +1417,7 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 				return NULL;
 			}
 			_tmp54_ = statement;
-			_tmp55_ = sqlite3_column_text (_tmp54_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_PARENT);
+			_tmp55_ = (const gchar *) sqlite3_column_text (_tmp54_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_PARENT);
 			parent_id = _tmp55_;
 			_tmp57_ = parent;
 			if (_tmp57_ == NULL) {
@@ -1693,10 +1435,10 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 			}
 			_tmp62_ = _tmp56_;
 			if (_tmp62_) {
-				RygelNullContainer* _tmp63_;
+				RygelMediaExportNullContainer* _tmp63_;
 				RygelMediaContainer* _tmp64_;
 				const gchar* _tmp65_;
-				_tmp63_ = rygel_null_container_new ();
+				_tmp63_ = rygel_media_export_null_container_new ();
 				g_object_unref (parent);
 				parent = (RygelMediaContainer*) _tmp63_;
 				_tmp64_ = parent;
@@ -1732,7 +1474,7 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 				const gchar* _tmp77_ = NULL;
 				const gchar* _tmp78_;
 				_tmp76_ = statement;
-				_tmp77_ = sqlite3_column_text (_tmp76_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID);
+				_tmp77_ = (const gchar *) sqlite3_column_text (_tmp76_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID);
 				_tmp78_ = parent_id;
 				g_warning ("Inconsistent database: item %s " "has no parent %s", _tmp77_, _tmp78_);
 			}
@@ -1760,8 +1502,6 @@ void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache
 			goto __catch7_g_error;
 		}
 		{
-			RygelMediaExportDatabaseCursor* _tmp1_;
-			_tmp1_ = cursor;
 			while (TRUE) {
 				gboolean _tmp4_ = FALSE;
 				sqlite3_stmt* _tmp6_ = NULL;
@@ -1781,7 +1521,7 @@ void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache
 					goto __catch7_g_error;
 				}
 				_tmp7_ = statement;
-				_tmp8_ = sqlite3_column_text (_tmp7_, 0);
+				_tmp8_ = (const gchar *) sqlite3_column_text (_tmp7_, 0);
 				_tmp9_ = statement;
 				_tmp10_ = sqlite3_column_int (_tmp9_, 1);
 				g_debug ("rygel-media-export-media-cache.vala:342: %s: %d", _tmp8_, _tmp10_);
@@ -1815,7 +1555,6 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 	GValue* _tmp3_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	GValue* _tmp4_;
 	gint _tmp4__length1;
 	RygelMediaExportDatabaseCursor* _tmp5_ = NULL;
@@ -1832,7 +1571,6 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 	_tmp3_[0] = _tmp2_;
 	values = _tmp3_;
 	values_length1 = 1;
-	_values_size_ = values_length1;
 	_tmp4_ = values;
 	_tmp4__length1 = values_length1;
 	_tmp5_ = rygel_media_export_media_cache_exec_cursor (self, RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_IDS, _tmp4_, _tmp4__length1, &_inner_error_);
@@ -1852,8 +1590,6 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 		}
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp6_;
-		_tmp6_ = cursor;
 		while (TRUE) {
 			gboolean _tmp9_ = FALSE;
 			sqlite3_stmt* _tmp11_ = NULL;
@@ -1885,7 +1621,7 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 			}
 			_tmp12_ = children;
 			_tmp13_ = statement;
-			_tmp14_ = sqlite3_column_text (_tmp13_, 0);
+			_tmp14_ = (const gchar *) sqlite3_column_text (_tmp13_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp14_);
 		}
 	}
@@ -1969,8 +1705,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
 		return NULL;
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp21_;
-		_tmp21_ = cursor;
 		while (TRUE) {
 			gboolean _tmp24_ = FALSE;
 			sqlite3_stmt* _tmp26_ = NULL;
@@ -1978,7 +1712,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
 			GeeArrayList* _tmp27_;
 			sqlite3_stmt* _tmp28_;
 			const gchar* _tmp29_ = NULL;
-			_tmp23_ = _statement_it;
 			_tmp24_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp24_) {
 				break;
@@ -1994,7 +1727,7 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
 			}
 			_tmp27_ = data;
 			_tmp28_ = statement;
-			_tmp29_ = sqlite3_column_text (_tmp28_, 0);
+			_tmp29_ = (const gchar *) sqlite3_column_text (_tmp28_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp27_, _tmp29_);
 		}
 	}
@@ -2086,7 +1819,6 @@ void rygel_media_export_media_cache_flag_object (RygelMediaExportMediaCache* sel
 	GValue* _tmp5_ = NULL;
 	GValue* args;
 	gint args_length1;
-	gint _args_size_;
 	RygelMediaExportDatabase* _tmp6_;
 	GError * _inner_error_ = NULL;
 	g_return_if_fail (self != NULL);
@@ -2104,7 +1836,6 @@ void rygel_media_export_media_cache_flag_object (RygelMediaExportMediaCache* sel
 	_tmp5_[1] = _tmp4_;
 	args = _tmp5_;
 	args_length1 = 2;
-	_args_size_ = args_length1;
 	_tmp6_ = self->priv->db;
 	rygel_media_export_database_exec (_tmp6_, "UPDATE Object SET flags = ? WHERE uri = ?", args, args_length1, &_inner_error_);
 	if (_inner_error_ != NULL) {
@@ -2126,7 +1857,6 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 	GValue* _tmp3_ = NULL;
 	GValue* args;
 	gint args_length1;
-	gint _args_size_;
 	RygelMediaExportDatabase* _tmp4_;
 	GValue* _tmp5_;
 	gint _tmp5__length1;
@@ -2144,7 +1874,6 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 	_tmp3_[0] = _tmp2_;
 	args = _tmp3_;
 	args_length1 = 1;
-	_args_size_ = args_length1;
 	_tmp4_ = self->priv->db;
 	_tmp5_ = args;
 	_tmp5__length1 = args_length1;
@@ -2157,8 +1886,6 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 		return NULL;
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp7_;
-		_tmp7_ = cursor;
 		while (TRUE) {
 			gboolean _tmp10_ = FALSE;
 			sqlite3_stmt* _tmp12_ = NULL;
@@ -2181,7 +1908,7 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 			}
 			_tmp13_ = uris;
 			_tmp14_ = statement;
-			_tmp15_ = sqlite3_column_text (_tmp14_, 0);
+			_tmp15_ = (const gchar *) sqlite3_column_text (_tmp14_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, _tmp15_);
 		}
 	}
@@ -2198,7 +1925,7 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 	RygelMediaExportDatabaseCursor* cursor;
 	GError * _inner_error_ = NULL;
 	g_return_if_fail (self != NULL);
-	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, RYGEL_MEDIA_EXPORT_TYPE_EXISTS_CACHE_ENTRY, (GBoxedCopyFunc) rygel_media_export_exists_cache_entry_dup, rygel_media_export_exists_cache_entry_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, RYGEL_MEDIA_EXPORT_TYPE_EXISTS_CACHE_ENTRY, (GBoxedCopyFunc) rygel_media_export_exists_cache_entry_dup, (GDestroyNotify) rygel_media_export_exists_cache_entry_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 	g_object_unref (self->priv->exists_cache);
 	self->priv->exists_cache = _tmp0_;
 	_tmp1_ = rygel_media_export_media_cache_exec_cursor (self, RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS_CACHE, NULL, 0, &_inner_error_);
@@ -2214,8 +1941,6 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 		}
 	}
 	{
-		RygelMediaExportDatabaseCursor* _tmp2_;
-		_tmp2_ = cursor;
 		while (TRUE) {
 			gboolean _tmp5_ = FALSE;
 			sqlite3_stmt* _tmp7_ = NULL;
@@ -2229,12 +1954,10 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 			sqlite3_stmt* _tmp13_;
 			const gchar* _tmp14_ = NULL;
 			RygelMediaExportExistsCacheEntry _tmp15_;
-			_tmp4_ = _statement_it;
 			_tmp5_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp5_) {
 				break;
 			}
-			_tmp6_ = _statement_it;
 			_tmp7_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp7_;
 			if (_inner_error_ != NULL) {
@@ -2258,7 +1981,7 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 			entry.size = _tmp11_;
 			_tmp12_ = self->priv->exists_cache;
 			_tmp13_ = statement;
-			_tmp14_ = sqlite3_column_text (_tmp13_, 2);
+			_tmp14_ = (const gchar *) sqlite3_column_text (_tmp13_, 2);
 			_tmp15_ = entry;
 			gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, _tmp14_, &_tmp15_);
 		}
@@ -2301,7 +2024,9 @@ static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache*
 		g_propagate_error (error, _inner_error_);
 		return;
 	}
-	g_object_unref (self->priv->db);
+	if (self->priv->db) {
+	  g_object_unref (self->priv->db);
+	}
 	self->priv->db = _tmp2_;
 	old_version = -1;
 	_tmp3_ = atoi (RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION);
@@ -2325,7 +2050,7 @@ static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache*
 		old_version = _tmp8_;
 		_tmp10_ = _tmp9_;
 		if (_inner_error_ != NULL) {
-			rygel_media_export_media_cache_upgrader_unref (upgrader);
+			g_object_unref (upgrader);
 			if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 				goto __catch8_rygel_media_export_database_error;
 			}
@@ -2347,7 +2072,7 @@ static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache*
 				_tmp15_ = upgrader;
 				rygel_media_export_media_cache_upgrader_fix_schema (_tmp15_, &_inner_error_);
 				if (_inner_error_ != NULL) {
-					rygel_media_export_media_cache_upgrader_unref (upgrader);
+					g_object_unref (upgrader);
 					if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 						goto __catch8_rygel_media_export_database_error;
 					}
@@ -2364,7 +2089,7 @@ static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache*
 				self->priv->db = NULL;
 				_tmp18_ = g_error_new_literal (RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR, RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_GENERAL_ERROR, "Database format" " not supported");
 				_inner_error_ = _tmp18_;
-				rygel_media_export_media_cache_upgrader_unref (upgrader);
+				g_object_unref (upgrader);
 				if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 					goto __catch8_rygel_media_export_database_error;
 				}
@@ -2373,7 +2098,7 @@ static void rygel_media_export_media_cache_open_db (RygelMediaExportMediaCache*
 		}
 		_tmp19_ = upgrader;
 		rygel_media_export_media_cache_upgrader_ensure_indices (_tmp19_);
-		rygel_media_export_media_cache_upgrader_unref (upgrader);
+		g_object_unref (upgrader);
 	}
 	goto __finally8;
 	__catch8_rygel_media_export_database_error:
@@ -2495,7 +2220,6 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 	GValue* _tmp37_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	RygelMediaItem* _tmp38_;
 	RygelMediaItem* _tmp103_;
 	RygelMediaExportDatabase* _tmp133_;
@@ -2581,53 +2305,41 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 	_tmp37_[18] = _tmp36_;
 	values = _tmp37_;
 	values_length1 = 19;
-	_values_size_ = values_length1;
 	_tmp38_ = item;
 	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp38_, RYGEL_TYPE_AUDIO_ITEM)) {
 		RygelMediaItem* _tmp39_;
 		RygelAudioItem* _tmp40_;
 		RygelAudioItem* audio_item;
 		GValue* _tmp41_;
-		gint _tmp41__length1;
 		RygelAudioItem* _tmp42_;
 		glong _tmp43_;
 		glong _tmp44_;
 		GValue _tmp45_ = {0};
-		GValue _tmp46_;
 		GValue* _tmp47_;
-		gint _tmp47__length1;
 		RygelAudioItem* _tmp48_;
 		gint _tmp49_;
 		gint _tmp50_;
 		GValue _tmp51_ = {0};
-		GValue _tmp52_;
 		GValue* _tmp53_;
-		gint _tmp53__length1;
 		RygelAudioItem* _tmp54_;
 		gint _tmp55_;
 		gint _tmp56_;
 		GValue _tmp57_ = {0};
-		GValue _tmp58_;
 		GValue* _tmp59_;
-		gint _tmp59__length1;
 		RygelAudioItem* _tmp60_;
 		gint _tmp61_;
 		gint _tmp62_;
 		GValue _tmp63_ = {0};
-		GValue _tmp64_;
 		GValue* _tmp65_;
-		gint _tmp65__length1;
 		RygelAudioItem* _tmp66_;
 		gint _tmp67_;
 		gint _tmp68_;
 		GValue _tmp69_ = {0};
-		GValue _tmp70_;
 		RygelMediaItem* _tmp71_;
 		_tmp39_ = item;
 		_tmp40_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (_tmp39_, RYGEL_TYPE_AUDIO_ITEM) ? ((RygelAudioItem*) _tmp39_) : NULL);
 		audio_item = _tmp40_;
 		_tmp41_ = values;
-		_tmp41__length1 = values_length1;
 		_tmp42_ = audio_item;
 		_tmp43_ = rygel_audio_item_get_duration (_tmp42_);
 		_tmp44_ = _tmp43_;
@@ -2635,9 +2347,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_long (&_tmp45_, _tmp44_);
 		G_IS_VALUE (&_tmp41_[14]) ? (g_value_unset (&_tmp41_[14]), NULL) : NULL;
 		_tmp41_[14] = _tmp45_;
-		_tmp46_ = _tmp41_[14];
 		_tmp47_ = values;
-		_tmp47__length1 = values_length1;
 		_tmp48_ = audio_item;
 		_tmp49_ = rygel_audio_item_get_bitrate (_tmp48_);
 		_tmp50_ = _tmp49_;
@@ -2645,9 +2355,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp51_, _tmp50_);
 		G_IS_VALUE (&_tmp47_[8]) ? (g_value_unset (&_tmp47_[8]), NULL) : NULL;
 		_tmp47_[8] = _tmp51_;
-		_tmp52_ = _tmp47_[8];
 		_tmp53_ = values;
-		_tmp53__length1 = values_length1;
 		_tmp54_ = audio_item;
 		_tmp55_ = rygel_audio_item_get_sample_freq (_tmp54_);
 		_tmp56_ = _tmp55_;
@@ -2655,9 +2363,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp57_, _tmp56_);
 		G_IS_VALUE (&_tmp53_[9]) ? (g_value_unset (&_tmp53_[9]), NULL) : NULL;
 		_tmp53_[9] = _tmp57_;
-		_tmp58_ = _tmp53_[9];
 		_tmp59_ = values;
-		_tmp59__length1 = values_length1;
 		_tmp60_ = audio_item;
 		_tmp61_ = rygel_audio_item_get_bits_per_sample (_tmp60_);
 		_tmp62_ = _tmp61_;
@@ -2665,9 +2371,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp63_, _tmp62_);
 		G_IS_VALUE (&_tmp59_[10]) ? (g_value_unset (&_tmp59_[10]), NULL) : NULL;
 		_tmp59_[10] = _tmp63_;
-		_tmp64_ = _tmp59_[10];
 		_tmp65_ = values;
-		_tmp65__length1 = values_length1;
 		_tmp66_ = audio_item;
 		_tmp67_ = rygel_audio_item_get_channels (_tmp66_);
 		_tmp68_ = _tmp67_;
@@ -2675,51 +2379,39 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp69_, _tmp68_);
 		G_IS_VALUE (&_tmp65_[11]) ? (g_value_unset (&_tmp65_[11]), NULL) : NULL;
 		_tmp65_[11] = _tmp69_;
-		_tmp70_ = _tmp65_[11];
 		_tmp71_ = item;
 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp71_, RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM)) {
 			RygelMediaItem* _tmp72_;
 			RygelMediaExportMusicItem* _tmp73_;
 			RygelMediaExportMusicItem* music_item;
 			GValue* _tmp74_;
-			gint _tmp74__length1;
 			RygelMediaExportMusicItem* _tmp75_;
 			const gchar* _tmp76_;
 			const gchar* _tmp77_;
 			GValue _tmp78_ = {0};
-			GValue _tmp79_;
 			GValue* _tmp80_;
-			gint _tmp80__length1;
 			RygelMediaExportMusicItem* _tmp81_;
 			const gchar* _tmp82_;
 			const gchar* _tmp83_;
 			GValue _tmp84_ = {0};
-			GValue _tmp85_;
 			GValue* _tmp86_;
-			gint _tmp86__length1;
 			RygelMediaExportMusicItem* _tmp87_;
 			const gchar* _tmp88_;
 			const gchar* _tmp89_;
 			GValue _tmp90_ = {0};
-			GValue _tmp91_;
 			GValue* _tmp92_;
-			gint _tmp92__length1;
 			RygelMediaExportMusicItem* _tmp93_;
 			gint _tmp94_;
 			gint _tmp95_;
 			GValue _tmp96_ = {0};
-			GValue _tmp97_;
 			GValue* _tmp98_;
-			gint _tmp98__length1;
 			RygelMediaExportMusicItem* _tmp99_;
 			gint _tmp100_;
 			GValue _tmp101_ = {0};
-			GValue _tmp102_;
 			_tmp72_ = item;
 			_tmp73_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (_tmp72_, RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM) ? ((RygelMediaExportMusicItem*) _tmp72_) : NULL);
 			music_item = _tmp73_;
 			_tmp74_ = values;
-			_tmp74__length1 = values_length1;
 			_tmp75_ = music_item;
 			_tmp76_ = rygel_music_item_get_artist ((RygelMusicItem*) _tmp75_);
 			_tmp77_ = _tmp76_;
@@ -2727,9 +2419,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 			g_value_set_string (&_tmp78_, _tmp77_);
 			G_IS_VALUE (&_tmp74_[5]) ? (g_value_unset (&_tmp74_[5]), NULL) : NULL;
 			_tmp74_[5] = _tmp78_;
-			_tmp79_ = _tmp74_[5];
 			_tmp80_ = values;
-			_tmp80__length1 = values_length1;
 			_tmp81_ = music_item;
 			_tmp82_ = rygel_music_item_get_album ((RygelMusicItem*) _tmp81_);
 			_tmp83_ = _tmp82_;
@@ -2737,9 +2427,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 			g_value_set_string (&_tmp84_, _tmp83_);
 			G_IS_VALUE (&_tmp80_[6]) ? (g_value_unset (&_tmp80_[6]), NULL) : NULL;
 			_tmp80_[6] = _tmp84_;
-			_tmp85_ = _tmp80_[6];
 			_tmp86_ = values;
-			_tmp86__length1 = values_length1;
 			_tmp87_ = music_item;
 			_tmp88_ = rygel_music_item_get_genre ((RygelMusicItem*) _tmp87_);
 			_tmp89_ = _tmp88_;
@@ -2747,9 +2435,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 			g_value_set_string (&_tmp90_, _tmp89_);
 			G_IS_VALUE (&_tmp86_[17]) ? (g_value_unset (&_tmp86_[17]), NULL) : NULL;
 			_tmp86_[17] = _tmp90_;
-			_tmp91_ = _tmp86_[17];
 			_tmp92_ = values;
-			_tmp92__length1 = values_length1;
 			_tmp93_ = music_item;
 			_tmp94_ = rygel_music_item_get_track_number ((RygelMusicItem*) _tmp93_);
 			_tmp95_ = _tmp94_;
@@ -2757,16 +2443,13 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 			g_value_set_int (&_tmp96_, _tmp95_);
 			G_IS_VALUE (&_tmp92_[12]) ? (g_value_unset (&_tmp92_[12]), NULL) : NULL;
 			_tmp92_[12] = _tmp96_;
-			_tmp97_ = _tmp92_[12];
 			_tmp98_ = values;
-			_tmp98__length1 = values_length1;
 			_tmp99_ = music_item;
 			_tmp100_ = _tmp99_->disc;
 			g_value_init (&_tmp101_, G_TYPE_INT);
 			g_value_set_int (&_tmp101_, _tmp100_);
 			G_IS_VALUE (&_tmp98_[18]) ? (g_value_unset (&_tmp98_[18]), NULL) : NULL;
 			_tmp98_[18] = _tmp101_;
-			_tmp102_ = _tmp98_[18];
 			g_object_unref (music_item);
 		}
 		g_object_unref (audio_item);
@@ -2777,32 +2460,25 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		RygelVisualItem* _tmp105_;
 		RygelVisualItem* visual_item;
 		GValue* _tmp106_;
-		gint _tmp106__length1;
 		RygelVisualItem* _tmp107_;
 		gint _tmp108_;
 		gint _tmp109_;
 		GValue _tmp110_ = {0};
-		GValue _tmp111_;
 		GValue* _tmp112_;
-		gint _tmp112__length1;
 		RygelVisualItem* _tmp113_;
 		gint _tmp114_;
 		gint _tmp115_;
 		GValue _tmp116_ = {0};
-		GValue _tmp117_;
 		GValue* _tmp118_;
-		gint _tmp118__length1;
 		RygelVisualItem* _tmp119_;
 		gint _tmp120_;
 		gint _tmp121_;
 		GValue _tmp122_ = {0};
-		GValue _tmp123_;
 		RygelMediaItem* _tmp124_;
 		_tmp104_ = item;
 		_tmp105_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (_tmp104_, RYGEL_TYPE_VISUAL_ITEM) ? ((RygelVisualItem*) _tmp104_) : NULL);
 		visual_item = _tmp105_;
 		_tmp106_ = values;
-		_tmp106__length1 = values_length1;
 		_tmp107_ = visual_item;
 		_tmp108_ = rygel_visual_item_get_width (_tmp107_);
 		_tmp109_ = _tmp108_;
@@ -2810,9 +2486,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp110_, _tmp109_);
 		G_IS_VALUE (&_tmp106_[2]) ? (g_value_unset (&_tmp106_[2]), NULL) : NULL;
 		_tmp106_[2] = _tmp110_;
-		_tmp111_ = _tmp106_[2];
 		_tmp112_ = values;
-		_tmp112__length1 = values_length1;
 		_tmp113_ = visual_item;
 		_tmp114_ = rygel_visual_item_get_height (_tmp113_);
 		_tmp115_ = _tmp114_;
@@ -2820,9 +2494,7 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp116_, _tmp115_);
 		G_IS_VALUE (&_tmp112_[3]) ? (g_value_unset (&_tmp112_[3]), NULL) : NULL;
 		_tmp112_[3] = _tmp116_;
-		_tmp117_ = _tmp112_[3];
 		_tmp118_ = values;
-		_tmp118__length1 = values_length1;
 		_tmp119_ = visual_item;
 		_tmp120_ = rygel_visual_item_get_color_depth (_tmp119_);
 		_tmp121_ = _tmp120_;
@@ -2830,24 +2502,20 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 		g_value_set_int (&_tmp122_, _tmp121_);
 		G_IS_VALUE (&_tmp118_[13]) ? (g_value_unset (&_tmp118_[13]), NULL) : NULL;
 		_tmp118_[13] = _tmp122_;
-		_tmp123_ = _tmp118_[13];
 		_tmp124_ = item;
 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp124_, RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM)) {
 			RygelMediaItem* _tmp125_;
 			RygelMediaExportVideoItem* _tmp126_;
 			RygelMediaExportVideoItem* video_item;
 			GValue* _tmp127_;
-			gint _tmp127__length1;
 			RygelMediaExportVideoItem* _tmp128_;
 			const gchar* _tmp129_;
 			const gchar* _tmp130_;
 			GValue _tmp131_ = {0};
-			GValue _tmp132_;
 			_tmp125_ = item;
 			_tmp126_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (_tmp125_, RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM) ? ((RygelMediaExportVideoItem*) _tmp125_) : NULL);
 			video_item = _tmp126_;
 			_tmp127_ = values;
-			_tmp127__length1 = values_length1;
 			_tmp128_ = video_item;
 			_tmp129_ = rygel_video_item_get_author ((RygelVideoItem*) _tmp128_);
 			_tmp130_ = _tmp129_;
@@ -2855,7 +2523,6 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 			g_value_set_string (&_tmp131_, _tmp130_);
 			G_IS_VALUE (&_tmp127_[5]) ? (g_value_unset (&_tmp127_[5]), NULL) : NULL;
 			_tmp127_[5] = _tmp131_;
-			_tmp132_ = _tmp127_[5];
 			g_object_unref (video_item);
 		}
 		g_object_unref (visual_item);
@@ -2907,7 +2574,6 @@ static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaC
 	GValue* _tmp35_ = NULL;
 	GValue* values;
 	gint values_length1;
-	gint _values_size_;
 	RygelMediaExportDatabase* _tmp36_;
 	RygelMediaExportSQLFactory* _tmp37_;
 	const gchar* _tmp38_ = NULL;
@@ -2920,7 +2586,7 @@ static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaC
 		type = (gint) RYGEL_MEDIA_EXPORT_OBJECT_TYPE_ITEM;
 	}
 	_tmp1_ = item;
-	_tmp2_ = _tmp1_->parent;
+	_tmp2_ = rygel_media_object_get_parent (_tmp1_);
 	if (_tmp2_ == NULL) {
 		GValue _tmp3_ = {0};
 		rygel_media_export_database_null (&_tmp3_);
@@ -2933,7 +2599,7 @@ static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaC
 		const gchar* _tmp7_;
 		GValue _tmp8_ = {0};
 		_tmp4_ = item;
-		_tmp5_ = _tmp4_->parent;
+		_tmp5_ = rygel_media_object_get_parent (_tmp4_);
 		_tmp6_ = rygel_media_object_get_id ((RygelMediaObject*) _tmp5_);
 		_tmp7_ = _tmp6_;
 		g_value_init (&_tmp8_, G_TYPE_STRING);
@@ -2943,7 +2609,7 @@ static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaC
 	}
 	_tmp10_ = item;
 	_tmp11_ = _tmp10_->uris;
-	_tmp12_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp11_);
+	_tmp12_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp11_);
 	_tmp13_ = _tmp12_;
 	if (_tmp13_ == 0) {
 		g_free (_tmp9_);
@@ -2995,7 +2661,6 @@ static void rygel_media_export_media_cache_create_object (RygelMediaExportMediaC
 	_tmp35_[5] = _tmp34_;
 	values = _tmp35_;
 	values_length1 = 6;
-	_values_size_ = values_length1;
 	_tmp36_ = self->priv->db;
 	_tmp37_ = self->priv->sql;
 	_tmp38_ = rygel_media_export_sql_factory_make (_tmp37_, RYGEL_MEDIA_EXPORT_SQL_STRING_INSERT);
@@ -3140,13 +2805,13 @@ static RygelMediaObject* rygel_media_export_media_cache_get_object_from_statemen
 	g_return_val_if_fail (statement != NULL, NULL);
 	object = NULL;
 	_tmp0_ = statement;
-	_tmp1_ = sqlite3_column_text (_tmp0_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TITLE);
+	_tmp1_ = (const gchar *) sqlite3_column_text (_tmp0_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TITLE);
 	title = _tmp1_;
 	_tmp2_ = statement;
-	_tmp3_ = sqlite3_column_text (_tmp2_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID);
+	_tmp3_ = (const gchar *) sqlite3_column_text (_tmp2_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID);
 	object_id = _tmp3_;
 	_tmp4_ = statement;
-	_tmp5_ = sqlite3_column_text (_tmp4_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_URI);
+	_tmp5_ = (const gchar *) sqlite3_column_text (_tmp4_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_URI);
 	uri = _tmp5_;
 	_tmp6_ = statement;
 	_tmp7_ = sqlite3_column_int (_tmp6_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TYPE);
@@ -3200,7 +2865,7 @@ static RygelMediaObject* rygel_media_export_media_cache_get_object_from_statemen
 			RygelMediaObject* _tmp28_;
 			const gchar* _tmp29_;
 			_tmp19_ = statement;
-			_tmp20_ = sqlite3_column_text (_tmp19_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CLASS);
+			_tmp20_ = (const gchar *) sqlite3_column_text (_tmp19_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CLASS);
 			upnp_class = _tmp20_;
 			_tmp21_ = self->priv->factory;
 			_tmp22_ = parent;
@@ -3289,15 +2954,15 @@ static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache
 	g_return_if_fail (item != NULL);
 	_tmp0_ = item;
 	_tmp1_ = statement;
-	_tmp2_ = sqlite3_column_text (_tmp1_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DATE);
+	_tmp2_ = (const gchar *) sqlite3_column_text (_tmp1_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DATE);
 	rygel_media_item_set_date (_tmp0_, _tmp2_);
 	_tmp3_ = item;
 	_tmp4_ = statement;
-	_tmp5_ = sqlite3_column_text (_tmp4_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_MIME_TYPE);
+	_tmp5_ = (const gchar *) sqlite3_column_text (_tmp4_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_MIME_TYPE);
 	rygel_media_item_set_mime_type (_tmp3_, _tmp5_);
 	_tmp6_ = item;
 	_tmp7_ = statement;
-	_tmp8_ = sqlite3_column_text (_tmp7_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DLNA_PROFILE);
+	_tmp8_ = (const gchar *) sqlite3_column_text (_tmp7_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DLNA_PROFILE);
 	rygel_media_item_set_dlna_profile (_tmp6_, _tmp8_);
 	_tmp9_ = item;
 	_tmp10_ = statement;
@@ -3370,15 +3035,15 @@ static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache
 			music_item = _tmp32_;
 			_tmp33_ = music_item;
 			_tmp34_ = statement;
-			_tmp35_ = sqlite3_column_text (_tmp34_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR);
+			_tmp35_ = (const gchar *) sqlite3_column_text (_tmp34_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR);
 			rygel_music_item_set_artist ((RygelMusicItem*) _tmp33_, _tmp35_);
 			_tmp36_ = music_item;
 			_tmp37_ = statement;
-			_tmp38_ = sqlite3_column_text (_tmp37_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ALBUM);
+			_tmp38_ = (const gchar *) sqlite3_column_text (_tmp37_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ALBUM);
 			rygel_music_item_set_album ((RygelMusicItem*) _tmp36_, _tmp38_);
 			_tmp39_ = music_item;
 			_tmp40_ = statement;
-			_tmp41_ = sqlite3_column_text (_tmp40_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_GENRE);
+			_tmp41_ = (const gchar *) sqlite3_column_text (_tmp40_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_GENRE);
 			rygel_music_item_set_genre ((RygelMusicItem*) _tmp39_, _tmp41_);
 			_tmp42_ = music_item;
 			_tmp43_ = statement;
@@ -3433,7 +3098,7 @@ static void rygel_media_export_media_cache_fill_item (RygelMediaExportMediaCache
 			video_item = _tmp60_;
 			_tmp61_ = video_item;
 			_tmp62_ = statement;
-			_tmp63_ = sqlite3_column_text (_tmp62_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR);
+			_tmp63_ = (const gchar *) sqlite3_column_text (_tmp62_, (gint) RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR);
 			rygel_video_item_set_author ((RygelVideoItem*) _tmp61_, _tmp63_);
 			g_object_unref (video_item);
 		}
@@ -4181,7 +3846,6 @@ static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMedia
 	gchar** _tmp3_ = NULL;
 	gchar** fields;
 	gint fields_length1;
-	gint _fields_size_;
 	gchar** _tmp4_;
 	gint _tmp4__length1;
 	GString* _tmp27_;
@@ -4196,16 +3860,12 @@ static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMedia
 	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, ",", 0);
 	fields = _tmp3_;
 	fields_length1 = _vala_array_length (_tmp2_);
-	_fields_size_ = fields_length1;
 	_tmp4_ = fields;
 	_tmp4__length1 = fields_length1;
 	{
 		gchar** field_collection = NULL;
-		gint field_collection_length1 = 0;
-		gint _field_collection_size_ = 0;
 		gint field_it = 0;
 		field_collection = _tmp4_;
-		field_collection_length1 = _tmp4__length1;
 		for (field_it = 0; field_it < _tmp4__length1; field_it = field_it + 1) {
 			gchar* _tmp5_;
 			gchar* field = NULL;
@@ -4225,7 +3885,6 @@ static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMedia
 					gchar* column;
 					const gchar* _tmp15_;
 					gchar** _tmp16_;
-					gint _tmp16__length1;
 					const gchar* _tmp17_;
 					const gchar* _tmp19_ = NULL;
 					const gchar* _tmp20_;
@@ -4251,7 +3910,6 @@ static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMedia
 					}
 					_tmp15_ = field;
 					_tmp16_ = fields;
-					_tmp16__length1 = fields_length1;
 					_tmp17_ = _tmp16_[0];
 					if (g_strcmp0 (_tmp15_, _tmp17_) != 0) {
 						GString* _tmp18_;
@@ -4311,7 +3969,7 @@ static gchar* rygel_media_export_media_cache_translate_sort_criteria (RygelMedia
 static void rygel_media_export_media_cache_class_init (RygelMediaExportMediaCacheClass * klass) {
 	rygel_media_export_media_cache_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (RygelMediaExportMediaCachePrivate));
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_media_cache_finalize;
+	G_OBJECT_CLASS (klass)->dispose = rygel_media_export_media_cache_dispose;
 }
 
 
@@ -4320,14 +3978,35 @@ static void rygel_media_export_media_cache_init (RygelMediaExportMediaCache * se
 }
 
 
-static void rygel_media_export_media_cache_finalize (GObject* obj) {
-	RygelMediaExportMediaCache * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCache);
-	g_object_unref (self->priv->db);
-	g_object_unref (self->priv->factory);
-	g_object_unref (self->priv->sql);
-	g_object_unref (self->priv->exists_cache);
-	G_OBJECT_CLASS (rygel_media_export_media_cache_parent_class)->finalize (obj);
+static void rygel_media_export_media_cache_dispose (GObject *object) {
+  RygelMediaExportMediaCache *self = RYGEL_MEDIA_EXPORT_MEDIA_CACHE (object);
+  RygelMediaExportMediaCachePrivate *priv = self->priv;
+
+  if (priv->db) {
+    RygelMediaExportDatabase *db = priv->db;
+
+    priv->db = NULL;
+    g_object_unref (db);
+  }
+  if (priv->factory) {
+    RygelMediaExportObjectFactory *factory = priv->factory;
+
+    priv->factory = NULL;
+    g_object_unref (factory);
+  }
+  if (priv->sql) {
+    RygelMediaExportSQLFactory *sql = priv->sql;
+
+    priv->sql = NULL;
+    g_object_unref (sql);
+  }
+  if (priv->exists_cache) {
+    GeeHashMap *exists_cache = priv->exists_cache;
+
+    priv->exists_cache = NULL;
+    g_object_unref (exists_cache);
+  }
+  G_OBJECT_CLASS (rygel_media_export_media_cache_parent_class)->dispose (object);
 }
 
 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
diff --git a/src/media-export/rygel-media-export-media-cache.h b/src/media-export/rygel-media-export-media-cache.h
index 0088831..cb28122 100644
--- a/src/media-export/rygel-media-export-media-cache.h
+++ b/src/media-export/rygel-media-export-media-cache.h
@@ -24,9 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
+#include <gio/gio.h>
 #include <rygel-server.h>
 #include <gee.h>
 
@@ -58,6 +56,131 @@ rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
 RygelMediaExportMediaCache *
 rygel_media_export_media_cache_new (GError **error);
 
+gchar *
+rygel_media_export_media_cache_get_id (GFile *file);
+
+RygelMediaExportMediaCache *
+rygel_media_export_media_cache_get_default (GError **error);
+
+void
+rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache  *self,
+					     const gchar                 *id,
+					     GError                     **error);
+
+void
+rygel_media_export_media_cache_remove_object (RygelMediaExportMediaCache  *self,
+					      RygelMediaObject            *object,
+					      GError                     **error);
+
+void
+rygel_media_export_media_cache_save_container (RygelMediaExportMediaCache  *self,
+					       RygelMediaContainer         *container,
+					       GError                     **error);
+
+void
+rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache  *self,
+					  RygelMediaItem              *item,
+					  GError                     **error);
+
+RygelMediaObject *
+rygel_media_export_media_cache_get_object (RygelMediaExportMediaCache  *self,
+					   const gchar                 *object_id,
+					   GError                     **error);
+
+RygelMediaContainer *
+rygel_media_export_media_cache_get_container (RygelMediaExportMediaCache  *self,
+					      const gchar                 *container_id,
+					      GError                     **error);
+
+gint
+rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache  *self,
+						const gchar                 *container_id,
+						GError                     **error);
+
+gboolean
+rygel_media_export_media_cache_exists (RygelMediaExportMediaCache  *self,
+				       GFile                       *file,
+				       gint64                      *timestamp,
+				       gint64                      *size,
+				       GError                     **error);
+
+RygelMediaObjects *
+rygel_media_export_media_cache_get_children (RygelMediaExportMediaCache  *self,
+					     RygelMediaContainer         *container,
+					     const gchar                 *sort_criteria,
+					     glong                        offset,
+					     glong                        max_count,
+					     GError                     **error);
+
+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);
+
+glong
+rygel_media_export_media_cache_get_object_count_by_filter (RygelMediaExportMediaCache  *self,
+							   const gchar                 *filter,
+							   GValueArray                 *args,
+							   const gchar                 *container_id,
+							   GError                     **error);
+
+RygelMediaObjects *
+rygel_media_export_media_cache_get_objects_by_filter (RygelMediaExportMediaCache *self,
+						      const gchar                *filter,
+						      GValueArray                *args,
+						      const gchar                *container_id,
+						      const gchar                *sort_criteria,
+						      glong                       offset,
+						      glong                       max_count,
+						      GError                    **error);
+
+glong
+rygel_media_export_media_cache_get_object_count_by_search_expression (RygelMediaExportMediaCache  *self,
+								      RygelSearchExpression       *expression,
+								      const gchar                 *container_id,
+								      GError                     **error);
+
+void
+rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache *self);
+
+GeeArrayList *
+rygel_media_export_media_cache_get_child_ids (RygelMediaExportMediaCache  *self,
+					      const gchar                 *container_id,
+					      GError                     **error);
+
+GeeList *
+rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMediaExportMediaCache  *self,
+							       const gchar                 *column,
+							       const gchar                 *filter,
+							       GValueArray                 *args,
+							       glong                        offset,
+							       glong                        max_count,
+							       GError                     **error);
+
+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);
+
+void
+rygel_media_export_media_cache_flag_object (RygelMediaExportMediaCache  *self,
+					    GFile                       *file,
+					    const gchar                 *flag,
+					    GError                     **error);
+
+GeeList *
+rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaCache  *self,
+						 const gchar                 *flag,
+						 GError                     **error);
+
 G_END_DECLS
 
 #endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_MEDIA_CACHE_H__ */
diff --git a/src/media-export/rygel-media-export-metadata-extractor.c b/src/media-export/rygel-media-export-metadata-extractor.c
index dc40f66..ff0be71 100644
--- a/src/media-export/rygel-media-export-metadata-extractor.c
+++ b/src/media-export/rygel-media-export-metadata-extractor.c
@@ -40,11 +40,8 @@ struct _RygelMediaExportMetadataExtractorPrivate {
 	gboolean extract_metadata;
 };
 
-GType rygel_media_export_metadata_extractor_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_METADATA_EXTRACTOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_METADATA_EXTRACTOR, RygelMediaExportMetadataExtractorPrivate))
 
-RygelMediaExportMetadataExtractor* rygel_media_export_metadata_extractor_construct (GType object_type);
-void rygel_media_export_metadata_extractor_extract (RygelMediaExportMetadataExtractor* self, GFile* file);
 static void rygel_media_export_metadata_extractor_on_done (RygelMediaExportMetadataExtractor* self, GUPnPDLNAInformation* dlna, GError* err);
 static void _rygel_media_export_metadata_extractor_on_done_gupnp_dlna_discoverer_done (GUPnPDLNADiscoverer* _sender, GUPnPDLNAInformation* dlna, GError* err, gpointer self);
 static void rygel_media_export_metadata_extractor_extract_basic_information (RygelMediaExportMetadataExtractor* self, GFile* file, GUPnPDLNAInformation* dlna);
@@ -105,7 +102,7 @@ RygelMediaExportMetadataExtractor* rygel_media_export_metadata_extractor_new (vo
 }
 
 
-static void _rygel_media_export_metadata_extractor_on_done_gupnp_dlna_discoverer_done (GUPnPDLNADiscoverer* _sender, GUPnPDLNAInformation* dlna, GError* err, gpointer self) {
+static void _rygel_media_export_metadata_extractor_on_done_gupnp_dlna_discoverer_done (GUPnPDLNADiscoverer* _sender G_GNUC_UNUSED, GUPnPDLNAInformation* dlna, GError* err, gpointer self) {
 	rygel_media_export_metadata_extractor_on_done (self, dlna, err);
 }
 
@@ -164,20 +161,20 @@ static void rygel_media_export_metadata_extractor_on_done (RygelMediaExportMetad
 	guint _tmp1_ = 0U;
 	GeeHashMap* _tmp2_;
 	GUPnPDLNAInformation* _tmp3_;
-	GstDiscovererInfo* _tmp4_;
-	GstDiscovererInfo* _tmp5_;
+	const GstDiscovererInfo* _tmp4_;
+	const GstDiscovererInfo* _tmp5_;
 	const gchar* _tmp6_ = NULL;
 	gpointer _tmp7_ = NULL;
 	GFile* file;
 	GFile* _tmp8_;
 	GeeHashMap* _tmp13_;
 	GUPnPDLNAInformation* _tmp14_;
-	GstDiscovererInfo* _tmp15_;
-	GstDiscovererInfo* _tmp16_;
+	const GstDiscovererInfo* _tmp15_;
+	const GstDiscovererInfo* _tmp16_;
 	const gchar* _tmp17_ = NULL;
 	GUPnPDLNAInformation* _tmp18_;
-	GstDiscovererInfo* _tmp19_;
-	GstDiscovererInfo* _tmp20_;
+	const GstDiscovererInfo* _tmp19_;
+	const GstDiscovererInfo* _tmp20_;
 	GstDiscovererResult _tmp21_ = 0;
 	GFile* _tmp31_;
 	GUPnPDLNAInformation* _tmp32_;
@@ -198,8 +195,8 @@ static void rygel_media_export_metadata_extractor_on_done (RygelMediaExportMetad
 	_tmp8_ = file;
 	if (_tmp8_ == NULL) {
 		GUPnPDLNAInformation* _tmp9_;
-		GstDiscovererInfo* _tmp10_;
-		GstDiscovererInfo* _tmp11_;
+		const GstDiscovererInfo* _tmp10_;
+		const GstDiscovererInfo* _tmp11_;
 		const gchar* _tmp12_ = NULL;
 		_tmp9_ = dlna;
 		_tmp10_ = gupnp_dlna_information_get_info (_tmp9_);
@@ -233,8 +230,8 @@ static void rygel_media_export_metadata_extractor_on_done (RygelMediaExportMetad
 		dlna = NULL;
 	} else {
 		GUPnPDLNAInformation* _tmp25_;
-		GstDiscovererInfo* _tmp26_;
-		GstDiscovererInfo* _tmp27_;
+		const GstDiscovererInfo* _tmp26_;
+		const GstDiscovererInfo* _tmp27_;
 		GstDiscovererResult _tmp28_ = 0;
 		_tmp25_ = dlna;
 		_tmp26_ = gupnp_dlna_information_get_info (_tmp25_);
@@ -351,7 +348,7 @@ static void rygel_media_export_metadata_extractor_extract_basic_information (Ryg
 }
 
 
-static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closure, GValue * return_value G_GNUC_UNUSED, guint n_param_values, const GValue * param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) {
 	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2);
 	register GMarshalFunc_VOID__OBJECT_OBJECT_OBJECT callback;
 	register GCClosure * cc;
@@ -371,7 +368,7 @@ static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_OBJECT (GClosure * closu
 }
 
 
-static void g_cclosure_user_marshal_VOID__OBJECT_POINTER (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+static void g_cclosure_user_marshal_VOID__OBJECT_POINTER (GClosure * closure, GValue * return_value G_GNUC_UNUSED, guint n_param_values, const GValue * param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) {
 	typedef void (*GMarshalFunc_VOID__OBJECT_POINTER) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
 	register GMarshalFunc_VOID__OBJECT_POINTER callback;
 	register GCClosure * cc;
diff --git a/src/media-export/rygel-media-export-metadata-extractor.h b/src/media-export/rygel-media-export-metadata-extractor.h
index af3b19d..d429c73 100644
--- a/src/media-export/rygel-media-export-metadata-extractor.h
+++ b/src/media-export/rygel-media-export-metadata-extractor.h
@@ -24,11 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
-#include <rygel-server.h>
-#include <gee.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -46,16 +42,21 @@ typedef struct _RygelMediaExportMetadataExtractorPrivate RygelMediaExportMetadat
 struct _RygelMediaExportMetadataExtractor {
   GObject parent_instance;
   RygelMediaExportMetadataExtractorPrivate *priv;
-  GFile* origin;
+  GFile* origin; /* TODO: move to priv. */
 };
 
 struct _RygelMediaExportMetadataExtractorClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_metadata_extractor_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_metadata_extractor_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportMetadataExtractor* rygel_media_export_metadata_extractor_new ();
+RygelMediaExportMetadataExtractor *rygel_media_export_metadata_extractor_new (void);
+
+void
+rygel_media_export_metadata_extractor_extract (RygelMediaExportMetadataExtractor *self,
+					       GFile                             *file);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-music-item.c b/src/media-export/rygel-media-export-music-item.c
index a68922c..844d66b 100644
--- a/src/media-export/rygel-media-export-music-item.c
+++ b/src/media-export/rygel-media-export-music-item.c
@@ -20,14 +20,16 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-
 #include "rygel-media-export-music-item.h"
 #include "rygel-media-export-media-cache.h"
 
 static void rygel_media_export_music_item_rygel_updatable_object_interface_init (RygelUpdatableObjectIface * iface);
 
-G_DEFINE_TYPE_WITH_CODE (RygelMediaExportMusicItem, rygel_media_export_music_item, RYGEL_TYPE_MUSIC_ITEM,
-  G_IMPLEMENT_INTERFACE (RYGEL_TYPE_UPDATABLE_OBJECT, rygel_media_export_music_item_rygel_updatable_object_interface_init))
+G_DEFINE_TYPE_WITH_CODE (RygelMediaExportMusicItem,
+			 rygel_media_export_music_item,
+			 RYGEL_TYPE_MUSIC_ITEM,
+			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_UPDATABLE_OBJECT,
+						rygel_media_export_music_item_rygel_updatable_object_interface_init))
 
 typedef struct _RygelMediaExportMusicItemCommitData RygelMediaExportMusicItemCommitData;
 
@@ -44,16 +46,9 @@ struct _RygelMediaExportMusicItemCommitData {
 };
 
 
-static RygelUpdatableObjectIface* rygel_media_export_music_item_rygel_updatable_object_parent_iface = NULL;
-
-RygelMediaExportMusicItem* rygel_media_export_music_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
 static void rygel_media_export_music_item_real_commit_data_free (gpointer _data);
 static void rygel_media_export_music_item_real_commit (RygelUpdatableObject* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_music_item_real_commit_co (RygelMediaExportMusicItemCommitData* _data_);
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (GError** error);
-void rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
-static void rygel_media_export_music_item_finalize (GObject* obj);
 
 
 RygelMediaExportMusicItem* rygel_media_export_music_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class) {
@@ -101,12 +96,8 @@ static void rygel_media_export_music_item_real_commit (RygelUpdatableObject* bas
 }
 
 
-static void rygel_media_export_music_item_real_commit_finish (RygelUpdatableObject* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaExportMusicItemCommitData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_music_item_real_commit_finish (RygelUpdatableObject* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
 }
 
 
@@ -157,27 +148,14 @@ static gboolean rygel_media_export_music_item_real_commit_co (RygelMediaExportMu
 }
 
 
-static void rygel_media_export_music_item_class_init (RygelMediaExportMusicItemClass * klass) {
-	rygel_media_export_music_item_parent_class = g_type_class_peek_parent (klass);
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_music_item_finalize;
+static void rygel_media_export_music_item_class_init (RygelMediaExportMusicItemClass * klass G_GNUC_UNUSED) {
 }
 
 static void rygel_media_export_music_item_rygel_updatable_object_interface_init (RygelUpdatableObjectIface * iface) {
-	rygel_media_export_music_item_rygel_updatable_object_parent_iface = g_type_interface_peek_parent (iface);
-	iface->commit = (void (*)(RygelUpdatableObject*, GError**)) rygel_media_export_music_item_real_commit;
+	iface->commit = rygel_media_export_music_item_real_commit;
 	iface->commit_finish = rygel_media_export_music_item_real_commit_finish;
 }
 
 
-static void rygel_media_export_music_item_init (RygelMediaExportMusicItem * self) {
+static void rygel_media_export_music_item_init (RygelMediaExportMusicItem * self G_GNUC_UNUSED) {
 }
-
-
-static void rygel_media_export_music_item_finalize (GObject* obj) {
-	RygelMediaExportMusicItem * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItem);
-	G_OBJECT_CLASS (rygel_media_export_music_item_parent_class)->finalize (obj);
-}
-
-
-
diff --git a/src/media-export/rygel-media-export-music-item.h b/src/media-export/rygel-media-export-music-item.h
index 494a4a9..4e51454 100644
--- a/src/media-export/rygel-media-export-music-item.h
+++ b/src/media-export/rygel-media-export-music-item.h
@@ -24,11 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
 #include <rygel-server.h>
-#include <gee.h>
 
 G_BEGIN_DECLS
 
@@ -53,9 +49,14 @@ struct _RygelMediaExportMusicItemClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_music_item_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_music_item_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportMusicItem* rygel_media_export_music_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
+RygelMediaExportMusicItem *
+rygel_media_export_music_item_new (const gchar         *id,
+				   RygelMediaContainer *parent,
+				   const gchar         *title,
+				   const gchar         *upnp_class);
 
 G_END_DECLS
 
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 04bcd05..d1f372a 100644
--- a/src/media-export/rygel-media-export-node-query-container.c
+++ b/src/media-export/rygel-media-export-node-query-container.c
@@ -19,6 +19,11 @@
  */
 
 #include "rygel-media-export-node-query-container.h"
+#include "rygel-media-export-query-container-factory.h"
+
+G_DEFINE_TYPE (RygelMediaExportNodeQueryContainer,
+	       rygel_media_export_node_query_container,
+	       RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER)
 
 typedef struct _RygelMediaExportNodeQueryContainerGetChildrenData RygelMediaExportNodeQueryContainerGetChildrenData;
 
@@ -90,17 +95,16 @@ enum  {
   RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_TEMPLATE,
   RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER_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);
+
 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_);
 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);
 
-
-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) {
+static
+RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_construct (GType object_type, RygelSearchExpression* expression, const gchar* id, const gchar* name, const gchar* template, const gchar* attribute) {
 	RygelMediaExportNodeQueryContainer * self = NULL;
-	RygelMediaExportMediaCache* _tmp0_;
 	RygelSearchExpression* _tmp1_;
 	const gchar* _tmp2_;
 	const gchar* _tmp3_;
@@ -109,17 +113,21 @@ RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_cons
 	const gchar* _tmp6_;
 	gchar* _tmp7_;
 	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);
 	g_return_val_if_fail (template != NULL, NULL);
 	g_return_val_if_fail (attribute != NULL, NULL);
-	_tmp0_ = cache;
 	_tmp1_ = expression;
 	_tmp2_ = id;
 	_tmp3_ = name;
-	self = (RygelMediaExportNodeQueryContainer*) rygel_media_export_query_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, _tmp3_);
+	self = RYGEL_MEDIA_EXPORT_NODE_QUERY_CONTAINER (g_object_new (object_type,
+								      "expression", _tmp1_,
+								      "id", _tmp2_,
+								      "title", _tmp3_,
+								      "parent", NULL,
+								      "child-count", 0,
+								      NULL));
 	_tmp4_ = template;
 	_tmp5_ = g_strdup (_tmp4_);
 	g_free (self->priv->template);
@@ -136,7 +144,7 @@ RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_cons
 		if (_inner_error_ != NULL) {
 			goto __catch41_g_error;
 		}
-		((RygelMediaContainer*) self)->child_count = _tmp9_;
+		rygel_media_container_set_child_count ((RygelMediaContainer*) self, _tmp9_);
 	}
 	goto __finally41;
 	__catch41_g_error:
@@ -155,8 +163,8 @@ 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);
+RygelMediaExportNodeQueryContainer* rygel_media_export_node_query_container_new (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, expression, id, name, template, attribute);
 }
 
 
@@ -202,7 +210,7 @@ static void rygel_media_export_node_query_container_real_get_children (RygelMedi
 }
 
 
-static RygelMediaObjects* rygel_media_export_node_query_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
+static RygelMediaObjects* rygel_media_export_node_query_container_real_get_children_finish (RygelMediaContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
 	RygelMediaObjects* result;
 	RygelMediaExportNodeQueryContainerGetChildrenData* _data_;
 	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
@@ -295,7 +303,7 @@ static gboolean rygel_media_export_node_query_container_real_get_children_co (Ry
 	_data_->children = _data_->_tmp0_;
 	_data_->_tmp1_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (_data_->self));
 	_data_->_tmp2_ = _data_->self->priv->attribute;
-	_data_->_tmp3_ = ((RygelMediaExportQueryContainer*) _data_->self)->expression;
+	_data_->_tmp3_ = rygel_media_export_query_container_get_expression ((RygelMediaExportQueryContainer*) _data_->self);
 	_data_->_tmp4_ = _data_->offset;
 	_data_->_tmp5_ = _data_->max_count;
 	_data_->_tmp6_ = NULL;
@@ -355,7 +363,7 @@ static gboolean rygel_media_export_node_query_container_real_get_children_co (Ry
 			_data_->_tmp27_ = rygel_media_export_query_container_factory_create_from_description (_data_->_tmp23_, _data_->_tmp24_, _data_->_tmp25_, _data_->_tmp26_);
 			_data_->container = _data_->_tmp27_;
 			_data_->_tmp28_ = _data_->container;
-			((RygelMediaObject*) _data_->_tmp28_)->parent = (RygelMediaContainer*) _data_->self;
+			rygel_media_object_set_parent ((RygelMediaObject*) _data_->_tmp28_, (RygelMediaContainer*) _data_->self);
 			_data_->_tmp29_ = _data_->container;
 			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->children, (RygelMediaObject*) _data_->_tmp29_);
 			g_object_unref (_data_->container);
@@ -407,7 +415,7 @@ static gint rygel_media_export_node_query_container_real_count_children (RygelMe
 		_tmp0_ = TRUE;
 	} else {
 		RygelSearchExpression* _tmp2_;
-		_tmp2_ = ((RygelMediaExportQueryContainer*) self)->expression;
+		_tmp2_ = rygel_media_export_query_container_get_expression ((RygelMediaExportQueryContainer*) self);
 		_tmp0_ = _tmp2_ == NULL;
 	}
 	_tmp3_ = _tmp0_;
@@ -417,7 +425,7 @@ static gint rygel_media_export_node_query_container_real_count_children (RygelMe
 	}
 	_tmp4_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
 	_tmp5_ = self->priv->attribute;
-	_tmp6_ = ((RygelMediaExportQueryContainer*) self)->expression;
+	_tmp6_ = rygel_media_export_query_container_get_expression ((RygelMediaExportQueryContainer*) self);
 	_tmp7_ = rygel_media_export_media_cache_get_object_attribute_by_search_expression (_tmp4_, _tmp5_, _tmp6_, (glong) 0, (guint) (-1), &_inner_error_);
 	data = _tmp7_;
 	if (_inner_error_ != NULL) {
@@ -434,7 +442,6 @@ static gint rygel_media_export_node_query_container_real_count_children (RygelMe
 
 
 static void rygel_media_export_node_query_container_class_init (RygelMediaExportNodeQueryContainerClass * klass) {
-	rygel_media_export_node_query_container_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (RygelMediaExportNodeQueryContainerPrivate));
 	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children = rygel_media_export_node_query_container_real_get_children;
 	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children_finish = rygel_media_export_node_query_container_real_get_children_finish;
@@ -455,18 +462,3 @@ static void rygel_media_export_node_query_container_finalize (GObject* obj) {
 	g_free (self->priv->attribute);
 	G_OBJECT_CLASS (rygel_media_export_node_query_container_parent_class)->finalize (obj);
 }
-
-
-GType rygel_media_export_node_query_container_get_type (void) {
-	static volatile gsize rygel_media_export_node_query_container_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_node_query_container_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportNodeQueryContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_node_query_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportNodeQueryContainer), 0, (GInstanceInitFunc) rygel_media_export_node_query_container_init, NULL };
-		GType rygel_media_export_node_query_container_type_id;
-		rygel_media_export_node_query_container_type_id = g_type_register_static (RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER, "RygelMediaExportNodeQueryContainer", &g_define_type_info, 0);
-		g_once_init_leave (&rygel_media_export_node_query_container_type_id__volatile, rygel_media_export_node_query_container_type_id);
-	}
-	return rygel_media_export_node_query_container_type_id__volatile;
-}
-
-
-
diff --git a/src/media-export/rygel-media-export-node-query-container.h b/src/media-export/rygel-media-export-node-query-container.h
index 486d774..4ba219f 100644
--- a/src/media-export/rygel-media-export-node-query-container.h
+++ b/src/media-export/rygel-media-export-node-query-container.h
@@ -21,6 +21,9 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NODE_QUERY_CONTAINER_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
 #include "rygel-media-export-query-container.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-null-container.c b/src/media-export/rygel-media-export-null-container.c
index 4f7e90a..39de141 100644
--- a/src/media-export/rygel-media-export-null-container.c
+++ b/src/media-export/rygel-media-export-null-container.c
@@ -52,15 +52,15 @@ rygel_media_export_null_container_real_get_children (RygelMediaContainer *base,
                                                           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_set_op_res_gpointer (simple,
+					     rygel_media_objects_new (),
+					     g_object_unref);
   g_simple_async_result_complete_in_idle (simple);
   g_object_unref (simple);
 }
 
 static RygelMediaObjects *
-rygel_media_export_null_container_real_get_children_finish (RygelMediaContainer  *base,
+rygel_media_export_null_container_real_get_children_finish (RygelMediaContainer  *base G_GNUC_UNUSED,
                                                             GAsyncResult         *res,
                                                             GError              **error) {
   RygelMediaObjects *result;
@@ -92,10 +92,10 @@ rygel_media_export_null_container_real_find_object (RygelMediaContainer *base,
 }
 
 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)) {
+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;
 }
 
diff --git a/src/media-export/rygel-media-export-null-container.h b/src/media-export/rygel-media-export-null-container.h
index 388f18b..5722f6b 100644
--- a/src/media-export/rygel-media-export-null-container.h
+++ b/src/media-export/rygel-media-export-null-container.h
@@ -21,6 +21,8 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NULL_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_NULL_CONTAINER_H__
 
+#include <glib.h>
+#include <glib-object.h>
 #include <rygel-server.h>
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-object-factory.c b/src/media-export/rygel-media-export-object-factory.c
index 349427f..05e413a 100644
--- a/src/media-export/rygel-media-export-object-factory.c
+++ b/src/media-export/rygel-media-export-object-factory.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-object-factory.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-object-factory.vala, do not modify */
-
 /*
  * Copyright (C) 2010 Jens Georg <mail jensge org>.
  *
@@ -23,173 +20,34 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <glib.h>
-#include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-server.h>
-
-
-#define RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY (rygel_media_export_object_factory_get_type ())
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactory))
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
-#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
-#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
-#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
-
-typedef struct _RygelMediaExportObjectFactory RygelMediaExportObjectFactory;
-typedef struct _RygelMediaExportObjectFactoryClass RygelMediaExportObjectFactoryClass;
-typedef struct _RygelMediaExportObjectFactoryPrivate RygelMediaExportObjectFactoryPrivate;
-
-#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_ROOT_CONTAINER (rygel_media_export_root_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainer))
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainerClass))
-
-typedef struct _RygelMediaExportRootContainer RygelMediaExportRootContainer;
-typedef struct _RygelMediaExportRootContainerClass RygelMediaExportRootContainerClass;
-
-#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;
-
-#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_WRITABLE_DB_CONTAINER (rygel_media_export_writable_db_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer))
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
-
-typedef struct _RygelMediaExportWritableDbContainer RygelMediaExportWritableDbContainer;
-typedef struct _RygelMediaExportWritableDbContainerClass RygelMediaExportWritableDbContainerClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM (rygel_media_export_music_item_get_type ())
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItem))
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItemClass))
-#define RYGEL_MEDIA_EXPORT_IS_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM))
-#define RYGEL_MEDIA_EXPORT_IS_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM))
-#define RYGEL_MEDIA_EXPORT_MUSIC_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MUSIC_ITEM, RygelMediaExportMusicItemClass))
-
-typedef struct _RygelMediaExportMusicItem RygelMediaExportMusicItem;
-typedef struct _RygelMediaExportMusicItemClass RygelMediaExportMusicItemClass;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM (rygel_media_export_video_item_get_type ())
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItem))
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))
-#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
-#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
-#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))
-
-typedef struct _RygelMediaExportVideoItem RygelMediaExportVideoItem;
-typedef struct _RygelMediaExportVideoItemClass RygelMediaExportVideoItemClass;
+#include "rygel-media-export-db-container.h"
+#include "rygel-media-export-music-item.h"
+#include "rygel-media-export-photo-item.h"
+#include "rygel-media-export-query-container-factory.h"
+#include "rygel-media-export-query-container.h"
+#include "rygel-media-export-root-container.h"
+#include "rygel-media-export-object-factory.h"
+#include "rygel-media-export-video-item.h"
+#include "rygel-media-export-writable-db-container.h"
 
-#define RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM (rygel_media_export_photo_item_get_type ())
-#define RYGEL_MEDIA_EXPORT_PHOTO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM, RygelMediaExportPhotoItem))
-#define RYGEL_MEDIA_EXPORT_PHOTO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM, RygelMediaExportPhotoItemClass))
-#define RYGEL_MEDIA_EXPORT_IS_PHOTO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM))
-#define RYGEL_MEDIA_EXPORT_IS_PHOTO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM))
-#define RYGEL_MEDIA_EXPORT_PHOTO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_PHOTO_ITEM, RygelMediaExportPhotoItemClass))
+G_DEFINE_TYPE (RygelMediaExportObjectFactory, rygel_media_export_object_factory, G_TYPE_OBJECT)
 
-typedef struct _RygelMediaExportPhotoItem RygelMediaExportPhotoItem;
-typedef struct _RygelMediaExportPhotoItemClass RygelMediaExportPhotoItemClass;
-
-struct _RygelMediaExportObjectFactory {
-	GObject parent_instance;
-	RygelMediaExportObjectFactoryPrivate * priv;
-};
-
-struct _RygelMediaExportObjectFactoryClass {
-	GObjectClass parent_class;
-	RygelMediaExportDBContainer* (*get_container) (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count, const gchar* uri);
-	RygelMediaItem* (*get_item) (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class);
-};
-
-
-static gpointer rygel_media_export_object_factory_parent_class = NULL;
-
-GType rygel_media_export_object_factory_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_db_container_get_type (void) G_GNUC_CONST;
 enum  {
 	RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_DUMMY_PROPERTY
 };
-RygelMediaExportDBContainer* rygel_media_export_object_factory_get_container (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count, const gchar* uri);
 static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_container (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count, const gchar* uri);
-RygelMediaContainer* rygel_media_export_root_container_get_instance (GError** error);
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
-GType rygel_media_export_root_container_get_type (void) G_GNUC_CONST;
-RygelMediaContainer* rygel_media_export_root_container_get_filesystem_container (RygelMediaExportRootContainer* self);
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
-GType rygel_media_export_query_container_factory_get_type (void) G_GNUC_CONST;
-RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_get_default (void);
-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);
-RygelMediaExportDBContainer* rygel_media_export_db_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportDBContainer* rygel_media_export_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-GType rygel_media_export_writable_db_container_get_type (void) G_GNUC_CONST;
-RygelMediaItem* rygel_media_export_object_factory_get_item (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class);
 static RygelMediaItem* rygel_media_export_object_factory_real_get_item (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class);
-RygelMediaExportMusicItem* rygel_media_export_music_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportMusicItem* rygel_media_export_music_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_music_item_get_type (void) G_GNUC_CONST;
-RygelMediaExportVideoItem* rygel_media_export_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportVideoItem* rygel_media_export_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
-RygelMediaExportPhotoItem* rygel_media_export_photo_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-RygelMediaExportPhotoItem* rygel_media_export_photo_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
-GType rygel_media_export_photo_item_get_type (void) G_GNUC_CONST;
-RygelMediaExportObjectFactory* rygel_media_export_object_factory_new (void);
 RygelMediaExportObjectFactory* rygel_media_export_object_factory_construct (GType object_type);
 
 
 /**
-     * Return a new instance of DBContainer
-     *
-     * @param media_db instance of MediaDB
-     * @param title title of the container
-     * @param child_count number of children in the container
-     */
-static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_container (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count, const gchar* uri) {
+ * Return a new instance of DBContainer
+ *
+ * @param media_db instance of MediaDB
+ * @param title title of the container
+ * @param child_count number of children in the container
+ */
+static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_container (RygelMediaExportObjectFactory* self G_GNUC_UNUSED, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title, guint child_count G_GNUC_UNUSED, const gchar* uri) {
 	RygelMediaExportDBContainer* result = NULL;
 	const gchar* _tmp0_;
 	const gchar* _tmp8_;
@@ -289,14 +147,12 @@ static RygelMediaExportDBContainer* rygel_media_export_object_factory_real_get_c
 	}
 	_tmp16_ = uri;
 	if (_tmp16_ == NULL) {
-		RygelMediaExportMediaCache* _tmp17_;
 		const gchar* _tmp18_;
 		const gchar* _tmp19_;
 		RygelMediaExportDBContainer* _tmp20_;
-		_tmp17_ = media_db;
 		_tmp18_ = id;
 		_tmp19_ = title;
-		_tmp20_ = rygel_media_export_db_container_new (_tmp17_, _tmp18_, _tmp19_);
+		_tmp20_ = rygel_media_export_db_container_new (_tmp18_, _tmp19_);
 		result = _tmp20_;
 		return result;
 	}
@@ -323,7 +179,7 @@ RygelMediaExportDBContainer* rygel_media_export_object_factory_get_container (Ry
      * @param title title of the item
      * @param upnp_class upnp_class of the item
      */
-static RygelMediaItem* rygel_media_export_object_factory_real_get_item (RygelMediaExportObjectFactory* self, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class) {
+static RygelMediaItem* rygel_media_export_object_factory_real_get_item (RygelMediaExportObjectFactory* self G_GNUC_UNUSED, RygelMediaExportMediaCache* media_db, RygelMediaContainer* parent, const gchar* id, const gchar* title, const gchar* upnp_class) {
 	RygelMediaItem* result = NULL;
 	const gchar* _tmp0_;
 	const gchar* _tmp1_;
@@ -414,26 +270,10 @@ RygelMediaExportObjectFactory* rygel_media_export_object_factory_new (void) {
 
 
 static void rygel_media_export_object_factory_class_init (RygelMediaExportObjectFactoryClass * klass) {
-	rygel_media_export_object_factory_parent_class = g_type_class_peek_parent (klass);
 	RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_CLASS (klass)->get_container = rygel_media_export_object_factory_real_get_container;
 	RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_CLASS (klass)->get_item = rygel_media_export_object_factory_real_get_item;
 }
 
 
-static void rygel_media_export_object_factory_init (RygelMediaExportObjectFactory * self) {
+static void rygel_media_export_object_factory_init (RygelMediaExportObjectFactory * self G_GNUC_UNUSED) {
 }
-
-
-GType rygel_media_export_object_factory_get_type (void) {
-	static volatile gsize rygel_media_export_object_factory_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_object_factory_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportObjectFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_object_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportObjectFactory), 0, (GInstanceInitFunc) rygel_media_export_object_factory_init, NULL };
-		GType rygel_media_export_object_factory_type_id;
-		rygel_media_export_object_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelMediaExportObjectFactory", &g_define_type_info, 0);
-		g_once_init_leave (&rygel_media_export_object_factory_type_id__volatile, rygel_media_export_object_factory_type_id);
-	}
-	return rygel_media_export_object_factory_type_id__volatile;
-}
-
-
-
diff --git a/src/media-export/rygel-media-export-object-factory.h b/src/media-export/rygel-media-export-object-factory.h
new file mode 100644
index 0000000..6478c99
--- /dev/null
+++ b/src/media-export/rygel-media-export-object-factory.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2010 Jens Georg <mail jensge org>.
+ *
+ * Author: 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_OBJECT_FACTORY_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_OBJECT_FACTORY_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <rygel-server.h>
+
+#include "rygel-media-export-db-container.h"
+#include "rygel-media-export-media-cache.h"
+
+G_BEGIN_DECLS
+
+#define RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY (rygel_media_export_object_factory_get_type ())
+#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactory))
+#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
+#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
+#define RYGEL_MEDIA_EXPORT_IS_OBJECT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY))
+#define RYGEL_MEDIA_EXPORT_OBJECT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_OBJECT_FACTORY, RygelMediaExportObjectFactoryClass))
+
+typedef struct _RygelMediaExportObjectFactory RygelMediaExportObjectFactory;
+typedef struct _RygelMediaExportObjectFactoryClass RygelMediaExportObjectFactoryClass;
+typedef struct _RygelMediaExportObjectFactoryPrivate RygelMediaExportObjectFactoryPrivate;
+
+struct _RygelMediaExportObjectFactory {
+  GObject parent_instance;
+  RygelMediaExportObjectFactoryPrivate *priv;
+};
+
+struct _RygelMediaExportObjectFactoryClass {
+  GObjectClass parent_class;
+  RygelMediaExportDBContainer* (* get_container) (RygelMediaExportObjectFactory *self,
+                                                  RygelMediaExportMediaCache    *media_db,
+                                                  const gchar                   *id,
+                                                  const gchar                   *title,
+                                                  guint                          child_count,
+                                                  const gchar                   *uri);
+  RygelMediaItem* (* get_item) (RygelMediaExportObjectFactory *self,
+                                RygelMediaExportMediaCache    *media_db,
+                                RygelMediaContainer           *parent,
+                                const gchar                   *id,
+                                const gchar                   *title,
+                                const gchar                   *upnp_class);
+};
+
+GType
+rygel_media_export_object_factory_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportDBContainer *
+rygel_media_export_object_factory_get_container (RygelMediaExportObjectFactory* self,
+                                                 RygelMediaExportMediaCache* media_db,
+                                                 const gchar* id,
+                                                 const gchar* title,
+                                                 guint child_count,
+                                                 const gchar* uri);
+
+RygelMediaItem *
+rygel_media_export_object_factory_get_item (RygelMediaExportObjectFactory *self,
+                                            RygelMediaExportMediaCache    *media_db,
+                                            RygelMediaContainer           *parent,
+                                            const gchar                   *id,
+                                            const gchar                   *title,
+                                            const gchar                   *upnp_class);
+
+RygelMediaExportObjectFactory *
+rygel_media_export_object_factory_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/src/media-export/rygel-media-export-photo-item.c b/src/media-export/rygel-media-export-photo-item.c
index e2f0e5c..c112954 100644
--- a/src/media-export/rygel-media-export-photo-item.c
+++ b/src/media-export/rygel-media-export-photo-item.c
@@ -23,7 +23,6 @@
 #include "rygel-media-export-photo-item.h"
 #include "rygel-media-export-media-cache.h"
 
-
 static void rygel_media_export_photo_item_rygel_updatable_object_interface_init (RygelUpdatableObjectIface * iface);
 
 G_DEFINE_TYPE_WITH_CODE (RygelMediaExportPhotoItem, rygel_media_export_photo_item, RYGEL_TYPE_PHOTO_ITEM,
@@ -43,8 +42,6 @@ struct _RygelMediaExportPhotoItemCommitData {
 	GError * _inner_error_;
 };
 
-static RygelUpdatableObjectIface* rygel_media_export_photo_item_rygel_updatable_object_parent_iface = NULL;
-
 RygelMediaExportPhotoItem* rygel_media_export_photo_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
 static void rygel_media_export_photo_item_real_commit_data_free (gpointer _data);
 static void rygel_media_export_photo_item_real_commit (RygelUpdatableObject* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -99,12 +96,8 @@ static void rygel_media_export_photo_item_real_commit (RygelUpdatableObject* bas
 }
 
 
-static void rygel_media_export_photo_item_real_commit_finish (RygelUpdatableObject* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaExportPhotoItemCommitData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_photo_item_real_commit_finish (RygelUpdatableObject* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
 }
 
 
@@ -161,14 +154,10 @@ static void rygel_media_export_photo_item_class_init (RygelMediaExportPhotoItemC
 
 
 static void rygel_media_export_photo_item_rygel_updatable_object_interface_init (RygelUpdatableObjectIface * iface) {
-	rygel_media_export_photo_item_rygel_updatable_object_parent_iface = g_type_interface_peek_parent (iface);
-	iface->commit = (void (*)(RygelUpdatableObject*, GError**)) rygel_media_export_photo_item_real_commit;
+	iface->commit = rygel_media_export_photo_item_real_commit;
 	iface->commit_finish = rygel_media_export_photo_item_real_commit_finish;
 }
 
 
-static void rygel_media_export_photo_item_init (RygelMediaExportPhotoItem * self) {
+static void rygel_media_export_photo_item_init (RygelMediaExportPhotoItem * self G_GNUC_UNUSED) {
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-photo-item.h b/src/media-export/rygel-media-export-photo-item.h
index e81b8df..697331d 100644
--- a/src/media-export/rygel-media-export-photo-item.h
+++ b/src/media-export/rygel-media-export-photo-item.h
@@ -22,6 +22,8 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_PHOTO_ITEM_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_PHOTO_ITEM_H__
 
+#include <glib.h>
+#include <glib-object.h>
 #include <rygel-server.h>
 
 G_BEGIN_DECLS
@@ -43,12 +45,17 @@ struct _RygelMediaExportPhotoItem {
 };
 
 struct _RygelMediaExportPhotoItemClass {
-  GObjectClass parent_class;
+  RygelPhotoItemClass parent_class;
 };
 
-GType rygel_media_export_photo_item_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_photo_item_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportPhotoItem* rygel_media_export_photo_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
+RygelMediaExportPhotoItem *
+rygel_media_export_photo_item_new (const gchar          *id,
+				    RygelMediaContainer *parent,
+				    const gchar         *title,
+				    const gchar         *upnp_class);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-plugin.c b/src/media-export/rygel-media-export-plugin.c
index f9438e8..c2aa945 100644
--- a/src/media-export/rygel-media-export-plugin.c
+++ b/src/media-export/rygel-media-export-plugin.c
@@ -38,18 +38,11 @@ struct _Block2Data {
 	RygelPlugin* our_plugin;
 };
 
-static Block1Data* block1_data_ref (Block1Data* _data1_);
 static void block1_data_unref (void * _userdata_);
 #define RYGEL_MEDIA_EXPORT_PLUGIN_NAME "MediaExport"
 RygelMediaExportPlugin* rygel_media_export_plugin_new (GError** error);
 RygelMediaExportPlugin* rygel_media_export_plugin_construct (GType object_type, GError** error);
 
-static Block1Data* block1_data_ref (Block1Data* _data1_) {
-	g_atomic_int_inc (&_data1_->_ref_count_);
-	return _data1_;
-}
-
-
 static void block1_data_unref (void * _userdata_) {
 	Block1Data* _data1_;
 	_data1_ = (Block1Data*) _userdata_;
@@ -71,15 +64,12 @@ void module_init (RygelPluginLoader* loader) {
 	RygelPluginLoader* _tmp1_;
 	RygelPluginLoader* _tmp2_;
 	gboolean _tmp3_ = FALSE;
-	RygelPluginLoader* _tmp8_;
-	RygelMediaExportPlugin* _tmp9_;
 	GError * _inner_error_ = NULL;
 	g_return_if_fail (loader != NULL);
 	_data1_ = g_slice_new0 (Block1Data);
 	_data1_->_ref_count_ = 1;
 	_tmp0_ = loader;
 	_tmp1_ = g_object_ref (_tmp0_);
-	g_object_unref (_data1_->loader);
 	_data1_->loader = _tmp1_;
 	_tmp2_ = _data1_->loader;
 	_tmp3_ = rygel_plugin_loader_plugin_disabled (_tmp2_, RYGEL_MEDIA_EXPORT_PLUGIN_NAME);
@@ -98,7 +88,6 @@ void module_init (RygelPluginLoader* loader) {
 		if (_inner_error_ != NULL) {
 			goto __catch0_g_error;
 		}
-		g_object_unref (_data1_->plugin);
 		_data1_->plugin = _tmp5_;
 	}
 	goto __finally0;
@@ -126,6 +115,8 @@ void module_init (RygelPluginLoader* loader) {
 		g_clear_error (&_inner_error_);
 		return;
 	}
+	rygel_plugin_loader_add_plugin (loader, (RygelPlugin*) _data1_->plugin);
+	block1_data_unref (_data1_);
 }
 
 RygelMediaExportPlugin* rygel_media_export_plugin_construct (GType object_type, GError** error) {
@@ -158,7 +149,5 @@ static void rygel_media_export_plugin_class_init (RygelMediaExportPluginClass *
 }
 
 
-static void rygel_media_export_plugin_init (RygelMediaExportPlugin * self) {
+static void rygel_media_export_plugin_init (RygelMediaExportPlugin * self G_GNUC_UNUSED) {
 }
-
-
diff --git a/src/media-export/rygel-media-export-plugin.h b/src/media-export/rygel-media-export-plugin.h
index f7b4e90..d51a0c0 100644
--- a/src/media-export/rygel-media-export-plugin.h
+++ b/src/media-export/rygel-media-export-plugin.h
@@ -21,6 +21,10 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_PLUGIN_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_PLUGIN_H__
 
+#include <glib.h>
+#include <glib-object.h>
+#include <rygel-server.h>
+
 #include "rygel-media-export-db-container.h"
 
 G_BEGIN_DECLS
@@ -37,19 +41,22 @@ typedef struct _RygelMediaExportPluginClass RygelMediaExportPluginClass;
 typedef struct _RygelMediaExportPluginPrivate RygelMediaExportPluginPrivate;
 
 struct _RygelMediaExportPlugin {
-  RygelMediaEngine parent_instance;
+  RygelMediaServerPlugin parent_instance;
   RygelMediaExportPluginPrivate *priv;
 };
 
 struct _RygelMediaExportPluginClass {
-  RygelMediaEngineClass parent_class;
+  RygelMediaServerPluginClass parent_class;
 };
 
-GType rygel_media_export_plugin_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_plugin_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportPlugin* rygel_media_export_plugin_new (GError** error);
+RygelMediaExportPlugin *
+rygel_media_export_plugin_new (GError **error);
 
-void module_init (RygelPluginLoader* loader);
+void
+module_init (RygelPluginLoader *loader);
 
 
 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 111df1f..e4aa53a 100644
--- a/src/media-export/rygel-media-export-query-container-factory.c
+++ b/src/media-export/rygel-media-export-query-container-factory.c
@@ -21,14 +21,9 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <glib.h>
-#include <glib-object.h>
-#include <gee.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-server.h>
-#include <libgupnp-av/gupnp-av.h>
-
+#include "rygel-media-export-leaf-query-container.h"
+#include "rygel-media-export-node-query-container.h"
+#include "rygel-media-export-query-container-factory.h"
 
 typedef struct _RygelMediaExportQueryContainerFactory RygelMediaExportQueryContainerFactory;
 typedef struct _RygelMediaExportQueryContainerFactoryClass RygelMediaExportQueryContainerFactoryClass;
@@ -351,33 +346,29 @@ RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_creat
 	}
 	_tmp12_ = _tmp9_;
 	if (_tmp12_) {
-		RygelMediaExportMediaCache* _tmp13_;
 		RygelSearchExpression* _tmp14_;
 		const gchar* _tmp15_;
 		const gchar* _tmp16_;
 		RygelMediaExportLeafQueryContainer* _tmp17_;
-		_tmp13_ = cache;
 		_tmp14_ = expression;
 		_tmp15_ = id;
 		_tmp16_ = title;
-		_tmp17_ = rygel_media_export_leaf_query_container_new (_tmp13_, _tmp14_, _tmp15_, _tmp16_);
+		_tmp17_ = rygel_media_export_leaf_query_container_new (_tmp14_, _tmp15_, _tmp16_);
 		g_object_unref (container);
 		container = (RygelMediaExportQueryContainer*) _tmp17_;
 	} else {
-		RygelMediaExportMediaCache* _tmp18_;
 		RygelSearchExpression* _tmp19_;
 		const gchar* _tmp20_;
 		const gchar* _tmp21_;
 		const gchar* _tmp22_;
 		const gchar* _tmp23_;
 		RygelMediaExportNodeQueryContainer* _tmp24_;
-		_tmp18_ = cache;
 		_tmp19_ = expression;
 		_tmp20_ = id;
 		_tmp21_ = title;
 		_tmp22_ = pattern;
 		_tmp23_ = attribute;
-		_tmp24_ = rygel_media_export_node_query_container_new (_tmp18_, _tmp19_, _tmp20_, _tmp21_, _tmp22_, _tmp23_);
+		_tmp24_ = rygel_media_export_node_query_container_new (_tmp19_, _tmp20_, _tmp21_, _tmp22_, _tmp23_);
 		g_object_unref (container);
 		container = (RygelMediaExportQueryContainer*) _tmp24_;
 	}
@@ -499,7 +490,6 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 	gchar** _tmp2_ = NULL;
 	gchar** args;
 	gint args_length1;
-	gint _args_size_;
 	RygelSearchExpression* _tmp3_;
 	RygelSearchExpression* expression;
 	gint i;
@@ -510,7 +500,6 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 	_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, ",", 0);
 	args = _tmp2_;
 	args_length1 = _vala_array_length (_tmp1_);
-	_args_size_ = args_length1;
 	_tmp3_ = _rygel_search_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (NULL, RYGEL_TYPE_SEARCH_EXPRESSION) ? ((RygelSearchExpression*) NULL) : NULL);
 	expression = _tmp3_;
 	g_free (_vala_pattern);
@@ -522,25 +511,21 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 	i = 0;
 	while (TRUE) {
 		gint _tmp4_;
-		gchar** _tmp5_;
 		gint _tmp5__length1;
 		const gchar* _tmp6_;
 		gchar* _tmp7_;
 		gchar* previous_attribute;
 		gchar** _tmp8_;
-		gint _tmp8__length1;
 		gint _tmp9_;
 		const gchar* _tmp10_;
 		gchar* _tmp11_ = NULL;
 		const gchar* _tmp12_;
 		gchar* _tmp13_ = NULL;
 		gchar** _tmp14_;
-		gint _tmp14__length1;
 		gint _tmp15_;
 		const gchar* _tmp16_;
 		gint _tmp43_;
 		_tmp4_ = i;
-		_tmp5_ = args;
 		_tmp5__length1 = args_length1;
 		if (!(_tmp4_ < _tmp5__length1)) {
 			break;
@@ -549,7 +534,6 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 		_tmp7_ = g_strdup (_tmp6_);
 		previous_attribute = _tmp7_;
 		_tmp8_ = args;
-		_tmp8__length1 = args_length1;
 		_tmp9_ = i;
 		_tmp10_ = _tmp8_[_tmp9_];
 		_tmp11_ = string_replace (_tmp10_, RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, "");
@@ -560,32 +544,25 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 		g_free (_vala_attribute);
 		_vala_attribute = _tmp13_;
 		_tmp14_ = args;
-		_tmp14__length1 = args_length1;
 		_tmp15_ = i;
 		_tmp16_ = _tmp14_[_tmp15_ + 1];
 		if (g_strcmp0 (_tmp16_, "?") != 0) {
 			gchar** _tmp17_;
-			gint _tmp17__length1;
 			gint _tmp18_;
 			const gchar* _tmp19_;
 			gchar** _tmp20_;
-			gint _tmp20__length1;
 			gint _tmp21_;
 			const gchar* _tmp22_;
 			gint _tmp23_;
-			gchar** _tmp24_;
 			gint _tmp24__length1;
 			_tmp17_ = args;
-			_tmp17__length1 = args_length1;
 			_tmp18_ = i;
 			_tmp19_ = _tmp17_[_tmp18_];
 			_tmp20_ = args;
-			_tmp20__length1 = args_length1;
 			_tmp21_ = i;
 			_tmp22_ = _tmp20_[_tmp21_ + 1];
 			rygel_media_export_query_container_factory_update_search_expression (self, &expression, _tmp19_, _tmp22_);
 			_tmp23_ = i;
-			_tmp24_ = args;
 			_tmp24__length1 = args_length1;
 			if ((_tmp23_ + 2) == _tmp24__length1) {
 				const gchar* _tmp25_;
@@ -597,12 +574,9 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 			}
 		} else {
 			gchar** _tmp27_;
-			gint _tmp27__length1;
 			gint _tmp28_;
 			gchar* _tmp29_;
-			gchar* _tmp30_;
 			gchar** _tmp31_;
-			gint _tmp31__length1;
 			gchar* _tmp32_ = NULL;
 			const gchar* _tmp33_;
 			gchar* _tmp34_ = NULL;
@@ -610,14 +584,11 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 			const gchar* _tmp36_;
 			gboolean _tmp38_;
 			_tmp27_ = args;
-			_tmp27__length1 = args_length1;
 			_tmp28_ = i;
 			_tmp29_ = g_strdup ("%s");
 			g_free (_tmp27_[_tmp28_ + 1]);
 			_tmp27_[_tmp28_ + 1] = _tmp29_;
-			_tmp30_ = _tmp27_[_tmp28_ + 1];
 			_tmp31_ = args;
-			_tmp31__length1 = args_length1;
 			_tmp32_ = g_strjoinv (",", _tmp31_);
 			g_free (_vala_pattern);
 			_vala_pattern = _tmp32_;
@@ -636,12 +607,10 @@ static RygelSearchExpression* rygel_media_export_query_container_factory_parse_d
 			_tmp38_ = _tmp35_;
 			if (_tmp38_) {
 				gchar** _tmp39_;
-				gint _tmp39__length1;
 				gint _tmp40_;
 				const gchar* _tmp41_;
 				gchar* _tmp42_ = NULL;
 				_tmp39_ = args;
-				_tmp39__length1 = args_length1;
 				_tmp40_ = i;
 				_tmp41_ = _tmp39_[_tmp40_ - 1];
 				_tmp42_ = g_uri_unescape_string (_tmp41_, NULL);
diff --git a/src/media-export/rygel-media-export-query-container-factory.h b/src/media-export/rygel-media-export-query-container-factory.h
index d9fd9e5..0ea8362 100644
--- a/src/media-export/rygel-media-export-query-container-factory.h
+++ b/src/media-export/rygel-media-export-query-container-factory.h
@@ -18,9 +18,13 @@
  * 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__
+#ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
+#include "rygel-media-export-media-cache.h"
 #include "rygel-media-export-query-container.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-query-container.c b/src/media-export/rygel-media-export-query-container.c
index a46e431..7ca5064 100644
--- a/src/media-export/rygel-media-export-query-container.c
+++ b/src/media-export/rygel-media-export-query-container.c
@@ -19,6 +19,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "rygel-media-export-errors.h"
 #include "rygel-media-export-query-container.h"
 
 static void
@@ -64,7 +65,7 @@ rygel_media_export_query_container_constructed (GObject *object)
     g_error_free (error);
     child_count = 0;
   }
-  RYGEL_MEDIA_CONTAINER (self)->child_count = child_count;
+  rygel_media_container_set_child_count (RYGEL_MEDIA_CONTAINER (self), child_count);
 }
 
 static void
@@ -78,33 +79,33 @@ rygel_media_export_query_container_real_search_data_free (gpointer user_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) {
+rygel_media_export_query_container_real_search (RygelSearchableContainer *base,
+                                                RygelSearchExpression    *expression,
+                                                guint                     offset,
+                                                guint                     max_count,
+                                                const gchar              *sort_criteria,
+                                                GCancellable             *cancellable G_GNUC_UNUSED,
+                                                GAsyncReadyCallback       callback,
+                                                gpointer                  user_data) {
   RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (base);
   GSimpleAsyncResult *simple;
   guint matches = 0;
   RygelMediaObjects *objects;
-  RygelSearchExpression *combined_expression;
+  RygelSearchExpression *combined;
   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);
+    combined = rygel_search_expression_ref (self->priv->expression);
   } else {
-    combined = rygel_logical_expression_new ();
+    combined = RYGEL_SEARCH_EXPRESSION (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);
   }
 
   objects = rygel_media_export_media_cache_get_objects_by_search_expression (cache,
-                                                                             combined_expression,
+                                                                             combined,
                                                                              NULL,
                                                                              sort_criteria,
                                                                              offset,
@@ -115,7 +116,7 @@ rygel_media_export_query_container_real_search (RygelMediaExportSearchableContai
   if (error) {
     if (g_error_matches (error,
                          RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR,
-                         RYGEL_MEDIA_EXPORT_MEDIA_CACHE_UNSUPPORTED_SEARCH)) {
+                         RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH)) {
       objects = rygel_media_objects_new ();
       matches = 0;
       g_error_free (error);
@@ -137,21 +138,21 @@ rygel_media_export_query_container_real_search (RygelMediaExportSearchableContai
                                         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_set_op_res_gpointer (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);
+  rygel_search_expression_unref (combined);
 }
 
 
 static RygelMediaObjects *
-rygel_media_export_query_container_real_search_finish (RygelMediaExportDBContainer  *base,
-                                                       GAsyncResult                 *res,
-                                                       guint                        *total_matches,
-                                                       GError                      **error) {
+rygel_media_export_query_container_real_search_finish (RygelSearchableContainer  *base G_GNUC_UNUSED,
+                                                       GAsyncResult              *res,
+                                                       guint                     *total_matches,
+                                                       GError                   **error) {
   RygelMediaObjects* result;
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
   RygelMediaExportQueryContainerSearchData* data;
@@ -170,7 +171,7 @@ rygel_media_export_query_container_real_search_finish (RygelMediaExportDBContain
 }
 
 static gint
-rygel_media_export_query_container_real_count_children (RygelMediaExportQueryContainer* self, GError** error) {
+rygel_media_export_query_container_real_count_children (RygelMediaExportQueryContainer* self, GError** error G_GNUC_UNUSED) {
   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;
@@ -193,7 +194,7 @@ static void rygel_media_export_query_container_dispose (GObject *object) {
     RygelSearchExpression *expression = priv->expression;
 
     priv->expression = NULL;
-    rygel_search_expression_unref (priv->expression);
+    rygel_search_expression_unref (expression);
   }
   G_OBJECT_CLASS (rygel_media_export_query_container_parent_class)->dispose (object);
 }
@@ -203,7 +204,7 @@ rygel_media_export_query_container_get_property (GObject    *object,
                                                  guint       property_id,
                                                  GValue     *value,
                                                  GParamSpec *pspec) {
-  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_DB_CONTAINER (object);
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (object);
   RygelMediaExportQueryContainerPrivate *priv = self->priv;
 
   switch (property_id) {
@@ -222,8 +223,8 @@ 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;
+  RygelMediaExportQueryContainer *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (object);
+  RygelMediaExportQueryContainerPrivate *priv = self->priv;
 
   switch (property_id) {
   case RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_EXPRESSION:
@@ -245,15 +246,15 @@ rygel_media_export_query_container_class_init (RygelMediaExportQueryContainerCla
   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;
+  object_class->set_property = rygel_media_export_query_container_set_property;
+  object_class->get_property = rygel_media_export_query_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,
+                                                                       RYGEL_TYPE_SEARCH_EXPRESSION,
                                                                        G_PARAM_STATIC_NAME |
                                                                        G_PARAM_STATIC_NICK |
                                                                        G_PARAM_STATIC_BLURB |
@@ -261,7 +262,7 @@ rygel_media_export_query_container_class_init (RygelMediaExportQueryContainerCla
                                                                        G_PARAM_WRITABLE |
                                                                        G_PARAM_CONSTRUCT_ONLY));
 
-  g_type_class_add_private (klass,
+  g_type_class_add_private (query_container_class,
                             sizeof (RygelMediaExportQueryContainerPrivate));
 }
 
diff --git a/src/media-export/rygel-media-export-query-container.h b/src/media-export/rygel-media-export-query-container.h
index fe11c25..410c802 100644
--- a/src/media-export/rygel-media-export-query-container.h
+++ b/src/media-export/rygel-media-export-query-container.h
@@ -22,6 +22,9 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_QUERY_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_QUERY_CONTAINER_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
 #include "rygel-media-export-db-container.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-recursive-file-monitor.c b/src/media-export/rygel-media-export-recursive-file-monitor.c
index 0be16c7..e026df1 100644
--- a/src/media-export/rygel-media-export-recursive-file-monitor.c
+++ b/src/media-export/rygel-media-export-recursive-file-monitor.c
@@ -73,12 +73,7 @@ struct _RygelMediaExportRecursiveFileMonitorAddData {
 
 #define RYGEL_MEDIA_EXPORT_RECURSIVE_FILE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, RygelMediaExportRecursiveFileMonitorPrivate))
 
-RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_construct (GType object_type, GCancellable* cancellable);
-void rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursiveFileMonitor* self);
 static void _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled (GCancellable* _sender, gpointer self);
-void rygel_media_export_recursive_file_monitor_on_monitor_changed (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GFile* other_file, GFileMonitorEvent event_type);
-void rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFileMonitor* self, GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_);
-void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self, GAsyncResult* _res_);
 static void _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
 static void rygel_media_export_recursive_file_monitor_add_data_free (gpointer _data);
 static gboolean rygel_media_export_recursive_file_monitor_add_co (RygelMediaExportRecursiveFileMonitorAddData* _data_);
@@ -87,11 +82,11 @@ static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure
 static void rygel_media_export_recursive_file_monitor_finalize (GObject* obj);
 
 
-static void _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled (GCancellable* _sender, gpointer self) {
+static void _rygel_media_export_recursive_file_monitor_cancel_g_cancellable_cancelled (GCancellable* _sender G_GNUC_UNUSED, gpointer self) {
 	rygel_media_export_recursive_file_monitor_cancel (self);
 }
 
-
+static
 RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_construct (GType object_type, GCancellable* cancellable) {
 	RygelMediaExportRecursiveFileMonitor * self = NULL;
 	gboolean _tmp3_;
@@ -161,7 +156,7 @@ RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_
 }
 
 
-static void _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
+static void _rygel_media_export_recursive_file_monitor_on_monitor_changed_g_file_monitor_changed (GFileMonitor* _sender G_GNUC_UNUSED, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
 	rygel_media_export_recursive_file_monitor_on_monitor_changed (self, file, other_file, event_type);
 }
 
@@ -260,9 +255,7 @@ void rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFil
 }
 
 
-void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self, GAsyncResult* _res_) {
-	RygelMediaExportRecursiveFileMonitorAddData* _data_;
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+void rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor* self G_GNUC_UNUSED, GAsyncResult* _res_ G_GNUC_UNUSED) {
 }
 
 
@@ -383,7 +376,7 @@ void rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursive
 		GeeIterator* _tmp5_;
 		GeeIterator* _monitor_it;
 		_tmp0_ = self->priv->monitors;
-		_tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
+		_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
 		_tmp2_ = _tmp1_;
 		_tmp3_ = _tmp2_;
 		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
@@ -416,7 +409,7 @@ void rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursive
 }
 
 
-static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
+static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure, GValue * return_value G_GNUC_UNUSED, guint n_param_values, const GValue * param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) {
 	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT_ENUM) (gpointer data1, gpointer arg_1, gpointer arg_2, gint arg_3, gpointer data2);
 	register GMarshalFunc_VOID__OBJECT_OBJECT_ENUM callback;
 	register GCClosure * cc;
@@ -437,7 +430,6 @@ static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM (GClosure * closure
 
 
 static void rygel_media_export_recursive_file_monitor_class_init (RygelMediaExportRecursiveFileMonitorClass * klass) {
-	rygel_media_export_recursive_file_monitor_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (RygelMediaExportRecursiveFileMonitorPrivate));
 	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_recursive_file_monitor_finalize;
 	g_signal_new ("changed", RYGEL_MEDIA_EXPORT_TYPE_RECURSIVE_FILE_MONITOR, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT_ENUM, G_TYPE_NONE, 3, G_TYPE_FILE, G_TYPE_FILE, g_file_monitor_event_get_type ());
@@ -456,6 +448,3 @@ static void rygel_media_export_recursive_file_monitor_finalize (GObject* obj) {
 	g_object_unref (self->priv->monitors);
 	G_OBJECT_CLASS (rygel_media_export_recursive_file_monitor_parent_class)->finalize (obj);
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-recursive-file-monitor.h b/src/media-export/rygel-media-export-recursive-file-monitor.h
index 330ac3d..2e3358c 100644
--- a/src/media-export/rygel-media-export-recursive-file-monitor.h
+++ b/src/media-export/rygel-media-export-recursive-file-monitor.h
@@ -52,9 +52,31 @@ struct _RygelMediaExportRecursiveFileMonitorClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_recursive_file_monitor_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_recursive_file_monitor_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportRecursiveFileMonitor* rygel_media_export_recursive_file_monitor_new (GCancellable* cancellable);
+RygelMediaExportRecursiveFileMonitor *
+rygel_media_export_recursive_file_monitor_new (GCancellable *cancellable);
+
+void
+rygel_media_export_recursive_file_monitor_cancel (RygelMediaExportRecursiveFileMonitor *self);
+
+/* TODO: This does not look like public API to me. */
+void
+rygel_media_export_recursive_file_monitor_on_monitor_changed (RygelMediaExportRecursiveFileMonitor *self,
+							      GFile                                *file,
+							      GFile                                *other_file,
+							      GFileMonitorEvent                     event_type);
+
+void
+rygel_media_export_recursive_file_monitor_add (RygelMediaExportRecursiveFileMonitor *self,
+					       GFile                                *file,
+					       GAsyncReadyCallback                   callback,
+					       gpointer                              user_data);
+
+void
+rygel_media_export_recursive_file_monitor_add_finish (RygelMediaExportRecursiveFileMonitor *self,
+						      GAsyncResult                         *res);
 
 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 b4b1d5a..684fe8f 100644
--- a/src/media-export/rygel-media-export-root-container.c
+++ b/src/media-export/rygel-media-export-root-container.c
@@ -18,64 +18,30 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <glib/gi18n-lib.h>
+
+#include "rygel-media-export-errors.h"
+#include "rygel-media-export-harvester.h"
+#include "rygel-media-export-null-container.h"
+#include "rygel-media-export-query-container-factory.h"
+#include "rygel-media-export-query-container.h"
 #include "rygel-media-export-root-container.h"
-#include "rygel-media-export-database.h"
 
 /**
  * Represents the root container.
  */
 
 static void
-rygel_media_export_root_container_searchable_container_interface_init (RygelSearchableContainerIface *iface);
+rygel_media_export_root_container_rygel_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))
+						rygel_media_export_root_container_rygel_searchable_container_interface_init))
 
 #define RYGEL_MEDIA_EXPORT_TYPE_FOLDER_DEFINITION (rygel_media_export_folder_definition_get_type ())
 typedef struct _RygelMediaExportFolderDefinition RygelMediaExportFolderDefinition;
-
-#define RYGEL_MEDIA_EXPORT_TYPE_HARVESTER (rygel_media_export_harvester_get_type ())
-#define RYGEL_MEDIA_EXPORT_HARVESTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER, RygelMediaExportHarvester))
-#define RYGEL_MEDIA_EXPORT_HARVESTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER, RygelMediaExportHarvesterClass))
-#define RYGEL_MEDIA_EXPORT_IS_HARVESTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER))
-#define RYGEL_MEDIA_EXPORT_IS_HARVESTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER))
-#define RYGEL_MEDIA_EXPORT_HARVESTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_HARVESTER, RygelMediaExportHarvesterClass))
-
-typedef struct _RygelMediaExportHarvester RygelMediaExportHarvester;
-typedef struct _RygelMediaExportHarvesterClass RygelMediaExportHarvesterClass;
-
-#define RYGEL_TYPE_NULL_CONTAINER (rygel_null_container_get_type ())
-#define RYGEL_NULL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainer))
-#define RYGEL_NULL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainerClass))
-#define RYGEL_IS_NULL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_NULL_CONTAINER))
-#define RYGEL_IS_NULL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_NULL_CONTAINER))
-#define RYGEL_NULL_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_NULL_CONTAINER, RygelNullContainerClass))
-
-typedef struct _RygelNullContainer RygelNullContainer;
-typedef struct _RygelNullContainerClass RygelNullContainerClass;
-
-#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;
-
-#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 _RygelMediaExportRootContainerFindObjectData RygelMediaExportRootContainerFindObjectData;
 #define rygel_search_expression_unref(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
 typedef struct _RygelMediaExportRootContainerSearchData RygelMediaExportRootContainerSearchData;
@@ -200,76 +166,42 @@ struct _RygelMediaExportRootContainerSearchData {
 };
 
 
-static RygelMediaContainer* rygel_media_export_root_container_instance;
 static RygelMediaContainer* rygel_media_export_root_container_instance = NULL;
-static GError* rygel_media_export_root_container_creation_error;
 static GError* rygel_media_export_root_container_creation_error = NULL;
+static RygelSearchableContainerIface *parent_searchable_container_iface = NULL;
 
 GType rygel_media_export_folder_definition_get_type (void) G_GNUC_CONST;
 RygelMediaExportFolderDefinition* rygel_media_export_folder_definition_dup (const RygelMediaExportFolderDefinition* self);
 void rygel_media_export_folder_definition_free (RygelMediaExportFolderDefinition* self);
 void rygel_media_export_folder_definition_copy (const RygelMediaExportFolderDefinition* self, RygelMediaExportFolderDefinition* dest);
 void rygel_media_export_folder_definition_destroy (RygelMediaExportFolderDefinition* self);
-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_root_container_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_harvester_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainerPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_DUMMY_PROPERTY
 };
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_NAME "Files & Folders"
-#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
+
+static RygelMediaExportRootContainer *
+rygel_media_export_root_container_new (GError **error);
+
 #define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_SEARCH_CONTAINER_PREFIX RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "upnp:class," RYGEL_MUSIC_ITEM_UPNP_CLASS ","
-RygelMediaContainer* rygel_media_export_root_container_get_instance (GError** error);
 static RygelMediaExportRootContainer* rygel_media_export_root_container_construct (GType object_type, GError** error);
-RygelNullContainer* rygel_null_container_new (void);
-RygelNullContainer* rygel_null_container_construct (GType object_type);
-GType rygel_null_container_get_type (void) G_GNUC_CONST;
-RygelMediaContainer* rygel_media_export_root_container_get_filesystem_container (RygelMediaExportRootContainer* self);
-void rygel_media_export_root_container_shutdown (RygelMediaExportRootContainer* self);
-void rygel_media_export_root_container_add_uri (RygelMediaExportRootContainer* self, const gchar* uri);
-void rygel_media_export_harvester_schedule (RygelMediaExportHarvester* self, GFile* file, RygelMediaContainer* parent, const gchar* flag);
-void rygel_media_export_root_container_remove_uri (RygelMediaExportRootContainer* self, const gchar* uri);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-void rygel_media_export_harvester_cancel (RygelMediaExportHarvester* self, GFile* file);
-GQuark rygel_media_export_database_error_quark (void);
-void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* self, const gchar* id, GError** error);
-gchar** rygel_media_export_root_container_get_dynamic_uris (RygelMediaExportRootContainer* self, int* result_length1);
-GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaCache* self, const gchar* flag, GError** error);
 static void rygel_media_export_root_container_real_find_object_data_free (gpointer _data);
 static void rygel_media_export_root_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_root_container_real_find_object_co (RygelMediaExportRootContainerFindObjectData* _data_);
 static void rygel_media_export_root_container_find_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
-GType rygel_media_export_query_container_factory_get_type (void) G_GNUC_CONST;
-RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_get_default (void);
-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);
 static void rygel_media_export_root_container_real_search_data_free (gpointer _data);
-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_);
 static gboolean rygel_media_export_root_container_real_search_co (RygelMediaExportRootContainerSearchData* _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_root_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 static RygelMediaExportQueryContainer* rygel_media_export_root_container_search_to_virtual_container (RygelMediaExportRootContainer* self, RygelRelationalExpression* expression);
 static gboolean rygel_media_export_root_container_is_search_in_virtual_container (RygelMediaExportRootContainer* self, RygelSearchExpression* expression, RygelMediaContainer** container);
 static GeeArrayList* rygel_media_export_root_container_get_shared_uris (RygelMediaExportRootContainer* self);
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory* self, RygelMediaExportMediaCache* cache, const gchar* definition, const gchar* name);
-gchar* rygel_media_export_query_container_factory_get_virtual_container_definition (RygelMediaExportQueryContainerFactory* self, const gchar* hash);
-
-void rygel_media_export_media_cache_save_container (RygelMediaExportMediaCache* self, RygelMediaContainer* container, GError** error);
-GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
-RygelMediaExportHarvester* rygel_media_export_harvester_new (GCancellable* cancellable, GeeArrayList* locations);
-RygelMediaExportHarvester* rygel_media_export_harvester_construct (GType object_type, GCancellable* cancellable, GeeArrayList* locations);
 static void rygel_media_export_root_container_on_initial_harvesting_done (RygelMediaExportRootContainer* self);
 static void _rygel_media_export_root_container_on_initial_harvesting_done_rygel_media_export_harvester_done (RygelMediaExportHarvester* _sender, gpointer self);
-GeeArrayList* rygel_media_export_harvester_get_locations (RygelMediaExportHarvester* self);
-void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache* self);
 static void rygel_media_export_root_container_add_default_virtual_folders (RygelMediaExportRootContainer* self);
 static void __lambda6_ (RygelMediaExportRootContainer* self);
 static void ___lambda6__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, RygelMediaObject* object, RygelObjectEventType event_type, gboolean sub_tree_update, gpointer self);
-static void rygel_media_export_root_container_add_virtual_containers_for_class (RygelMediaExportRootContainer* self, const gchar* parent, const gchar* item_class, RygelMediaExportFolderDefinition* definitions, int definitions_length1, GError** error);
+static void rygel_media_export_root_container_add_virtual_containers_for_class (RygelMediaExportRootContainer* self, const gchar* parent, const gchar* item_class, const RygelMediaExportFolderDefinition* definitions, int definitions_length1, GError** error);
 static void rygel_media_export_root_container_add_folder_definition (RygelMediaExportRootContainer* self, RygelMediaContainer* container, const gchar* item_class, RygelMediaExportFolderDefinition* definition, GError** error);
 gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
 static void rygel_media_export_root_container_finalize (GObject* obj);
@@ -346,17 +278,15 @@ RygelMediaContainer* rygel_media_export_root_container_get_instance (GError** er
 		__catch26_g_error:
 		{
 			GError* _error_ = NULL;
-			RygelNullContainer* _tmp3_;
+			RygelMediaExportNullContainer* _tmp3_;
 			GError* _tmp4_;
 			GError* _tmp5_;
 			_error_ = _inner_error_;
 			_inner_error_ = NULL;
-			_tmp3_ = rygel_null_container_new ();
-			g_object_unref (rygel_media_export_root_container_instance);
+			_tmp3_ = rygel_media_export_null_container_new ();
 			rygel_media_export_root_container_instance = (RygelMediaContainer*) _tmp3_;
 			_tmp4_ = _error_;
 			_tmp5_ = g_error_copy (_tmp4_);
-			g_error_free (rygel_media_export_root_container_creation_error);
 			rygel_media_export_root_container_creation_error = _tmp5_;
 			g_error_free (_error_);
 		}
@@ -441,7 +371,7 @@ static void rygel_media_export_root_container_real_find_object (RygelMediaContai
 }
 
 
-static RygelMediaObject* rygel_media_export_root_container_real_find_object_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
+static RygelMediaObject* rygel_media_export_root_container_real_find_object_finish (RygelMediaContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
 	RygelMediaObject* result;
 	RygelMediaExportRootContainerFindObjectData* _data_;
 	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
@@ -515,7 +445,7 @@ static gboolean rygel_media_export_root_container_real_find_object_co (RygelMedi
 		_data_->_tmp12_ = _data_->container;
 		if (_data_->_tmp12_ != NULL) {
 			_data_->_tmp13_ = _data_->container;
-			((RygelMediaObject*) _data_->_tmp13_)->parent = (RygelMediaContainer*) _data_->self;
+			rygel_media_object_set_parent ((RygelMediaObject*) _data_->_tmp13_, (RygelMediaContainer*) _data_->self);
 		}
 		_data_->result = (RygelMediaObject*) _data_->container;
 		g_object_unref (_data_->factory);
@@ -602,7 +532,7 @@ static void rygel_media_export_root_container_real_search (RygelSearchableContai
 }
 
 
-static RygelMediaObjects* rygel_media_export_root_container_real_search_finish (RygelMediaExportDBContainer* base, GAsyncResult* _res_, guint* total_matches, GError** error) {
+static RygelMediaObjects* rygel_media_export_root_container_real_search_finish (RygelSearchableContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, guint* total_matches, GError** error) {
 	RygelMediaObjects* result;
 	RygelMediaExportRootContainerSearchData* _data_;
 	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
@@ -736,7 +666,7 @@ static gboolean rygel_media_export_root_container_real_search_co (RygelMediaExpo
 		g_object_unref (_data_->list);
 		_data_->list = _data_->_tmp27_;
 		_data_->_tmp28_ = _data_->query_container;
-		_data_->_tmp29_ = _data_->_tmp28_->child_count;
+		_data_->_tmp29_ = rygel_media_container_get_child_count (_data_->_tmp28_);
 		_data_->total_matches = (guint) _data_->_tmp29_;
 		_data_->_tmp30_ = _data_->upnp_class;
 		if (_data_->_tmp30_ != NULL) {
@@ -745,7 +675,7 @@ static gboolean rygel_media_export_root_container_real_search_co (RygelMediaExpo
 				_data_->_tmp32_ = g_object_ref (_data_->_tmp31_);
 				_data_->_object_list = _data_->_tmp32_;
 				_data_->_tmp33_ = _data_->_object_list;
-				_data_->_tmp34_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp33_);
+				_data_->_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp33_);
 				_data_->_tmp35_ = _data_->_tmp34_;
 				_data_->_object_size = _data_->_tmp35_;
 				_data_->_object_index = -1;
@@ -956,7 +886,6 @@ static GeeArrayList* rygel_media_export_root_container_get_shared_uris (RygelMed
 	}
 
 	goto __finally30;
-	__catch30_g_error:
 	{
 		GError* _error_ = NULL;
 		_error_ = _inner_error_;
@@ -997,7 +926,7 @@ static GeeArrayList* rygel_media_export_root_container_get_shared_uris (RygelMed
 		_tmp16_ = g_object_ref (_tmp15_);
 		_uri_list = _tmp16_;
 		_tmp17_ = _uri_list;
-		_tmp18_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp17_);
+		_tmp18_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp17_);
 		_tmp19_ = _tmp18_;
 		_uri_size = _tmp19_;
 		_uri_index = -1;
@@ -1443,7 +1372,7 @@ static gboolean rygel_media_export_root_container_is_search_in_virtual_container
 /**
      * Create a new root container.
      */
-static void _rygel_media_export_root_container_on_initial_harvesting_done_rygel_media_export_harvester_done (RygelMediaExportHarvester* _sender, gpointer self) {
+static void _rygel_media_export_root_container_on_initial_harvesting_done_rygel_media_export_harvester_done (RygelMediaExportHarvester* _sender G_GNUC_UNUSED, gpointer self) {
 	rygel_media_export_root_container_on_initial_harvesting_done (self);
 }
 
@@ -1466,17 +1395,20 @@ static RygelMediaExportRootContainer* rygel_media_export_root_container_construc
 	db = _tmp0_;
 	if (_inner_error_ != NULL) {
 		g_propagate_error (error, _inner_error_);
-		g_object_unref (self);
 		return NULL;
 	}
 	_tmp1_ = _ ("@REALNAME@'s media");
-	self = (RygelMediaExportRootContainer*) rygel_media_export_db_container_construct (object_type, db, "0", _tmp1_);
+	self = RYGEL_MEDIA_EXPORT_ROOT_CONTAINER (g_object_new (object_type,
+								"id", "0",
+								"parent", NULL,
+								"title", _tmp1_,
+								"child-count", 0,
+								NULL));
 	_tmp2_ = g_cancellable_new ();
 	g_object_unref (self->priv->cancellable);
 	self->priv->cancellable = _tmp2_;
 
 	goto __finally32;
-	__catch32_g_error:
 	{
 		GError* err = NULL;
 		const gchar* _tmp5_ = NULL;
@@ -1521,19 +1453,17 @@ static RygelMediaExportRootContainer* rygel_media_export_root_container_construc
 		return NULL;
 	}
 	{
-		RygelMediaExportMediaCache* _tmp9_;
 		const gchar* _tmp10_ = NULL;
 		RygelMediaExportDBContainer* _tmp11_;
 		RygelMediaContainer* _tmp12_;
 		RygelMediaExportMediaCache* _tmp13_;
 		RygelMediaContainer* _tmp14_;
-		_tmp9_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
 		_tmp10_ = _ (RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_NAME);
-		_tmp11_ = rygel_media_export_db_container_new (_tmp9_, RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID, _tmp10_);
+		_tmp11_ = rygel_media_export_db_container_new (RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID, _tmp10_);
 		g_object_unref (self->priv->filesystem_container);
 		self->priv->filesystem_container = (RygelMediaContainer*) _tmp11_;
 		_tmp12_ = self->priv->filesystem_container;
-		((RygelMediaObject*) _tmp12_)->parent = (RygelMediaContainer*) self;
+		rygel_media_object_set_parent ((RygelMediaObject*) _tmp12_, (RygelMediaContainer*) self);
 		_tmp13_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
 		_tmp14_ = self->priv->filesystem_container;
 		rygel_media_export_media_cache_save_container (_tmp13_, _tmp14_, &_inner_error_);
@@ -1623,7 +1553,7 @@ static RygelMediaExportRootContainer* rygel_media_export_root_container_construc
 		_tmp28_ = g_object_ref (_tmp27_);
 		_file_list = _tmp28_;
 		_tmp29_ = _file_list;
-		_tmp30_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp29_);
+		_tmp30_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp29_);
 		_tmp31_ = _tmp30_;
 		_file_size = _tmp31_;
 		_file_index = -1;
@@ -1680,7 +1610,7 @@ static RygelMediaExportRootContainer* rygel_media_export_root_container_construc
 		_tmp46_ = g_object_ref (_tmp45_);
 		_id_list = _tmp46_;
 		_tmp47_ = _id_list;
-		_tmp48_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp47_);
+		_tmp48_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp47_);
 		_tmp49_ = _tmp48_;
 		_id_size = _tmp49_;
 		_id_index = -1;
@@ -1762,7 +1692,7 @@ static RygelMediaExportRootContainer* rygel_media_export_root_container_construc
 }
 
 
-RygelMediaExportRootContainer*
+static RygelMediaExportRootContainer*
 rygel_media_export_root_container_new (GError** error) {
 	return rygel_media_export_root_container_construct (RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, error);
 }
@@ -1774,7 +1704,7 @@ static void __lambda6_ (RygelMediaExportRootContainer* self) {
 }
 
 
-static void ___lambda6__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, RygelMediaObject* object, RygelObjectEventType event_type, gboolean sub_tree_update, gpointer self) {
+static void ___lambda6__rygel_media_container_container_updated (RygelMediaContainer* _sender G_GNUC_UNUSED, RygelMediaContainer* container G_GNUC_UNUSED, RygelMediaObject* object G_GNUC_UNUSED, RygelObjectEventType event_type G_GNUC_UNUSED, gboolean sub_tree_update G_GNUC_UNUSED, gpointer self) {
 	__lambda6_ (self);
 }
 
@@ -1963,7 +1893,7 @@ static void rygel_media_export_root_container_add_folder_definition (RygelMediaE
 	_tmp15_ = rygel_media_export_query_container_factory_create_from_description (_tmp9_, _tmp10_, _tmp11_, _tmp14_);
 	query_container = _tmp15_;
 	_tmp16_ = query_container;
-	_tmp17_ = ((RygelMediaContainer*) _tmp16_)->child_count;
+	_tmp17_ = rygel_media_container_get_child_count ((RygelMediaContainer*) _tmp16_);
 	if (_tmp17_ > 0) {
 		RygelMediaExportQueryContainer* _tmp18_;
 		RygelMediaContainer* _tmp19_;
@@ -1971,7 +1901,7 @@ static void rygel_media_export_root_container_add_folder_definition (RygelMediaE
 		RygelMediaExportQueryContainer* _tmp21_;
 		_tmp18_ = query_container;
 		_tmp19_ = container;
-		((RygelMediaObject*) _tmp18_)->parent = _tmp19_;
+		rygel_media_object_set_parent ((RygelMediaObject*) _tmp18_, _tmp19_);
 		_tmp20_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
 		_tmp21_ = query_container;
 		rygel_media_export_media_cache_save_container (_tmp20_, (RygelMediaContainer*) _tmp21_, &_inner_error_);
@@ -2002,22 +1932,21 @@ static void rygel_media_export_root_container_add_folder_definition (RygelMediaE
 }
 
 
-static void rygel_media_export_root_container_add_virtual_containers_for_class (RygelMediaExportRootContainer* self, const gchar* parent, const gchar* item_class, RygelMediaExportFolderDefinition* definitions, int definitions_length1, GError** error) {
-	RygelNullContainer* _tmp0_;
-	RygelNullContainer* container;
-	RygelNullContainer* _tmp1_;
-	RygelNullContainer* _tmp2_;
+static void rygel_media_export_root_container_add_virtual_containers_for_class (RygelMediaExportRootContainer* self, const gchar* parent, const gchar* item_class, const RygelMediaExportFolderDefinition* definitions, int definitions_length1, GError** error) {
+	RygelMediaExportNullContainer* _tmp0_;
+	RygelMediaExportNullContainer* container;
+	RygelMediaExportNullContainer* _tmp1_;
+	RygelMediaExportNullContainer* _tmp2_;
 	const gchar* _tmp3_;
-	RygelNullContainer* _tmp4_;
+	RygelMediaExportNullContainer* _tmp4_;
 	const gchar* _tmp5_;
 	gchar* _tmp6_;
 	gchar* _tmp7_;
 	RygelMediaExportMediaCache* _tmp8_;
-	RygelNullContainer* _tmp9_;
-	RygelMediaExportFolderDefinition* _tmp13_;
-	gint _tmp13__length1;
+	RygelMediaExportNullContainer* _tmp9_;
+	const RygelMediaExportFolderDefinition* _tmp13_;
 	RygelMediaExportMediaCache* _tmp19_;
-	RygelNullContainer* _tmp20_;
+	RygelMediaExportNullContainer* _tmp20_;
 	const gchar* _tmp21_;
 	const gchar* _tmp22_;
 	gint _tmp23_ = 0;
@@ -2026,10 +1955,10 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 	g_return_if_fail (self != NULL);
 	g_return_if_fail (parent != NULL);
 	g_return_if_fail (item_class != NULL);
-	_tmp0_ = rygel_null_container_new ();
+	_tmp0_ = rygel_media_export_null_container_new ();
 	container = _tmp0_;
 	_tmp1_ = container;
-	((RygelMediaObject*) _tmp1_)->parent = (RygelMediaContainer*) self;
+	rygel_media_object_set_parent ((RygelMediaObject*) _tmp1_, (RygelMediaContainer*) self);
 	_tmp2_ = container;
 	_tmp3_ = parent;
 	rygel_media_object_set_title ((RygelMediaObject*) _tmp2_, _tmp3_);
@@ -2048,17 +1977,14 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 		return;
 	}
 	{
-		RygelMediaExportFolderDefinition* definition_collection = NULL;
-		gint definition_collection_length1 = 0;
-		gint _definition_collection_size_ = 0;
-		gint definition_it = 0;
+		const RygelMediaExportFolderDefinition* definition_collection = NULL;
+		guint definition_it = 0;
 		definition_collection = VIRTUAL_FOLDERS_DEFAULT;
-		definition_collection_length1 = G_N_ELEMENTS (VIRTUAL_FOLDERS_DEFAULT);
-		for (definition_it = 0; definition_it < G_N_ELEMENTS (VIRTUAL_FOLDERS_DEFAULT); definition_it = definition_it + 1) {
+		for (definition_it = 0; definition_it < G_N_ELEMENTS (VIRTUAL_FOLDERS_DEFAULT); ++definition_it) {
 			RygelMediaExportFolderDefinition definition = {0};
 			definition = definition_collection[definition_it];
 			{
-				RygelNullContainer* _tmp10_;
+				RygelMediaExportNullContainer* _tmp10_;
 				const gchar* _tmp11_;
 				RygelMediaExportFolderDefinition _tmp12_;
 				_tmp10_ = container;
@@ -2074,26 +2000,22 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 		}
 	}
 	_tmp13_ = definitions;
-	_tmp13__length1 = definitions_length1;
 	if (_tmp13_ != NULL) {
-		RygelMediaExportFolderDefinition* _tmp14_;
+		const RygelMediaExportFolderDefinition* _tmp14_;
 		gint _tmp14__length1;
 		_tmp14_ = definitions;
 		_tmp14__length1 = definitions_length1;
 		{
-			RygelMediaExportFolderDefinition* definition_collection = NULL;
-			gint definition_collection_length1 = 0;
-			gint _definition_collection_size_ = 0;
+			const RygelMediaExportFolderDefinition* definition_collection = NULL;
 			gint definition_it = 0;
 			definition_collection = _tmp14_;
-			definition_collection_length1 = _tmp14__length1;
-			for (definition_it = 0; definition_it < _tmp14__length1; definition_it = definition_it + 1) {
+			for (definition_it = 0; definition_it < _tmp14__length1; ++definition_it) {
 				RygelMediaExportFolderDefinition _tmp15_ = {0};
 				RygelMediaExportFolderDefinition definition = {0};
 				rygel_media_export_folder_definition_copy (&definition_collection[definition_it], &_tmp15_);
 				definition = _tmp15_;
 				{
-					RygelNullContainer* _tmp16_;
+					RygelMediaExportNullContainer* _tmp16_;
 					const gchar* _tmp17_;
 					RygelMediaExportFolderDefinition _tmp18_;
 					_tmp16_ = container;
@@ -2124,7 +2046,7 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 	}
 	if (_tmp24_ == 0) {
 		RygelMediaExportMediaCache* _tmp25_;
-		RygelNullContainer* _tmp26_;
+		RygelMediaExportNullContainer* _tmp26_;
 		const gchar* _tmp27_;
 		const gchar* _tmp28_;
 		_tmp25_ = rygel_media_export_db_container_get_media_db (RYGEL_MEDIA_EXPORT_DB_CONTAINER (self));
@@ -2138,7 +2060,7 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 			return;
 		}
 	} else {
-		RygelNullContainer* _tmp29_;
+		RygelMediaExportNullContainer* _tmp29_;
 		_tmp29_ = container;
 		rygel_media_container_updated ((RygelMediaContainer*) _tmp29_, NULL, RYGEL_OBJECT_EVENT_TYPE_MODIFIED, FALSE);
 	}
@@ -2147,7 +2069,6 @@ static void rygel_media_export_root_container_add_virtual_containers_for_class (
 
 
 static void rygel_media_export_root_container_class_init (RygelMediaExportRootContainerClass * klass) {
-	rygel_media_export_root_container_parent_class = g_type_class_peek_parent (klass);
 	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;
@@ -2163,7 +2084,6 @@ static void rygel_media_export_root_container_init (RygelMediaExportRootContaine
 static void rygel_media_export_root_container_finalize (GObject* obj) {
 	RygelMediaExportRootContainer * self;
 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainer);
-	g_object_unref (self->priv->service);
 	g_object_unref (self->priv->harvester);
 	g_object_unref (self->priv->cancellable);
 	g_object_unref (self->priv->filesystem_container);
@@ -2173,8 +2093,8 @@ static void rygel_media_export_root_container_finalize (GObject* 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->search = rygel_media_export_root_container_real_search;
+  iface->search_finish = rygel_media_export_root_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.
    *
diff --git a/src/media-export/rygel-media-export-root-container.h b/src/media-export/rygel-media-export-root-container.h
index 7a97190..4daf86f 100644
--- a/src/media-export/rygel-media-export-root-container.h
+++ b/src/media-export/rygel-media-export-root-container.h
@@ -21,6 +21,9 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_ROOT_CONTAINER_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_ROOT_CONTAINER_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
 #include "rygel-media-export-db-container.h"
 
 G_BEGIN_DECLS
@@ -32,6 +35,9 @@ G_BEGIN_DECLS
 #define RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER))
 #define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_ROOT_CONTAINER, RygelMediaExportRootContainerClass))
 
+#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_NAME "Files & Folders"
+#define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
+
 typedef struct _RygelMediaExportRootContainer RygelMediaExportRootContainer;
 typedef struct _RygelMediaExportRootContainerClass RygelMediaExportRootContainerClass;
 typedef struct _RygelMediaExportRootContainerPrivate RygelMediaExportRootContainerPrivate;
@@ -45,9 +51,29 @@ struct _RygelMediaExportRootContainerClass {
   RygelMediaExportDBContainerClass parent_class;
 };
 
-GType rygel_media_export_root_container_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_root_container_get_type (void) G_GNUC_CONST;
+
+RygelMediaContainer *
+rygel_media_export_root_container_get_instance (GError **error);
+
+RygelMediaContainer *
+rygel_media_export_root_container_get_filesystem_container (RygelMediaExportRootContainer *self);
+
+void
+rygel_media_export_root_container_shutdown (RygelMediaExportRootContainer *self);
+
+void
+rygel_media_export_root_container_add_uri (RygelMediaExportRootContainer *self,
+					   const gchar                   *uri);
+
+void
+rygel_media_export_root_container_remove_uri (RygelMediaExportRootContainer *self,
+					      const gchar                   *uri);
 
-RygelMediaExportRootContainer* rygel_media_export_root_container_new (GError** error);
+gchar **
+rygel_media_export_root_container_get_dynamic_uris (RygelMediaExportRootContainer *self,
+						    int                           *result_length);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-sql-factory.c b/src/media-export/rygel-media-export-sql-factory.c
index 998c837..ed9e32f 100644
--- a/src/media-export/rygel-media-export-sql-factory.c
+++ b/src/media-export/rygel-media-export-sql-factory.c
@@ -31,61 +31,6 @@ G_DEFINE_TYPE (RygelMediaExportSQLFactory, rygel_media_export_sql_factory, G_TYP
 #define RYGEL_MEDIA_EXPORT_TYPE_SQL_STRING (rygel_media_export_sql_string_get_type ())
 
 
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TYPE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TITLE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SIZE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_MIME_TYPE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_WIDTH,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_HEIGHT,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CLASS,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ALBUM,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DATE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITRATE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SAMPLE_FREQ,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITS_PER_SAMPLE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CHANNELS,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TRACK,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_COLOR_DEPTH,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DURATION,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_PARENT,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TIMESTAMP,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_URI,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DLNA_PROFILE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_GENRE,
-	RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DISC
-} RygelMediaExportDetailColumn;
-
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SAVE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INSERT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_DELETE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_CHILDREN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER_WITH_ANCESTOR,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_GET_META_DATA_COLUMN,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_IDS,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_METADATA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_CLOSURE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_INDEX_COMMON,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_SCHEMA,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS_CACHE,
-	RYGEL_MEDIA_EXPORT_SQL_STRING_STATISTICS
-} RygelMediaExportSQLString;
-
-
-
-GType rygel_media_export_detail_column_get_type (void) G_GNUC_CONST;
-GType rygel_media_export_sql_string_get_type (void) G_GNUC_CONST;
 
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SAVE_META_DATA_STRING "INSERT OR REPLACE INTO meta_data " "(size, mime_type, width, height, class, " "author, album, date, bitrate, " "sample_freq, bits_per_sample, channels, " "track, color_depth, duration, object_fk, dlna_profile, genre, disc) VA" \
 "LUES " "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
@@ -103,7 +48,6 @@ GType rygel_media_export_sql_string_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_OBJECT_EXISTS_STRING "SELECT COUNT(1), timestamp, m.size FROM Object " "JOIN meta_data m ON m.object_fk = upnp_id " "WHERE Object.uri = ?"
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_GET_CHILD_ID_STRING "SELECT upnp_id FROM OBJECT WHERE parent = ?"
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_GET_META_DATA_COLUMN_STRING "SELECT DISTINCT %s AS _column FROM meta_data AS m " "WHERE _column IS NOT NULL %s ORDER BY _column COLLATE CASEFOLD " "LIMIT ?,?"
-#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION "11"
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_CREATE_META_DATA_TABLE_STRING "CREATE TABLE meta_data (size INTEGER NOT NULL, " "mime_type TEXT NOT NULL, " "dlna_profile TEXT, " "duration INTEGER, " "width INTEGER, " "height INTEGER, " "class TEXT NOT NULL, " "author TEXT, " "album TEXT, " "genre TEXT, " "date TEXT, " "bitrate INTEGER, " "sample_freq INTEGER, " "bits_per_sample INTEGER, " "channels INTEGER, " "track INTEGER, " "disc INTEGER, " "color_depth INTEGER, " "object_fk TEXT UNIQUE CONSTRAINT " "object_fk_id REFERENCES Object(upnp_id) " "ON DELETE CASCADE);"
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_STRING "CREATE TABLE schema_info (version TEXT NOT NULL); " RYGEL_MEDIA_EXPORT_SQL_FACTORY_CREATE_META_DATA_TABLE_STRING "CREATE TABLE object (parent TEXT CONSTRAINT parent_fk_id " "REFERENCES Object(upnp_id), " "upnp_id TEXT PRIMARY KEY, " "type_fk INTEGER, " "title TEXT NOT NULL, " "timestamp INTEGER NOT NULL, " "uri TEXT, " "flags TEXT);" "INSERT INTO schema_info (version) VALUES ('" RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION "'); "
 #define RYGEL_MEDIA_EXPORT_SQL_FACTORY_CREATE_CLOSURE_TABLE "CREATE TABLE closure (ancestor TEXT, descendant TEXT, depth INTEGER)"
@@ -273,15 +217,9 @@ RygelMediaExportSQLFactory* rygel_media_export_sql_factory_new (void) {
 }
 
 
-static void rygel_media_export_sql_factory_class_init (RygelMediaExportSQLFactoryClass * klass) {
-	rygel_media_export_sql_factory_parent_class = g_type_class_peek_parent (klass);
+static void rygel_media_export_sql_factory_class_init (RygelMediaExportSQLFactoryClass * klass G_GNUC_UNUSED) {
 }
 
 
-static void rygel_media_export_sql_factory_init (RygelMediaExportSQLFactory * self) {
+static void rygel_media_export_sql_factory_init (RygelMediaExportSQLFactory * self G_GNUC_UNUSED) {
 }
-
-
-
-
-
diff --git a/src/media-export/rygel-media-export-sql-factory.h b/src/media-export/rygel-media-export-sql-factory.h
index 9e3551a..6e2779e 100644
--- a/src/media-export/rygel-media-export-sql-factory.h
+++ b/src/media-export/rygel-media-export-sql-factory.h
@@ -24,11 +24,6 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
-#include <rygel-server.h>
-#include <gee.h>
 
 G_BEGIN_DECLS
 
@@ -52,9 +47,74 @@ struct _RygelMediaExportSQLFactoryClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_sql_factory_get_type (void) G_GNUC_CONST;
+#define RYGEL_MEDIA_EXPORT_SQL_FACTORY_SCHEMA_VERSION "11"
 
-RygelMediaExportSQLFactory* rygel_media_export_sql_factory_new ();
+typedef enum  {
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TYPE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TITLE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SIZE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_MIME_TYPE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_WIDTH,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_HEIGHT,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CLASS,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_AUTHOR,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ALBUM,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DATE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITRATE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_SAMPLE_FREQ,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_BITS_PER_SAMPLE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_CHANNELS,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TRACK,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_COLOR_DEPTH,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DURATION,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_ID,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_PARENT,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_TIMESTAMP,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_URI,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DLNA_PROFILE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_GENRE,
+  RYGEL_MEDIA_EXPORT_DETAIL_COLUMN_DISC
+} RygelMediaExportDetailColumn;
+
+typedef enum  {
+  RYGEL_MEDIA_EXPORT_SQL_STRING_SAVE_METADATA,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_INSERT,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_DELETE,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_CHILDREN,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECTS_BY_FILTER_WITH_ANCESTOR,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_OBJECT_COUNT_BY_FILTER_WITH_ANCESTOR,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_GET_META_DATA_COLUMN,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_IDS,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_METADATA,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_TABLE_CLOSURE,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_CLOSURE,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_TRIGGER_COMMON,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_INDEX_COMMON,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_SCHEMA,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_EXISTS_CACHE,
+  RYGEL_MEDIA_EXPORT_SQL_STRING_STATISTICS
+} RygelMediaExportSQLString;
+
+GType
+rygel_media_export_detail_column_get_type (void) G_GNUC_CONST;
+
+GType
+rygel_media_export_sql_string_get_type (void) G_GNUC_CONST;
+
+GType
+rygel_media_export_sql_factory_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportSQLFactory *
+rygel_media_export_sql_factory_new (void);
+
+const gchar *
+rygel_media_export_sql_factory_make (RygelMediaExportSQLFactory *self,
+				     RygelMediaExportSQLString   query);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-sql-function.c b/src/media-export/rygel-media-export-sql-function.c
index 801e505..9c370a8 100644
--- a/src/media-export/rygel-media-export-sql-function.c
+++ b/src/media-export/rygel-media-export-sql-function.c
@@ -50,9 +50,9 @@ rygel_media_export_sql_function_real_to_string (RygelMediaExportSqlOperator *bas
 
 static void
 rygel_media_export_sql_function_class_init (RygelMediaExportSqlFunctionClass *function_class) {
-  RygelMediaExportSqlOperatorClass operator_class = RYGEL_MEDIA_EXPORT_SQL_OPERATOR_CLASS (function_class);
+  RygelMediaExportSqlOperatorClass *operator_class = RYGEL_MEDIA_EXPORT_SQL_OPERATOR_CLASS (function_class);
 
-  function_class->to_string = rygel_media_export_sql_function_real_to_string;
+  operator_class->to_string = rygel_media_export_sql_function_real_to_string;
 }
 
 static void rygel_media_export_sql_function_init (RygelMediaExportSqlFunction *self G_GNUC_UNUSED) {
diff --git a/src/media-export/rygel-media-export-sql-function.h b/src/media-export/rygel-media-export-sql-function.h
index 9c09a76..ce54d7c 100644
--- a/src/media-export/rygel-media-export-sql-function.h
+++ b/src/media-export/rygel-media-export-sql-function.h
@@ -22,6 +22,9 @@
 #ifndef __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_SQL_FUNCTION_H__
 #define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_SQL_FUNCTION_H__
 
+#include <glib.h>
+#include <glib-object.h>
+
 #include "rygel-media-export-sql-operator.h"
 
 G_BEGIN_DECLS
diff --git a/src/media-export/rygel-media-export-sql-operator.c b/src/media-export/rygel-media-export-sql-operator.c
index 0a2aaec..4639419 100644
--- a/src/media-export/rygel-media-export-sql-operator.c
+++ b/src/media-export/rygel-media-export-sql-operator.c
@@ -35,7 +35,7 @@ enum {
   PROP_NAME,
   PROP_ARG,
   PROP_COLLATE
-}
+};
 
 struct _RygelMediaExportSqlOperatorPrivate {
   gchar *name;
diff --git a/src/media-export/rygel-media-export-sql-operator.h b/src/media-export/rygel-media-export-sql-operator.h
index 04eb37b..228b69e 100644
--- a/src/media-export/rygel-media-export-sql-operator.h
+++ b/src/media-export/rygel-media-export-sql-operator.h
@@ -24,11 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
-#include <rygel-server.h>
-#include <gee.h>
+#include <libgupnp-av/gupnp-av.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/media-export/rygel-media-export-sqlite-wrapper.c b/src/media-export/rygel-media-export-sqlite-wrapper.c
index a7321dd..3302b91 100644
--- a/src/media-export/rygel-media-export-sqlite-wrapper.c
+++ b/src/media-export/rygel-media-export-sqlite-wrapper.c
@@ -95,9 +95,7 @@ void
 rygel_media_export_sqlite_wrapper_throw_if_code_is_error (RygelMediaExportSqliteWrapper  *self,
                                                           gint                            sqlite_error,
                                                           GError                        **error) {
-  GError *inner_error = NULL;
-
-  g_return_if_fail (RYGEL_IS_MEDIA_EXPORT_SQLITE_WRAPPER (self));
+  g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_SQLITE_WRAPPER (self));
 
   switch (sqlite_error) {
   case SQLITE_OK:
@@ -124,7 +122,7 @@ rygel_media_export_sqlite_wrapper_throw_if_code_is_error (RygelMediaExportSqlite
 void
 rygel_media_export_sqlite_wrapper_throw_if_db_has_error (RygelMediaExportSqliteWrapper  *self,
                                                          GError                        **error) {
-  g_return_if_fail (RYGEL_IS_MEDIA_EXPORT_SQLITE_WRAPPER (self));
+  g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_SQLITE_WRAPPER (self));
 
   rygel_media_export_sqlite_wrapper_throw_if_code_is_error (self,
                                                             sqlite3_errcode (self->priv->reference),
@@ -133,7 +131,7 @@ rygel_media_export_sqlite_wrapper_throw_if_db_has_error (RygelMediaExportSqliteW
 
 sqlite3 *
 rygel_media_export_sqlite_wrapper_get_db (RygelMediaExportSqliteWrapper *self) {
-  g_return_val_if_fail (RYGEL_IS_MEDIA_EXPORT_SQLITE_WRAPPER (self), NULL);
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_SQLITE_WRAPPER (self), NULL);
 
   return self->priv->reference;
 }
@@ -179,7 +177,7 @@ rygel_media_export_sqlite_wrapper_set_property (GObject      *object,
     priv->reference = g_value_get_pointer (value);
     break;
 
-  case RYGEL_MEDIA_EXPORT_SQLITE_WRAPPER_ONW_DB:
+  case RYGEL_MEDIA_EXPORT_SQLITE_WRAPPER_OWN_DB:
     priv->database = g_value_get_pointer (value);
     break;
 
@@ -193,8 +191,8 @@ static void
 rygel_media_export_sqlite_wrapper_class_init (RygelMediaExportSqliteWrapperClass *wrapper_class) {
   GObjectClass *object_class = G_OBJECT_CLASS (wrapper_class);
 
-  object_class->get_property = _vala_rygel_media_export_sqlite_wrapper_get_property;
-  object_class->set_property = _vala_rygel_media_export_sqlite_wrapper_set_property;
+  object_class->get_property = rygel_media_export_sqlite_wrapper_get_property;
+  object_class->set_property = rygel_media_export_sqlite_wrapper_set_property;
   object_class->finalize = rygel_media_export_sqlite_wrapper_finalize;
   /**
    * Property to access the wrapped database
@@ -222,7 +220,7 @@ rygel_media_export_sqlite_wrapper_class_init (RygelMediaExportSqliteWrapperClass
                                                          G_PARAM_WRITABLE |
                                                          G_PARAM_CONSTRUCT_ONLY));
 
-  g_type_class_add_private (klass, sizeof (RygelMediaExportSqliteWrapperPrivate));
+  g_type_class_add_private (wrapper_class, sizeof (RygelMediaExportSqliteWrapperPrivate));
 }
 
 static void
diff --git a/src/media-export/rygel-media-export-video-item.c b/src/media-export/rygel-media-export-video-item.c
index bf20a7f..828b525 100644
--- a/src/media-export/rygel-media-export-video-item.c
+++ b/src/media-export/rygel-media-export-video-item.c
@@ -45,18 +45,12 @@ struct _RygelMediaExportVideoItemCommitData {
 	GError * _inner_error_;
 };
 
-static RygelUpdatableObjectIface* rygel_media_export_video_item_rygel_updatable_object_parent_iface = NULL;
 
-
-RygelMediaExportVideoItem* rygel_media_export_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
 static void rygel_media_export_video_item_real_commit_data_free (gpointer _data);
 static void rygel_media_export_video_item_real_commit (RygelUpdatableObject* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_video_item_real_commit_co (RygelMediaExportVideoItemCommitData* _data_);
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
-RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (GError** error);
-void rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
-
 
+static
 RygelMediaExportVideoItem* rygel_media_export_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class) {
 	RygelMediaExportVideoItem * self = NULL;
 	const gchar* _tmp0_;
@@ -102,12 +96,8 @@ static void rygel_media_export_video_item_real_commit (RygelUpdatableObject* bas
 }
 
 
-static void rygel_media_export_video_item_real_commit_finish (RygelUpdatableObject* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaExportVideoItemCommitData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_video_item_real_commit_finish (RygelUpdatableObject* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
 }
 
 
@@ -162,18 +152,14 @@ static void rygel_media_export_video_item_class_init (RygelMediaExportVideoItemC
 	rygel_media_export_video_item_parent_class = g_type_class_peek_parent (klass);
 }
 
-static void rygel_media_export_video_item_rygel_trackable_item_interface_init (RygelTrackableItemIface * iface) {
+static void rygel_media_export_video_item_rygel_trackable_item_interface_init (RygelTrackableItemIface * iface G_GNUC_UNUSED) {
 }
 
 static void rygel_media_export_video_item_rygel_updatable_object_interface_init (RygelUpdatableObjectIface * iface) {
-	rygel_media_export_video_item_rygel_updatable_object_parent_iface = g_type_interface_peek_parent (iface);
-	iface->commit = (void (*)(RygelUpdatableObject*, GError**)) rygel_media_export_video_item_real_commit;
-	iface->commit_finish = rygel_media_export_video_item_real_commit_finish;
+  iface->commit = rygel_media_export_video_item_real_commit;
+  iface->commit_finish = rygel_media_export_video_item_real_commit_finish;
 }
 
 
-static void rygel_media_export_video_item_init (RygelMediaExportVideoItem * self) {
+static void rygel_media_export_video_item_init (RygelMediaExportVideoItem * self G_GNUC_UNUSED) {
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-video-item.h b/src/media-export/rygel-media-export-video-item.h
index 6d59153..021b6f5 100644
--- a/src/media-export/rygel-media-export-video-item.h
+++ b/src/media-export/rygel-media-export-video-item.h
@@ -24,11 +24,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
-#include <stdlib.h>
-#include <string.h>
-#include <rygel-core.h>
 #include <rygel-server.h>
-#include <gee.h>
 
 G_BEGIN_DECLS
 
@@ -52,9 +48,14 @@ struct _RygelMediaExportVideoItemClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportVideoItem* rygel_media_export_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, const gchar* upnp_class);
+RygelMediaExportVideoItem *
+rygel_media_export_video_item_new (const gchar         *id,
+				   RygelMediaContainer *parent,
+				   const gchar         *title,
+				   const gchar         *upnp_class);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-writable-db-container.c b/src/media-export/rygel-media-export-writable-db-container.c
index 1acd2fb..5b75f86 100644
--- a/src/media-export/rygel-media-export-writable-db-container.c
+++ b/src/media-export/rygel-media-export-writable-db-container.c
@@ -23,72 +23,22 @@
  * 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_WRITABLE_DB_CONTAINER (rygel_media_export_writable_db_container_get_type ())
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer))
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
-#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
-#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
-
-typedef struct _RygelMediaExportWritableDbContainer RygelMediaExportWritableDbContainer;
-typedef struct _RygelMediaExportWritableDbContainerClass RygelMediaExportWritableDbContainerClass;
-typedef struct _RygelMediaExportWritableDbContainerPrivate RygelMediaExportWritableDbContainerPrivate;
-typedef struct _RygelMediaExportWritableDbContainerAddItemData RygelMediaExportWritableDbContainerAddItemData;
-typedef struct _RygelMediaExportWritableDbContainerRemoveItemData RygelMediaExportWritableDbContainerRemoveItemData;
-
-struct _RygelMediaExportDBContainer {
-	RygelMediaContainer parent_instance;
-	RygelMediaExportDBContainerPrivate * priv;
-	RygelMediaExportMediaCache* media_db;
-};
+#include "rygel-media-export-writable-db-container.h"
 
-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);
-};
+static void
+rygel_media_export_writable_db_container_rygel_writable_container_interface_init (RygelWritableContainerIface * iface);
 
-struct _RygelMediaExportWritableDbContainer {
-	RygelMediaExportDBContainer parent_instance;
-	RygelMediaExportWritableDbContainerPrivate * priv;
-};
+G_DEFINE_TYPE_WITH_CODE (RygelMediaExportWritableDbContainer,
+			 rygel_media_export_writable_db_container,
+			 RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER,
+			 G_IMPLEMENT_INTERFACE (RYGEL_TYPE_WRITABLE_CONTAINER,
+						rygel_media_export_writable_db_container_rygel_writable_container_interface_init));
 
-struct _RygelMediaExportWritableDbContainerClass {
-	RygelMediaExportDBContainerClass parent_class;
-};
+typedef struct _RygelMediaExportWritableDbContainerAddItemData RygelMediaExportWritableDbContainerAddItemData;
+typedef struct _RygelMediaExportWritableDbContainerRemoveItemData RygelMediaExportWritableDbContainerRemoveItemData;
 
 struct _RygelMediaExportWritableDbContainerPrivate {
-	GeeArrayList* _create_classes;
+  GeeArrayList* create_classes;
 };
 
 struct _RygelMediaExportWritableDbContainerAddItemData {
@@ -133,40 +83,24 @@ struct _RygelMediaExportWritableDbContainerRemoveItemData {
 	GError * _inner_error_;
 };
 
-
-static gpointer rygel_media_export_writable_db_container_parent_class = NULL;
-static RygelWritableContainerIface* rygel_media_export_writable_db_container_rygel_writable_container_parent_iface = 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_writable_db_container_get_type (void) G_GNUC_CONST;
 #define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerPrivate))
 enum  {
 	RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_DUMMY_PROPERTY,
 	RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CREATE_CLASSES
 };
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportDBContainer* rygel_media_export_db_container_new (RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
-RygelMediaExportDBContainer* rygel_media_export_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title);
 static void rygel_media_export_writable_db_container_real_add_item_data_free (gpointer _data);
 static void rygel_media_export_writable_db_container_real_add_item (RygelWritableContainer* base, RygelMediaItem* item, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_writable_db_container_real_add_item_co (RygelMediaExportWritableDbContainerAddItemData* _data_);
-gchar* rygel_media_export_media_cache_get_id (GFile* file);
-void rygel_media_export_media_cache_save_item (RygelMediaExportMediaCache* self, RygelMediaItem* item, GError** error);
 static void rygel_media_export_writable_db_container_real_remove_item_data_free (gpointer _data);
 static void rygel_media_export_writable_db_container_real_remove_item (RygelWritableContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 static gboolean rygel_media_export_writable_db_container_real_remove_item_co (RygelMediaExportWritableDbContainerRemoveItemData* _data_);
-GQuark rygel_media_export_database_error_quark (void);
-void rygel_media_export_media_cache_remove_by_id (RygelMediaExportMediaCache* self, const gchar* id, GError** error);
 static void rygel_media_export_writable_db_container_finalize (GObject* obj);
 static void _vala_rygel_media_export_writable_db_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 static void _vala_rygel_media_export_writable_db_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
 
-RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title) {
+static RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_construct (GType object_type, RygelMediaExportMediaCache* media_db, const gchar* id, const gchar* title) {
 	RygelMediaExportWritableDbContainer * self = NULL;
-	RygelMediaExportMediaCache* _tmp0_;
 	const gchar* _tmp1_;
 	const gchar* _tmp2_;
 	GeeArrayList* _tmp3_;
@@ -184,10 +118,14 @@ RygelMediaExportWritableDbContainer* rygel_media_export_writable_db_container_co
 	g_return_val_if_fail (media_db != NULL, NULL);
 	g_return_val_if_fail (id != NULL, NULL);
 	g_return_val_if_fail (title != NULL, NULL);
-	_tmp0_ = media_db;
 	_tmp1_ = id;
 	_tmp2_ = title;
-	self = (RygelMediaExportWritableDbContainer*) rygel_media_export_db_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_);
+	self = RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER (g_object_new (object_type,
+								       "id", _tmp1_,
+								       "parent", NULL,
+								       "title", _tmp2_,
+								       "child-count", 0,
+								       NULL));
 	_tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
 	_tmp4_ = _tmp3_;
 	rygel_writable_container_set_create_classes ((RygelWritableContainer*) self, _tmp4_);
@@ -251,12 +189,8 @@ static void rygel_media_export_writable_db_container_real_add_item (RygelWritabl
 }
 
 
-static void rygel_media_export_writable_db_container_real_add_item_finish (RygelWritableContainer* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaExportWritableDbContainerAddItemData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_writable_db_container_real_add_item_finish (RygelWritableContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
 }
 
 
@@ -269,7 +203,7 @@ static gboolean rygel_media_export_writable_db_container_real_add_item_co (Rygel
 	}
 	_state_0:
 	_data_->_tmp0_ = _data_->item;
-	((RygelMediaObject*) _data_->_tmp0_)->parent = (RygelMediaContainer*) _data_->self;
+	rygel_media_object_set_parent ((RygelMediaObject*) _data_->_tmp0_, (RygelMediaContainer*) _data_->self);
 	_data_->_tmp1_ = _data_->item;
 	_data_->_tmp2_ = ((RygelMediaObject*) _data_->_tmp1_)->uris;
 	_data_->_tmp3_ = NULL;
@@ -357,12 +291,8 @@ static void rygel_media_export_writable_db_container_real_remove_item (RygelWrit
 }
 
 
-static void rygel_media_export_writable_db_container_real_remove_item_finish (RygelWritableContainer* base, GAsyncResult* _res_, GError** error) {
-	RygelMediaExportWritableDbContainerRemoveItemData* _data_;
-	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
-		return;
-	}
-	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
+static void rygel_media_export_writable_db_container_real_remove_item_finish (RygelWritableContainer* base G_GNUC_UNUSED, GAsyncResult* _res_, GError** error) {
+  g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error);
 }
 
 
@@ -403,7 +333,7 @@ static GeeArrayList* rygel_media_export_writable_db_container_real_get_create_cl
 	RygelMediaExportWritableDbContainer* self;
 	GeeArrayList* _tmp0_;
 	self = (RygelMediaExportWritableDbContainer*) base;
-	_tmp0_ = self->priv->_create_classes;
+	_tmp0_ = self->priv->create_classes;
 	result = _tmp0_;
 	return result;
 }
@@ -416,14 +346,13 @@ static void rygel_media_export_writable_db_container_real_set_create_classes (Ry
 	self = (RygelMediaExportWritableDbContainer*) base;
 	_tmp0_ = value;
 	_tmp1_ = g_object_ref (_tmp0_);
-	g_object_unref (self->priv->_create_classes);
-	self->priv->_create_classes = _tmp1_;
+	g_object_unref (self->priv->create_classes);
+	self->priv->create_classes = _tmp1_;
 	g_object_notify ((GObject *) self, "create-classes");
 }
 
 
 static void rygel_media_export_writable_db_container_class_init (RygelMediaExportWritableDbContainerClass * klass) {
-	rygel_media_export_writable_db_container_parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (RygelMediaExportWritableDbContainerPrivate));
 	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_writable_db_container_get_property;
 	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_writable_db_container_set_property;
@@ -433,10 +362,9 @@ static void rygel_media_export_writable_db_container_class_init (RygelMediaExpor
 
 
 static void rygel_media_export_writable_db_container_rygel_writable_container_interface_init (RygelWritableContainerIface * iface) {
-	rygel_media_export_writable_db_container_rygel_writable_container_parent_iface = g_type_interface_peek_parent (iface);
-	iface->add_item = (void (*)(RygelWritableContainer*, RygelMediaItem*, GCancellable*, GError**)) rygel_media_export_writable_db_container_real_add_item;
+	iface->add_item = rygel_media_export_writable_db_container_real_add_item;
 	iface->add_item_finish = rygel_media_export_writable_db_container_real_add_item_finish;
-	iface->remove_item = (void (*)(RygelWritableContainer*, const gchar*, GCancellable*, GError**)) rygel_media_export_writable_db_container_real_remove_item;
+	iface->remove_item = rygel_media_export_writable_db_container_real_remove_item;
 	iface->remove_item_finish = rygel_media_export_writable_db_container_real_remove_item_finish;
 	iface->get_create_classes = rygel_media_export_writable_db_container_real_get_create_classes;
 	iface->set_create_classes = rygel_media_export_writable_db_container_real_set_create_classes;
@@ -451,25 +379,11 @@ static void rygel_media_export_writable_db_container_init (RygelMediaExportWrita
 static void rygel_media_export_writable_db_container_finalize (GObject* obj) {
 	RygelMediaExportWritableDbContainer * self;
 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer);
-	g_object_unref (self->priv->_create_classes);
+	g_object_unref (self->priv->create_classes);
 	G_OBJECT_CLASS (rygel_media_export_writable_db_container_parent_class)->finalize (obj);
 }
 
 
-GType rygel_media_export_writable_db_container_get_type (void) {
-	static volatile gsize rygel_media_export_writable_db_container_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_writable_db_container_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportWritableDbContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_writable_db_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportWritableDbContainer), 0, (GInstanceInitFunc) rygel_media_export_writable_db_container_init, NULL };
-		static const GInterfaceInfo rygel_writable_container_info = { (GInterfaceInitFunc) rygel_media_export_writable_db_container_rygel_writable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
-		GType rygel_media_export_writable_db_container_type_id;
-		rygel_media_export_writable_db_container_type_id = g_type_register_static (RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, "RygelMediaExportWritableDbContainer", &g_define_type_info, 0);
-		g_type_add_interface_static (rygel_media_export_writable_db_container_type_id, RYGEL_TYPE_WRITABLE_CONTAINER, &rygel_writable_container_info);
-		g_once_init_leave (&rygel_media_export_writable_db_container_type_id__volatile, rygel_media_export_writable_db_container_type_id);
-	}
-	return rygel_media_export_writable_db_container_type_id__volatile;
-}
-
-
 static void _vala_rygel_media_export_writable_db_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 	RygelMediaExportWritableDbContainer * self;
 	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer);
@@ -496,6 +410,3 @@ static void _vala_rygel_media_export_writable_db_container_set_property (GObject
 		break;
 	}
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-writable-db-container.h b/src/media-export/rygel-media-export-writable-db-container.h
new file mode 100644
index 0000000..d86e613
--- /dev/null
+++ b/src/media-export/rygel-media-export-writable-db-container.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Jens Georg <mail jensge org>.
+ *
+ * Author: 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_WRITABLE_CONTAINER_H__
+#define __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_WRITABLE_CONTAINER_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "rygel-media-export-db-container.h"
+
+G_BEGIN_DECLS
+
+#define RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER (rygel_media_export_writable_db_container_get_type ())
+#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainer))
+#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
+#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_IS_WRITABLE_DB_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER))
+#define RYGEL_MEDIA_EXPORT_WRITABLE_DB_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_WRITABLE_DB_CONTAINER, RygelMediaExportWritableDbContainerClass))
+
+typedef struct _RygelMediaExportWritableDbContainer RygelMediaExportWritableDbContainer;
+typedef struct _RygelMediaExportWritableDbContainerClass RygelMediaExportWritableDbContainerClass;
+typedef struct _RygelMediaExportWritableDbContainerPrivate RygelMediaExportWritableDbContainerPrivate;
+
+struct _RygelMediaExportWritableDbContainer {
+  RygelMediaExportDBContainer parent_instance;
+  RygelMediaExportWritableDbContainerPrivate *priv;
+};
+
+struct _RygelMediaExportWritableDbContainerClass {
+  RygelMediaExportDBContainerClass parent_class;
+};
+
+GType
+rygel_media_export_writable_db_container_get_type (void) G_GNUC_CONST;
+
+RygelMediaExportWritableDbContainer *
+rygel_media_export_writable_db_container_new (RygelMediaExportMediaCache *media_db,
+					      const gchar                *id,
+					      const gchar                *title);
+
+G_END_DECLS
+
+#endif
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1054593..69f0b40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,9 +2,11 @@ noinst_PROGRAMS = test_simple
 test_simple_SOURCES = test_simple.c
 test_simple_CFLAGS = \
 	$(DEPS_CFLAGS) \
+	$(COLLATION_CFLAGS) \
 	-I$(top_builddir)/src/media-export -I$(top_srcdir)/src/media-export
 test_simple_LDADD = \
 	$(DEPS_LIBS) \
+	$(COLLATION_LIBS) \
 	$(top_builddir)/src/media-export/librygel-media-export-gst-0-10.la
 
 
diff --git a/tests/test_simple.c b/tests/test_simple.c
index 2b9a082..7aab422 100644
--- a/tests/test_simple.c
+++ b/tests/test_simple.c
@@ -18,8 +18,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <gee.h>
+#include <gst/gst.h>
+
 #include "rygel-media-export-plugin.h"
 #include "rygel-media-export-root-container.h"
+#include "rygel-media-export-null-container.h"
 
 int main(int argc, char *argv[])
 {
@@ -46,14 +50,15 @@ int main(int argc, char *argv[])
 
   /* Check the plugin: */
   GeeIterator* iter = gee_iterable_iterator (GEE_ITERABLE (list_plugins));
+  g_assert (gee_iterator_next (iter));
   RygelMediaServerPlugin *plugin = gee_iterator_get (iter);
   g_assert (plugin);
-  g_assert (RYGEL_MEDIA_EXPORT_PLUGIN (plugin));
+  g_assert (RYGEL_MEDIA_EXPORT_IS_PLUGIN (plugin));
 
   /* Check the plugin's root container: */
   RygelMediaContainer *root_container = rygel_media_server_plugin_get_root_container (plugin);
   g_assert (root_container);
-  g_assert (RYGEL_MEDIA_EXPORT_ROOT_CONTAINER (root_container));
+  g_assert (RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER (root_container) || RYGEL_MEDIA_EXPORT_IS_NULL_CONTAINER (root_container));
 
   /* unref: */
   g_object_unref (root_container);



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