[rygel-gst-0-10-plugins] Cleanup RygelMediaExportQueryContainerFactory.



commit 6d3f5cb7ef784c9162ec6784016836e7c9faf5ad
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Tue Feb 5 09:06:23 2013 +0100

    Cleanup RygelMediaExportQueryContainerFactory.

 .../rygel-media-export-query-container-factory.c   | 1097 +++++++-------------
 1 files changed, 378 insertions(+), 719 deletions(-)
---
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 75b8929..9806407 100644
--- a/src/media-export/rygel-media-export-query-container-factory.c
+++ b/src/media-export/rygel-media-export-query-container-factory.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-query-container-factory.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-query-container-factory.vala, do not modify */
-
 /*
  * Copyright (C) 2011 Jens Georg <mail jensge org>.
  *
@@ -24,9 +21,11 @@
 #include "rygel-media-export-leaf-query-container.h"
 #include "rygel-media-export-node-query-container.h"
 #include "rygel-media-export-query-container-factory.h"
+#include "rygel-media-export-string-utils.h"
 
-typedef struct _RygelMediaExportQueryContainerFactory RygelMediaExportQueryContainerFactory;
-typedef struct _RygelMediaExportQueryContainerFactoryClass RygelMediaExportQueryContainerFactoryClass;
+G_DEFINE_TYPE (RygelMediaExportQueryContainerFactory,
+	       rygel_media_export_query_container_factory,
+	       G_TYPE_OBJECT)
 
 #define rygel_search_expression_unref(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
 
@@ -34,760 +33,420 @@ struct _RygelMediaExportQueryContainerFactoryPrivate {
   GeeHashMap *virtual_container_map;
 };
 
-
-static gpointer rygel_media_export_query_container_factory_parent_class = NULL;
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_instance;
-static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_instance = NULL;
 
-#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactoryPrivate))
-enum  {
-	RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_DUMMY_PROPERTY
-};
+#define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+				RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, \
+				RygelMediaExportQueryContainerFactoryPrivate))
+
 static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_new (void);
-static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_construct (GType object_type);
-static RygelSearchExpression* rygel_media_export_query_container_factory_parse_description (RygelMediaExportQueryContainerFactory* self, const gchar* description, gchar** pattern, gchar** attribute, gchar** upnp_class, gchar** name);
-static gchar* rygel_media_export_query_container_factory_map_upnp_class (RygelMediaExportQueryContainerFactory* self, const gchar* attribute);
-static void rygel_media_export_query_container_factory_update_search_expression (RygelMediaExportQueryContainerFactory* self, RygelSearchExpression** expression, const gchar* key, const gchar* value);
-static void rygel_media_export_query_container_factory_finalize (GObject* obj);
-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);
-
-
-RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_get_default (void) {
-	RygelMediaExportQueryContainerFactory* result = NULL;
-	RygelMediaExportQueryContainerFactory* _tmp0_;
-	gboolean _tmp1_ = FALSE;
-	RygelMediaExportQueryContainerFactory* _tmp3_;
-	RygelMediaExportQueryContainerFactory* _tmp4_;
-	_tmp0_ = rygel_media_export_query_container_factory_instance;
-	_tmp1_ = G_UNLIKELY (_tmp0_ == NULL);
-	if (_tmp1_) {
-		RygelMediaExportQueryContainerFactory* _tmp2_;
-		_tmp2_ = rygel_media_export_query_container_factory_new ();
-		g_object_unref (rygel_media_export_query_container_factory_instance);
-		rygel_media_export_query_container_factory_instance = _tmp2_;
-	}
-	_tmp3_ = rygel_media_export_query_container_factory_instance;
-	_tmp4_ = g_object_ref (_tmp3_);
-	result = _tmp4_;
-	return result;
-}
+static RygelSearchExpression* rygel_media_export_query_container_factory_parse_description (const gchar* description, gchar** pattern, gchar** attribute, gchar** upnp_class, gchar** name);
+static gchar* rygel_media_export_query_container_factory_map_upnp_class (const gchar* attribute);
+static void rygel_media_export_query_container_factory_update_search_expression (RygelSearchExpression** expression, const gchar* key, const gchar* value);
 
+RygelMediaExportQueryContainerFactory *
+rygel_media_export_query_container_factory_get_default (void) {
+  if (G_UNLIKELY (!rygel_media_export_query_container_factory_instance)) {
+    rygel_media_export_query_container_factory_instance = rygel_media_export_query_container_factory_new ();
+  }
 
-static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_construct (GType object_type) {
-	RygelMediaExportQueryContainerFactory * self = NULL;
-	GeeHashMap* _tmp0_;
-	self = (RygelMediaExportQueryContainerFactory*) g_object_new (object_type, NULL);
-	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-	g_object_unref (self->priv->virtual_container_map);
-	self->priv->virtual_container_map = _tmp0_;
-	return self;
+  return g_object_ref (rygel_media_export_query_container_factory_instance);
 }
 
-
-static RygelMediaExportQueryContainerFactory* rygel_media_export_query_container_factory_new (void) {
-	return rygel_media_export_query_container_factory_construct (RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY);
+static RygelMediaExportQueryContainerFactory *
+rygel_media_export_query_container_factory_new (void) {
+  return RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY,
+								   NULL));
 }
 
-
 /**
-     * Register a plaintext description for a query container. The passed
-     * string will be modified to the checksum id of the container.
-     *
-     * @param id Originally contains the plaintext id which is replaced with
-     *           the hashed id on return.
-     */
-void rygel_media_export_query_container_factory_register_id (RygelMediaExportQueryContainerFactory* self, gchar** id) {
-	const gchar* _tmp0_;
-	gchar* _tmp1_ = NULL;
-	gchar* md5;
-	GeeHashMap* _tmp2_;
-	const gchar* _tmp3_;
-	gboolean _tmp4_ = FALSE;
-	const gchar* _tmp10_;
-	gchar* _tmp11_;
-	g_return_if_fail (self != NULL);
-	g_return_if_fail (*id != NULL);
-	_tmp0_ = *id;
-	_tmp1_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _tmp0_, (gsize) (-1));
-	md5 = _tmp1_;
-	_tmp2_ = self->priv->virtual_container_map;
-	_tmp3_ = md5;
-	_tmp4_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp2_, _tmp3_);
-	if (!_tmp4_) {
-		GeeHashMap* _tmp5_;
-		const gchar* _tmp6_;
-		const gchar* _tmp7_;
-		const gchar* _tmp8_;
-		const gchar* _tmp9_;
-		_tmp5_ = self->priv->virtual_container_map;
-		_tmp6_ = md5;
-		_tmp7_ = *id;
-		gee_abstract_map_set ((GeeAbstractMap*) _tmp5_, _tmp6_, _tmp7_);
-		_tmp8_ = md5;
-		_tmp9_ = *id;
-		g_debug ("rygel-media-export-query-container-factory.vala:58: Registering %s for" \
-" %s", _tmp8_, _tmp9_);
-	}
-	_tmp10_ = md5;
-	_tmp11_ = g_strconcat (RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, _tmp10_, NULL);
-	g_free (*id);
-	*id = _tmp11_;
-	g_free (md5);
+ * Register a plaintext description for a query container. The passed
+ * string will be modified to the checksum id of the container.
+ *
+ * @param id Originally contains the plaintext id which is replaced with
+ *           the hashed id on return.
+ */
+void
+rygel_media_export_query_container_factory_register_id (RygelMediaExportQueryContainerFactory  *self,
+							gchar                                 **id) {
+  gchar *md5;
+  gchar *tmp;
+  GeeAbstractMap *abstract_virtuals;
+  RygelMediaExportQueryContainerFactoryPrivate *priv;
+
+  g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY (self));
+  g_return_if_fail (id != NULL);
+  g_return_if_fail (*id != NULL);
+
+  priv = self->priv;
+  md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, *id, (gsize) (-1));
+  abstract_virtuals = GEE_ABSTRACT_MAP (priv->virtual_container_map);
+
+  if (!gee_abstract_map_has_key (abstract_virtuals, md5)) {
+    gee_abstract_map_set (abstract_virtuals, md5, *id);
+    g_debug ("Registering %s for %s", md5, *id);
+  }
+  tmp = g_strconcat (RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, md5, NULL);
+  g_free (md5);
+  g_free (*id);
+  *id = tmp;
 }
 
-
 /**
-     * Get the plaintext definition from a hashed id.
-     *
-     * Inverse function of register_id().
-     *
-     * @param hash A hashed id
-     * @return the plaintext defintion of the virtual folder
-     */
-static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
-	gchar* result = NULL;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (old != NULL, NULL);
-	g_return_val_if_fail (replacement != NULL, NULL);
-	{
-		const gchar* _tmp0_;
-		gchar* _tmp1_ = NULL;
-		gchar* _tmp2_;
-		GRegex* _tmp3_;
-		GRegex* _tmp4_;
-		GRegex* regex;
-		GRegex* _tmp5_;
-		const gchar* _tmp6_;
-		gchar* _tmp7_ = NULL;
-		gchar* _tmp8_;
-		_tmp0_ = old;
-		_tmp1_ = g_regex_escape_string (_tmp0_, -1);
-		_tmp2_ = _tmp1_;
-		_tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_);
-		_tmp4_ = _tmp3_;
-		g_free (_tmp2_);
-		regex = _tmp4_;
-		if (_inner_error_ != NULL) {
-			if (_inner_error_->domain == G_REGEX_ERROR) {
-				goto __catch40_g_regex_error;
-			}
-			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-			g_clear_error (&_inner_error_);
-			return NULL;
-		}
-		_tmp5_ = regex;
-		_tmp6_ = replacement;
-		_tmp7_ = g_regex_replace_literal (_tmp5_, self, (gssize) (-1), 0, _tmp6_, 0, &_inner_error_);
-		_tmp8_ = _tmp7_;
-		if (_inner_error_ != NULL) {
-			g_regex_unref (regex);
-			if (_inner_error_->domain == G_REGEX_ERROR) {
-				goto __catch40_g_regex_error;
-			}
-			g_regex_unref (regex);
-			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-			g_clear_error (&_inner_error_);
-			return NULL;
-		}
-		result = _tmp8_;
-		g_regex_unref (regex);
-		return result;
-	}
-	goto __finally40;
-	__catch40_g_regex_error:
-	{
-		GError* e = NULL;
-		e = _inner_error_;
-		_inner_error_ = NULL;
-		g_assert_not_reached ();
-		g_error_free (e);
-	}
-	__finally40:
-	if (_inner_error_ != NULL) {
-		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-		g_clear_error (&_inner_error_);
-		return NULL;
-	}
-}
-
-
-gchar* rygel_media_export_query_container_factory_get_virtual_container_definition (RygelMediaExportQueryContainerFactory* self, const gchar* hash) {
-	gchar* result = NULL;
-	const gchar* _tmp0_;
-	gchar* _tmp1_ = NULL;
-	gchar* id;
-	GeeHashMap* _tmp2_;
-	gpointer _tmp3_ = NULL;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (hash != NULL, NULL);
-	_tmp0_ = hash;
-	_tmp1_ = string_replace (_tmp0_, RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, "");
-	id = _tmp1_;
-	_tmp2_ = self->priv->virtual_container_map;
-	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp2_, id);
-	result = (gchar*) _tmp3_;
-	g_free (id);
-	return result;
+ * Get the plaintext definition from a hashed id.
+ *
+ * Inverse function of register_id().
+ *
+ * @param hash A hashed id
+ * @return the plaintext defintion of the virtual folder
+ */
+gchar *
+rygel_media_export_query_container_factory_get_virtual_container_definition (RygelMediaExportQueryContainerFactory *self,
+									     const gchar                           *hash) {
+  gchar *definition;
+  gchar *id;
+  GError *inner_error;
+  RygelMediaExportQueryContainerFactoryPrivate *priv;
+
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY (self), NULL);
+  g_return_val_if_fail (hash != NULL, NULL);
+
+  priv = self->priv;
+  inner_error = NULL;
+  id = rygel_media_export_string_replace (hash,
+					  RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX,
+					  "",
+					  &inner_error);
+  if (inner_error) {
+    g_warning ("Failed to remove " RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX " from %s: %s",
+	       hash,
+	       inner_error->message);
+    g_error_free (inner_error);
+    return NULL;
+  }
+  definition = gee_abstract_map_get (GEE_ABSTRACT_MAP (priv->virtual_container_map), id);
+  g_free (id);
+  return definition;
 }
 
-
 /**
-     * Factory method.
-     *
-     * Create a QueryContainer directly from MD5 hashed id.
-     *
-     * @param cache An instance of the meta-data cache
-     * @param id    The hashed id of the container
-     * @param name  An the title of the container. If not supplied, it will
-     *              be derived from the plain-text description of the
-     *              container
-     * @return A new instance of QueryContainer or null if id does not exist
-     */
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_id (RygelMediaExportQueryContainerFactory* self, const gchar* id, const gchar* name) {
-	RygelMediaExportQueryContainer* result = NULL;
-	const gchar* _tmp0_;
-	gchar* _tmp1_ = NULL;
-	gchar* definition;
-	const gchar* _tmp2_;
-	const gchar* _tmp4_;
-	const gchar* _tmp5_;
-	RygelMediaExportQueryContainer* _tmp6_ = NULL;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (id != NULL, NULL);
-	g_return_val_if_fail (name != NULL, NULL);
-	_tmp0_ = id;
-	_tmp1_ = rygel_media_export_query_container_factory_get_virtual_container_definition (self, _tmp0_);
-	definition = _tmp1_;
-	_tmp2_ = definition;
-	if (_tmp2_ == NULL) {
-		result = NULL;
-		g_free (definition);
-		return result;
-	}
-	_tmp4_ = definition;
-	_tmp5_ = name;
-	_tmp6_ = rygel_media_export_query_container_factory_create_from_description (self, _tmp4_, _tmp5_);
-	result = _tmp6_;
-	g_free (definition);
-	return result;
+ * Factory method.
+ *
+ * Create a QueryContainer directly from MD5 hashed id.
+ *
+ * @param cache An instance of the meta-data cache
+ * @param id    The hashed id of the container
+ * @param name  An the title of the container. If not supplied, it will
+ *              be derived from the plain-text description of the
+ *              container
+ * @return A new instance of QueryContainer or null if id does not exist
+ */
+RygelMediaExportQueryContainer *
+rygel_media_export_query_container_factory_create_from_id (RygelMediaExportQueryContainerFactory *self,
+							   const gchar                           *id,
+							   const gchar                           *name) {
+  RygelMediaExportQueryContainer *container;
+  gchar *definition;
+
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY (self), NULL);
+  g_return_val_if_fail (id != NULL, NULL);
+  g_return_val_if_fail (name != NULL, NULL);
+
+  definition = rygel_media_export_query_container_factory_get_virtual_container_definition (self, id);
+  if (!definition) {
+    g_free (definition);
+    return NULL;
+  }
+
+  container = rygel_media_export_query_container_factory_create_from_description (self, definition, name);
+  g_free (definition);
+  return container;
 }
 
-
 /**
-     * Factory method.
-     *
-     * Create a QueryContainer from a plain-text description string.
-     *
-     * @param definition Plain-text defintion of the query-container
-     * @param name       The title of the container. If not supplied, it
-     *                   will be derived from the plain-text description of
-     *                   the container
-     * @return A new instance of QueryContainer
-     */
-RygelMediaExportQueryContainer* rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory* self, const gchar* definition, const gchar* name) {
-	RygelMediaExportQueryContainer* result = NULL;
-	const gchar* _tmp0_;
-	gchar* _tmp1_;
-	gchar* title;
-	gchar* attribute;
-	gchar* pattern;
-	gchar* upnp_class;
-	const gchar* _tmp2_;
-	gchar* _tmp3_;
-	gchar* id;
-	RygelMediaExportQueryContainer* container = NULL;
-	const gchar* _tmp4_;
-	gchar* _tmp5_ = NULL;
-	gchar* _tmp6_ = NULL;
-	gchar* _tmp7_ = NULL;
-	RygelSearchExpression* _tmp8_ = NULL;
-	RygelSearchExpression* expression;
-	gboolean _tmp9_ = FALSE;
-	const gchar* _tmp10_;
-	gboolean _tmp12_;
-	const gchar* _tmp25_;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (definition != NULL, NULL);
-	g_return_val_if_fail (name != NULL, NULL);
-	_tmp0_ = name;
-	_tmp1_ = g_strdup (_tmp0_);
-	title = _tmp1_;
-	attribute = NULL;
-	pattern = NULL;
-	upnp_class = NULL;
-	_tmp2_ = definition;
-	_tmp3_ = g_strdup (_tmp2_);
-	id = _tmp3_;
-	rygel_media_export_query_container_factory_register_id (self, &id);
-	_tmp4_ = definition;
-	_tmp8_ = rygel_media_export_query_container_factory_parse_description (self, _tmp4_, &_tmp5_, &_tmp6_, &_tmp7_, &title);
-	g_free (pattern);
-	pattern = _tmp5_;
-	g_free (attribute);
-	attribute = _tmp6_;
-	g_free (upnp_class);
-	upnp_class = _tmp7_;
-	expression = _tmp8_;
-	_tmp10_ = pattern;
-	if (_tmp10_ == NULL) {
-		_tmp9_ = TRUE;
-	} else {
-		const gchar* _tmp11_;
-		_tmp11_ = pattern;
-		_tmp9_ = g_strcmp0 (_tmp11_, "") == 0;
-	}
-	_tmp12_ = _tmp9_;
-	if (_tmp12_) {
-		RygelSearchExpression* _tmp14_;
-		const gchar* _tmp15_;
-		const gchar* _tmp16_;
-		RygelMediaExportLeafQueryContainer* _tmp17_;
-		_tmp14_ = expression;
-		_tmp15_ = id;
-		_tmp16_ = title;
-		_tmp17_ = rygel_media_export_leaf_query_container_new (_tmp14_, _tmp15_, _tmp16_);
-		g_object_unref (container);
-		container = (RygelMediaExportQueryContainer*) _tmp17_;
-	} else {
-		RygelSearchExpression* _tmp19_;
-		const gchar* _tmp20_;
-		const gchar* _tmp21_;
-		const gchar* _tmp22_;
-		const gchar* _tmp23_;
-		RygelMediaExportNodeQueryContainer* _tmp24_;
-		_tmp19_ = expression;
-		_tmp20_ = id;
-		_tmp21_ = title;
-		_tmp22_ = pattern;
-		_tmp23_ = attribute;
-		_tmp24_ = rygel_media_export_node_query_container_new (_tmp19_, _tmp20_, _tmp21_, _tmp22_, _tmp23_);
-		g_object_unref (container);
-		container = (RygelMediaExportQueryContainer*) _tmp24_;
-	}
-	_tmp25_ = upnp_class;
-	if (_tmp25_ != NULL) {
-		RygelMediaExportQueryContainer* _tmp26_;
-		const gchar* _tmp27_;
-		const gchar* _tmp28_;
-		_tmp26_ = container;
-		_tmp27_ = upnp_class;
-		rygel_media_object_set_upnp_class ((RygelMediaObject*) _tmp26_, _tmp27_);
-		_tmp28_ = upnp_class;
-		if (g_strcmp0 (_tmp28_, RYGEL_MEDIA_CONTAINER_MUSIC_ALBUM) == 0) {
-			RygelMediaExportQueryContainer* _tmp29_;
-			_tmp29_ = container;
-			rygel_media_container_set_sort_criteria ((RygelMediaContainer*) _tmp29_, RYGEL_MEDIA_CONTAINER_ALBUM_SORT_CRITERIA);
-		}
-	}
-	result = container;
-	rygel_search_expression_unref (expression);
-	g_free (id);
-	g_free (upnp_class);
-	g_free (pattern);
-	g_free (attribute);
-	g_free (title);
-	return result;
+ * Factory method.
+ *
+ * Create a QueryContainer from a plain-text description string.
+ *
+ * @param definition Plain-text defintion of the query-container
+ * @param name       The title of the container. If not supplied, it
+ *                   will be derived from the plain-text description of
+ *                   the container
+ * @return A new instance of QueryContainer
+ */
+RygelMediaExportQueryContainer *
+rygel_media_export_query_container_factory_create_from_description (RygelMediaExportQueryContainerFactory *self,
+								    const gchar                           *definition,
+								    const gchar                           *name) {
+  gchar *title;
+  gchar *attribute;
+  gchar *pattern;
+  gchar *upnp_class;
+  gchar *id;
+  RygelMediaExportQueryContainer *container;
+  RygelSearchExpression *expression;
+
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_QUERY_CONTAINER_FACTORY (self), NULL);
+  g_return_val_if_fail (definition != NULL, NULL);
+  g_return_val_if_fail (name != NULL, NULL);
+
+  title = g_strdup (name);
+  attribute = NULL;
+  pattern = NULL;
+  upnp_class = NULL;
+
+  id = g_strdup (definition);
+  rygel_media_export_query_container_factory_register_id (self, &id);
+  expression = rygel_media_export_query_container_factory_parse_description (definition,
+									     &pattern,
+									     &attribute,
+									     &upnp_class,
+									     &title);
+  if (!pattern || pattern[0] == '\0') {
+    container = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (rygel_media_export_leaf_query_container_new (expression, id, title));
+  } else {
+    container = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER (rygel_media_export_node_query_container_new (expression, id, title, pattern, attribute));
+  }
+
+  if (upnp_class) {
+    rygel_media_object_set_upnp_class (RYGEL_MEDIA_OBJECT (container), upnp_class);
+    if (!g_strcmp0 (upnp_class, RYGEL_MEDIA_CONTAINER_MUSIC_ALBUM)) {
+      rygel_media_container_set_sort_criteria (RYGEL_MEDIA_CONTAINER (container),
+					       RYGEL_MEDIA_CONTAINER_ALBUM_SORT_CRITERIA);
+    }
+  }
+  rygel_search_expression_unref (expression);
+  g_free (id);
+  g_free (upnp_class);
+  g_free (pattern);
+  g_free (attribute);
+  g_free (title);
+
+  return container;
 }
 
-
 /**
-     * Map a DIDL attribute to a UPnP container class.
-     *
-     * @return A matching UPnP class for the attribute or null if it can't be
-     *         mapped.
-     */
-static gchar* rygel_media_export_query_container_factory_map_upnp_class (RygelMediaExportQueryContainerFactory* self, const gchar* attribute) {
-	gchar* result = NULL;
-	const gchar* _tmp0_;
-	const gchar* _tmp1_;
-	GQuark _tmp3_ = 0U;
-	static GQuark _tmp2_label0 = 0;
-	static GQuark _tmp2_label1 = 0;
-	static GQuark _tmp2_label2 = 0;
-	static GQuark _tmp2_label3 = 0;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (attribute != NULL, NULL);
-	_tmp0_ = attribute;
-	_tmp1_ = _tmp0_;
-	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
-	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("upnp:album")))) {
-		switch (0) {
-			default:
-			{
-				gchar* _tmp4_;
-				_tmp4_ = g_strdup (RYGEL_MEDIA_CONTAINER_MUSIC_ALBUM);
-				result = _tmp4_;
-				return result;
-			}
-		}
-	} else if ((_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("dc:creator")))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string ("upnp:artist"))))) {
-		switch (0) {
-			default:
-			{
-				gchar* _tmp5_;
-				_tmp5_ = g_strdup (RYGEL_MEDIA_CONTAINER_MUSIC_ARTIST);
-				result = _tmp5_;
-				return result;
-			}
-		}
-	} else if (_tmp3_ == ((0 != _tmp2_label3) ? _tmp2_label3 : (_tmp2_label3 = g_quark_from_static_string ("dc:genre")))) {
-		switch (0) {
-			default:
-			{
-				gchar* _tmp6_;
-				_tmp6_ = g_strdup (RYGEL_MEDIA_CONTAINER_MUSIC_GENRE);
-				result = _tmp6_;
-				return result;
-			}
-		}
-	} else {
-		switch (0) {
-			default:
-			{
-				result = NULL;
-				return result;
-			}
-		}
-	}
+ * Map a DIDL attribute to a UPnP container class.
+ *
+ * @return A matching UPnP class for the attribute or null if it can't be
+ *         mapped.
+ */
+static gchar *
+rygel_media_export_query_container_factory_map_upnp_class (const gchar *attribute) {
+  const gchar *upnp_class;
+
+  g_return_val_if_fail (attribute != NULL, NULL);
+
+  if (!g_strcmp0 (attribute, "upnp:album")) {
+    upnp_class = RYGEL_MEDIA_CONTAINER_MUSIC_ALBUM;
+  } else if (!g_strcmp0 (attribute, "dc:creator") || !g_strcmp0 (attribute, "upnp:artist")) {
+    upnp_class = RYGEL_MEDIA_CONTAINER_MUSIC_ARTIST;
+  } else if (!g_strcmp0 (attribute, "dc:genre")) {
+    upnp_class = RYGEL_MEDIA_CONTAINER_MUSIC_GENRE;
+  } else {
+    upnp_class = NULL;
+  }
+
+  return g_strdup (upnp_class);
 }
 
-
 /**
-     * Parse a plaintext container description into a search expression.
-     *
-     * Also generates a name for the container and other meta-data necessary
-     * for node containers.
-     *
-     * @param description The plaintext container description
-     * @param pattern     Contains the pattern used for child containers if
-     *                    descrption is for a node container, null otherwise.
-     * @param attribute   Contains the UPnP attribute the container describes.
-     * @param name        If passed empty, name will be generated from the
-     *                    description.
-     * @return A SearchExpression corresponding to the non-variable part of
-     *         the description.
-     */
-static gpointer _rygel_search_expression_ref0 (gpointer self) {
-	return self ? rygel_search_expression_ref (self) : NULL;
-}
-
-
-static RygelSearchExpression* rygel_media_export_query_container_factory_parse_description (RygelMediaExportQueryContainerFactory* self, const gchar* description, gchar** pattern, gchar** attribute, gchar** upnp_class, gchar** name) {
-	gchar* _vala_pattern = NULL;
-	gchar* _vala_attribute = NULL;
-	gchar* _vala_upnp_class = NULL;
-	RygelSearchExpression* result = NULL;
-	const gchar* _tmp0_;
-	gchar** _tmp1_;
-	gchar** _tmp2_ = NULL;
-	gchar** args;
-	gint args_length1;
-	RygelSearchExpression* _tmp3_;
-	RygelSearchExpression* expression;
-	gint i;
-	g_return_val_if_fail (self != NULL, NULL);
-	g_return_val_if_fail (description != NULL, NULL);
-	g_return_val_if_fail (*name != NULL, NULL);
-	_tmp0_ = description;
-	_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, ",", 0);
-	args = _tmp2_;
-	args_length1 = _vala_array_length (_tmp1_);
-	_tmp3_ = _rygel_search_expression_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (NULL, RYGEL_TYPE_SEARCH_EXPRESSION) ? ((RygelSearchExpression*) NULL) : NULL);
-	expression = _tmp3_;
-	g_free (_vala_pattern);
-	_vala_pattern = NULL;
-	g_free (_vala_attribute);
-	_vala_attribute = NULL;
-	g_free (_vala_upnp_class);
-	_vala_upnp_class = NULL;
-	i = 0;
-	while (TRUE) {
-		gint _tmp4_;
-		gint _tmp5__length1;
-		const gchar* _tmp6_;
-		gchar* _tmp7_;
-		gchar* previous_attribute;
-		gchar** _tmp8_;
-		gint _tmp9_;
-		const gchar* _tmp10_;
-		gchar* _tmp11_ = NULL;
-		const gchar* _tmp12_;
-		gchar* _tmp13_ = NULL;
-		gchar** _tmp14_;
-		gint _tmp15_;
-		const gchar* _tmp16_;
-		gint _tmp43_;
-		_tmp4_ = i;
-		_tmp5__length1 = args_length1;
-		if (!(_tmp4_ < _tmp5__length1)) {
-			break;
-		}
-		_tmp6_ = _vala_attribute;
-		_tmp7_ = g_strdup (_tmp6_);
-		previous_attribute = _tmp7_;
-		_tmp8_ = args;
-		_tmp9_ = i;
-		_tmp10_ = _tmp8_[_tmp9_];
-		_tmp11_ = string_replace (_tmp10_, RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, "");
-		g_free (_vala_attribute);
-		_vala_attribute = _tmp11_;
-		_tmp12_ = _vala_attribute;
-		_tmp13_ = g_uri_unescape_string (_tmp12_, NULL);
-		g_free (_vala_attribute);
-		_vala_attribute = _tmp13_;
-		_tmp14_ = args;
-		_tmp15_ = i;
-		_tmp16_ = _tmp14_[_tmp15_ + 1];
-		if (g_strcmp0 (_tmp16_, "?") != 0) {
-			gchar** _tmp17_;
-			gint _tmp18_;
-			const gchar* _tmp19_;
-			gchar** _tmp20_;
-			gint _tmp21_;
-			const gchar* _tmp22_;
-			gint _tmp23_;
-			gint _tmp24__length1;
-			_tmp17_ = args;
-			_tmp18_ = i;
-			_tmp19_ = _tmp17_[_tmp18_];
-			_tmp20_ = args;
-			_tmp21_ = i;
-			_tmp22_ = _tmp20_[_tmp21_ + 1];
-			rygel_media_export_query_container_factory_update_search_expression (self, &expression, _tmp19_, _tmp22_);
-			_tmp23_ = i;
-			_tmp24__length1 = args_length1;
-			if ((_tmp23_ + 2) == _tmp24__length1) {
-				const gchar* _tmp25_;
-				gchar* _tmp26_ = NULL;
-				_tmp25_ = _vala_attribute;
-				_tmp26_ = rygel_media_export_query_container_factory_map_upnp_class (self, _tmp25_);
-				g_free (_vala_upnp_class);
-				_vala_upnp_class = _tmp26_;
-			}
-		} else {
-			gchar** _tmp27_;
-			gint _tmp28_;
-			gchar* _tmp29_;
-			gchar** _tmp31_;
-			gchar* _tmp32_ = NULL;
-			const gchar* _tmp33_;
-			gchar* _tmp34_ = NULL;
-			gboolean _tmp35_ = FALSE;
-			const gchar* _tmp36_;
-			gboolean _tmp38_;
-			_tmp27_ = args;
-			_tmp28_ = i;
-			_tmp29_ = g_strdup ("%s");
-			g_free (_tmp27_[_tmp28_ + 1]);
-			_tmp27_[_tmp28_ + 1] = _tmp29_;
-			_tmp31_ = args;
-			_tmp32_ = g_strjoinv (",", _tmp31_);
-			g_free (_vala_pattern);
-			_vala_pattern = _tmp32_;
-			_tmp33_ = previous_attribute;
-			_tmp34_ = rygel_media_export_query_container_factory_map_upnp_class (self, _tmp33_);
-			g_free (_vala_upnp_class);
-			_vala_upnp_class = _tmp34_;
-			_tmp36_ = *name;
-			if (g_strcmp0 (_tmp36_, "") == 0) {
-				gint _tmp37_;
-				_tmp37_ = i;
-				_tmp35_ = _tmp37_ > 0;
-			} else {
-				_tmp35_ = FALSE;
-			}
-			_tmp38_ = _tmp35_;
-			if (_tmp38_) {
-				gchar** _tmp39_;
-				gint _tmp40_;
-				const gchar* _tmp41_;
-				gchar* _tmp42_ = NULL;
-				_tmp39_ = args;
-				_tmp40_ = i;
-				_tmp41_ = _tmp39_[_tmp40_ - 1];
-				_tmp42_ = g_uri_unescape_string (_tmp41_, NULL);
-				g_free (*name);
-				*name = _tmp42_;
-			}
-			g_free (previous_attribute);
-			break;
-		}
-		_tmp43_ = i;
-		i = _tmp43_ + 2;
-		g_free (previous_attribute);
-	}
-	result = expression;
-	args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
-	if (pattern) {
-		*pattern = _vala_pattern;
-	} else {
-		g_free (_vala_pattern);
-	}
-	if (attribute) {
-		*attribute = _vala_attribute;
-	} else {
-		g_free (_vala_attribute);
-	}
-	if (upnp_class) {
-		*upnp_class = _vala_upnp_class;
-	} else {
-		g_free (_vala_upnp_class);
-	}
-	return result;
+ * Parse a plaintext container description into a search expression.
+ *
+ * Also generates a name for the container and other meta-data necessary
+ * for node containers.
+ *
+ * @param description The plaintext container description
+ * @param pattern     Contains the pattern used for child containers if
+ *                    descrption is for a node container, null otherwise.
+ * @param attribute   Contains the UPnP attribute the container describes.
+ * @param name        If passed empty, name will be generated from the
+ *                    description.
+ * @return A SearchExpression corresponding to the non-variable part of
+ *         the description.
+ */
+static RygelSearchExpression *
+rygel_media_export_query_container_factory_parse_description (const gchar  *description,
+							      gchar       **pattern,
+							      gchar       **attribute,
+							      gchar       **upnp_class,
+							      gchar       **name) {
+  gchar *local_pattern;
+  gchar *local_attribute;
+  gchar *local_upnp_class;
+  gchar **args;
+  gint args_length;
+  RygelSearchExpression* expression;
+  gint i;
+
+  g_return_val_if_fail (description != NULL, NULL);
+  g_return_val_if_fail (name != NULL, NULL);
+  g_return_val_if_fail (*name != NULL, NULL);
+
+  args = g_strsplit (description, ",", 0);
+  args_length = g_strv_length (args);
+  expression = NULL;
+  local_pattern = NULL;
+  local_attribute = NULL;
+  local_upnp_class = NULL;
+  i = 0;
+
+  while (i < args_length) {
+    gchar *previous_attribute = g_strdup (local_attribute);
+    GError *error = NULL;
+    gchar *tmp_attribute = rygel_media_export_string_replace (args[i],
+							      RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX,
+							      "",
+							      &error);
+
+    if (error) {
+      g_warning ("Failed to remove " RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX " from %s: %s",
+		 args[i],
+		 error->message);
+      g_error_free (error);
+    }
+    g_free (local_attribute);
+    local_attribute = g_uri_unescape_string (tmp_attribute, NULL);
+    g_free (tmp_attribute);
+    if (g_strcmp0 (args[i + 1], "?")) {
+      rygel_media_export_query_container_factory_update_search_expression (&expression, args[i], args[i + 1]);
+      if ((i + 2) == args_length) {
+	local_upnp_class = rygel_media_export_query_container_factory_map_upnp_class (local_attribute);
+      }
+    } else {
+      g_free (args[i]);
+      args[i] = g_strdup ("%s");
+
+      local_pattern = g_strjoinv (",", args);
+      local_upnp_class = rygel_media_export_query_container_factory_map_upnp_class (previous_attribute);
+
+      if (*name[0] == '\0' && i > 0) {
+	g_free (*name);
+	*name = g_uri_unescape_string (args[i - 1], NULL);
+      }
+
+      g_free (previous_attribute);
+      break;
+    }
+
+    i += 2;
+    g_free (previous_attribute);
+  }
+  g_strfreev (args);
+
+  if (pattern) {
+    *pattern = local_pattern;
+  } else {
+    g_free (local_pattern);
+  }
+  if (attribute) {
+    *attribute = local_attribute;
+  } else {
+    g_free (local_attribute);
+  }
+  if (upnp_class) {
+    *upnp_class = local_upnp_class;
+  } else {
+    g_free (local_upnp_class);
+  }
+  return expression;
 }
 
 
 /**
-     * Update a SearchExpression with a new key = value condition.
-     *
-     * Will modifiy the passed expression to (expression AND (key = value))
-     *
-     * @param expression The expression to update or null to create a new one
-     * @param key        Key of the key/value condition
-     * @param value      Value of the key/value condition
-     */
-static void rygel_media_export_query_container_factory_update_search_expression (RygelMediaExportQueryContainerFactory* self, RygelSearchExpression** expression, const gchar* key, const gchar* value) {
-	RygelRelationalExpression* _tmp0_;
-	RygelRelationalExpression* subexpression;
-	const gchar* _tmp1_;
-	gchar* _tmp2_ = NULL;
-	gchar* clean_key;
-	RygelRelationalExpression* _tmp3_;
-	const gchar* _tmp4_;
-	gchar* _tmp5_ = NULL;
-	RygelRelationalExpression* _tmp6_;
-	RygelRelationalExpression* _tmp7_;
-	const gchar* _tmp8_;
-	gchar* _tmp9_ = NULL;
-	RygelSearchExpression* _tmp10_;
-	g_return_if_fail (self != NULL);
-	g_return_if_fail (key != NULL);
-	g_return_if_fail (value != NULL);
-	_tmp0_ = rygel_relational_expression_new ();
-	subexpression = _tmp0_;
-	_tmp1_ = key;
-	_tmp2_ = string_replace (_tmp1_, RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX, "");
-	clean_key = _tmp2_;
-	_tmp3_ = subexpression;
-	_tmp4_ = clean_key;
-	_tmp5_ = g_uri_unescape_string (_tmp4_, NULL);
-	g_free (((RygelSearchExpression*) _tmp3_)->operand1);
-	((RygelSearchExpression*) _tmp3_)->operand1 = _tmp5_;
-	_tmp6_ = subexpression;
-	((RygelSearchExpression*) _tmp6_)->op = (gpointer) ((gintptr) GUPNP_SEARCH_CRITERIA_OP_EQ);
-	_tmp7_ = subexpression;
-	_tmp8_ = value;
-	_tmp9_ = g_uri_unescape_string (_tmp8_, NULL);
-	g_free (((RygelSearchExpression*) _tmp7_)->operand2);
-	((RygelSearchExpression*) _tmp7_)->operand2 = _tmp9_;
-	_tmp10_ = *expression;
-	if (_tmp10_ != NULL) {
-		RygelLogicalExpression* _tmp11_;
-		RygelLogicalExpression* conjunction;
-		RygelLogicalExpression* _tmp12_;
-		RygelSearchExpression* _tmp13_;
-		RygelSearchExpression* _tmp14_;
-		RygelLogicalExpression* _tmp15_;
-		RygelRelationalExpression* _tmp16_;
-		RygelSearchExpression* _tmp17_;
-		RygelLogicalExpression* _tmp18_;
-		RygelLogicalExpression* _tmp19_;
-		RygelSearchExpression* _tmp20_;
-		_tmp11_ = rygel_logical_expression_new ();
-		conjunction = _tmp11_;
-		_tmp12_ = conjunction;
-		_tmp13_ = *expression;
-		_tmp14_ = _rygel_search_expression_ref0 (_tmp13_);
-		rygel_search_expression_unref (((RygelSearchExpression*) _tmp12_)->operand1);
-		((RygelSearchExpression*) _tmp12_)->operand1 = _tmp14_;
-		_tmp15_ = conjunction;
-		_tmp16_ = subexpression;
-		_tmp17_ = _rygel_search_expression_ref0 ((RygelSearchExpression*) _tmp16_);
-		rygel_search_expression_unref (((RygelSearchExpression*) _tmp15_)->operand2);
-		((RygelSearchExpression*) _tmp15_)->operand2 = _tmp17_;
-		_tmp18_ = conjunction;
-		((RygelSearchExpression*) _tmp18_)->op = (gpointer) ((gintptr) RYGEL_LOGICAL_OPERATOR_AND);
-		_tmp19_ = conjunction;
-		_tmp20_ = _rygel_search_expression_ref0 ((RygelSearchExpression*) _tmp19_);
-		rygel_search_expression_unref (*expression);
-		*expression = _tmp20_;
-		rygel_search_expression_unref (conjunction);
-	} else {
-		RygelRelationalExpression* _tmp21_;
-		RygelSearchExpression* _tmp22_;
-		_tmp21_ = subexpression;
-		_tmp22_ = _rygel_search_expression_ref0 ((RygelSearchExpression*) _tmp21_);
-		rygel_search_expression_unref (*expression);
-		*expression = _tmp22_;
-	}
-	g_free (clean_key);
-	rygel_search_expression_unref (subexpression);
-}
-
-
-static void rygel_media_export_query_container_factory_class_init (RygelMediaExportQueryContainerFactoryClass * klass) {
-	rygel_media_export_query_container_factory_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (RygelMediaExportQueryContainerFactoryPrivate));
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_query_container_factory_finalize;
+ * Update a SearchExpression with a new key = value condition.
+ *
+ * Will modifiy the passed expression to (expression AND (key = value))
+ *
+ * @param expression The expression to update or null to create a new one
+ * @param key        Key of the key/value condition
+ * @param value      Value of the key/value condition
+ */
+static void
+rygel_media_export_query_container_factory_update_search_expression (RygelSearchExpression **expression,
+								     const gchar            *key,
+								     const gchar            *value) {
+  RygelSearchExpression *search_sub;
+  RygelRelationalExpression *subexpression;
+  gchar *clean_key;
+  GError *error;
+
+  g_return_if_fail (expression != NULL);
+  g_return_if_fail (key != NULL);
+  g_return_if_fail (value != NULL);
+
+  subexpression = rygel_relational_expression_new ();
+  search_sub = RYGEL_SEARCH_EXPRESSION (subexpression);
+  error = NULL;
+  clean_key = rygel_media_export_string_replace (key,
+						 RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX,
+						 "",
+						 &error);
+  if (error) {
+    g_warning ("Failed to remove "  " from %s: %s",
+	       key,
+	       error->message);
+    g_error_free (error);
+  }
+  search_sub->operand1 = g_uri_unescape_string (clean_key, NULL);
+  search_sub->op = (gpointer) ((gintptr) GUPNP_SEARCH_CRITERIA_OP_EQ);
+  search_sub->operand2 = g_uri_unescape_string (value, NULL);
+  g_free (clean_key);
+  if (*expression) {
+    RygelLogicalExpression *conjunction = rygel_logical_expression_new ();
+    RygelSearchExpression *search_conj = RYGEL_SEARCH_EXPRESSION (conjunction);
+
+    search_conj->operand1 = expression;
+    search_conj->operand2 = subexpression;
+    search_conj->op = (gpointer) ((gintptr) RYGEL_LOGICAL_OPERATOR_AND);
+    *expression = search_conj;
+  } else {
+    *expression = search_sub;
+  }
 }
 
+static void
+rygel_media_export_query_container_factory_dispose (GObject *object) {
+  RygelMediaExportQueryContainerFactory *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY (object);
+  RygelMediaExportQueryContainerFactoryPrivate *priv = self->priv;
 
-static void rygel_media_export_query_container_factory_init (RygelMediaExportQueryContainerFactory * self) {
-	self->priv = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_PRIVATE (self);
-}
-
+  if (priv->virtual_container_map) {
+    GeeHashMap *map = priv->virtual_container_map;
 
-static void rygel_media_export_query_container_factory_finalize (GObject* obj) {
-	RygelMediaExportQueryContainerFactory * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_QUERY_CONTAINER_FACTORY, RygelMediaExportQueryContainerFactory);
-	g_object_unref (self->priv->virtual_container_map);
-	G_OBJECT_CLASS (rygel_media_export_query_container_factory_parent_class)->finalize (obj);
+    priv->virtual_container_map = NULL;
+    g_object_unref (map);
+  }
+  G_OBJECT_CLASS (rygel_media_export_query_container_factory_parent_class)->dispose (object);
 }
 
+static void
+rygel_media_export_query_container_factory_constructed (GObject *object) {
+  RygelMediaExportQueryContainerFactory *self = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY (object);
 
-GType rygel_media_export_query_container_factory_get_type (void) {
-	static volatile gsize rygel_media_export_query_container_factory_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_query_container_factory_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportQueryContainerFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_query_container_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportQueryContainerFactory), 0, (GInstanceInitFunc) rygel_media_export_query_container_factory_init, NULL };
-		GType rygel_media_export_query_container_factory_type_id;
-		rygel_media_export_query_container_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelMediaExportQueryContainerFactory", &g_define_type_info, 0);
-		g_once_init_leave (&rygel_media_export_query_container_factory_type_id__volatile, rygel_media_export_query_container_factory_type_id);
-	}
-	return rygel_media_export_query_container_factory_type_id__volatile;
-}
-
+  G_OBJECT_CLASS (rygel_media_export_query_container_factory_parent_class)->constructed (object);
 
-static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
-	if ((array != NULL) && (destroy_func != NULL)) {
-		int i;
-		for (i = 0; i < array_length; i = i + 1) {
-			if (((gpointer*) array)[i] != NULL) {
-				destroy_func (((gpointer*) array)[i]);
-			}
-		}
-	}
+  self->priv->virtual_container_map = gee_hash_map_new (G_TYPE_STRING,
+							(GBoxedCopyFunc) g_strdup,
+							g_free,
+							G_TYPE_STRING,
+							(GBoxedCopyFunc) g_strdup,
+							g_free,
+							NULL, NULL, NULL, NULL,
+							NULL, NULL, NULL, NULL, NULL);
 }
 
+static void
+rygel_media_export_query_container_factory_class_init (RygelMediaExportQueryContainerFactoryClass *factory_class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (factory_class);
 
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
-	_vala_array_destroy (array, array_length, destroy_func);
-	g_free (array);
+  object_class->dispose = rygel_media_export_query_container_factory_dispose;
+  object_class->constructed = rygel_media_export_query_container_factory_constructed;
+  g_type_class_add_private (factory_class,
+			    sizeof (RygelMediaExportQueryContainerFactoryPrivate));
 }
 
-
-static gint _vala_array_length (gpointer array) {
-	int length;
-	length = 0;
-	if (array) {
-		while (((gpointer*) array)[length]) {
-			length++;
-		}
-	}
-	return length;
+static void
+rygel_media_export_query_container_factory_init (RygelMediaExportQueryContainerFactory *self) {
+  self->priv = RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_FACTORY_GET_PRIVATE (self);
 }
-
-
-



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