/* rygel-simple-container.c generated by valac 0.15.1.36-84b2b, the Vala compiler
 * generated from rygel-simple-container.vala, do not modify */

/*
 * Copyright (C) 2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2009 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * 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.
 */

#include <glib.h>
#include <glib-object.h>
#include <libgupnp-av/gupnp-av.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>


#define RYGEL_TYPE_MEDIA_OBJECT (rygel_media_object_get_type ())
#define RYGEL_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObject))
#define RYGEL_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))
#define RYGEL_IS_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_IS_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_MEDIA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))

typedef struct _RygelMediaObject RygelMediaObject;
typedef struct _RygelMediaObjectClass RygelMediaObjectClass;
typedef struct _RygelMediaObjectPrivate RygelMediaObjectPrivate;

#define RYGEL_TYPE_TRANSCODE_MANAGER (rygel_transcode_manager_get_type ())
#define RYGEL_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManager))
#define RYGEL_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))
#define RYGEL_IS_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_IS_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_TRANSCODE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))

typedef struct _RygelTranscodeManager RygelTranscodeManager;
typedef struct _RygelTranscodeManagerClass RygelTranscodeManagerClass;

#define RYGEL_TYPE_HTTP_SERVER (rygel_http_server_get_type ())
#define RYGEL_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServer))
#define RYGEL_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))
#define RYGEL_IS_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_IS_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_HTTP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))

typedef struct _RygelHTTPServer RygelHTTPServer;
typedef struct _RygelHTTPServerClass RygelHTTPServerClass;

#define RYGEL_TYPE_MEDIA_CONTAINER (rygel_media_container_get_type ())
#define RYGEL_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainer))
#define RYGEL_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))
#define RYGEL_IS_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_IS_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_MEDIA_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))

typedef struct _RygelMediaContainer RygelMediaContainer;
typedef struct _RygelMediaContainerClass RygelMediaContainerClass;
typedef struct _RygelMediaContainerPrivate RygelMediaContainerPrivate;

#define RYGEL_TYPE_MEDIA_OBJECTS (rygel_media_objects_get_type ())
#define RYGEL_MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjects))
#define RYGEL_MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjectsClass))
#define RYGEL_IS_MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_OBJECTS))
#define RYGEL_IS_MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_OBJECTS))
#define RYGEL_MEDIA_OBJECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjectsClass))

typedef struct _RygelMediaObjects RygelMediaObjects;
typedef struct _RygelMediaObjectsClass RygelMediaObjectsClass;

#define RYGEL_TYPE_SEARCHABLE_CONTAINER (rygel_searchable_container_get_type ())
#define RYGEL_SEARCHABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER, RygelSearchableContainer))
#define RYGEL_IS_SEARCHABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER))
#define RYGEL_SEARCHABLE_CONTAINER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER, RygelSearchableContainerIface))

typedef struct _RygelSearchableContainer RygelSearchableContainer;
typedef struct _RygelSearchableContainerIface RygelSearchableContainerIface;

#define RYGEL_TYPE_SEARCH_EXPRESSION (rygel_search_expression_get_type ())
#define RYGEL_SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpression))
#define RYGEL_SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpressionClass))
#define RYGEL_IS_SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCH_EXPRESSION))
#define RYGEL_IS_SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEARCH_EXPRESSION))
#define RYGEL_SEARCH_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpressionClass))

typedef struct _RygelSearchExpression RygelSearchExpression;
typedef struct _RygelSearchExpressionClass RygelSearchExpressionClass;

#define RYGEL_TYPE_SIMPLE_CONTAINER (rygel_simple_container_get_type ())
#define RYGEL_SIMPLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SIMPLE_CONTAINER, RygelSimpleContainer))
#define RYGEL_SIMPLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SIMPLE_CONTAINER, RygelSimpleContainerClass))
#define RYGEL_IS_SIMPLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SIMPLE_CONTAINER))
#define RYGEL_IS_SIMPLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SIMPLE_CONTAINER))
#define RYGEL_SIMPLE_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SIMPLE_CONTAINER, RygelSimpleContainerClass))

typedef struct _RygelSimpleContainer RygelSimpleContainer;
typedef struct _RygelSimpleContainerClass RygelSimpleContainerClass;
typedef struct _RygelSimpleContainerPrivate RygelSimpleContainerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define RYGEL_TYPE_MEDIA_ITEM (rygel_media_item_get_type ())
#define RYGEL_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItem))
#define RYGEL_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItemClass))
#define RYGEL_IS_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_ITEM))
#define RYGEL_IS_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_ITEM))
#define RYGEL_MEDIA_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItemClass))

typedef struct _RygelMediaItem RygelMediaItem;
typedef struct _RygelMediaItemClass RygelMediaItemClass;
typedef struct _RygelSimpleContainerGetChildrenData RygelSimpleContainerGetChildrenData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block6Data Block6Data;
typedef struct _Block7Data Block7Data;
typedef struct _RygelSimpleContainerFindObjectData RygelSimpleContainerFindObjectData;
#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
typedef struct _RygelSimpleContainerSearchData RygelSimpleContainerSearchData;

struct _RygelMediaObject {
	GObject parent_instance;
	RygelMediaObjectPrivate * priv;
	gchar* id;
	gchar* ref_id;
	gchar* upnp_class;
	guint64 modified;
	GeeArrayList* uris;
	RygelMediaContainer* parent;
};

struct _RygelMediaObjectClass {
	GObjectClass parent_class;
	GUPnPDIDLLiteObject* (*serialize) (RygelMediaObject* self, GUPnPDIDLLiteWriter* writer, RygelHTTPServer* http_server, GError** error);
	gint (*compare_by_property) (RygelMediaObject* self, RygelMediaObject* media_object, const gchar* property);
	GUPnPOCMFlags (*get_ocm_flags) (RygelMediaObject* self);
};

struct _RygelMediaContainer {
	RygelMediaObject parent_instance;
	RygelMediaContainerPrivate * priv;
	gint child_count;
	guint32 update_id;
	gint64 storage_used;
};

struct _RygelMediaContainerClass {
	RygelMediaObjectClass parent_class;
	void (*get_children) (RygelMediaContainer* self, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObjects* (*get_children_finish) (RygelMediaContainer* self, GAsyncResult* _res_, GError** error);
	void (*find_object) (RygelMediaContainer* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObject* (*find_object_finish) (RygelMediaContainer* self, GAsyncResult* _res_, GError** error);
};

struct _RygelSearchableContainerIface {
	GTypeInterface parent_iface;
	void (*search) (RygelSearchableContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObjects* (*search_finish) (RygelSearchableContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
	GeeArrayList* (*get_search_classes) (RygelSearchableContainer* self);
	void (*set_search_classes) (RygelSearchableContainer* self, GeeArrayList* value);
};

struct _RygelSimpleContainer {
	RygelMediaContainer parent_instance;
	RygelSimpleContainerPrivate * priv;
	RygelMediaObjects* children;
};

struct _RygelSimpleContainerClass {
	RygelMediaContainerClass parent_class;
};

struct _RygelSimpleContainerPrivate {
	RygelMediaObjects* empty_children;
	GeeArrayList* _search_classes;
};

struct _RygelSimpleContainerGetChildrenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelSimpleContainer* self;
	guint offset;
	guint max_count;
	GCancellable* cancellable;
	RygelMediaObjects* result;
	guint _tmp0_;
	guint _tmp1_;
	guint stop;
	guint _tmp2_;
	gint _tmp3_;
	guint _tmp4_;
	RygelMediaObjects* _tmp5_;
	guint _tmp6_;
	guint _tmp7_;
	GeeList* _tmp8_;
};

struct _Block6Data {
	int _ref_count_;
	RygelSimpleContainer * self;
	gint restart_count;
	gboolean restart;
	gpointer _async_data_;
};

struct _Block7Data {
	int _ref_count_;
	Block6Data * _data6_;
	gulong updated_id;
};

struct _RygelSimpleContainerFindObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelSimpleContainer* self;
	gchar* id;
	GCancellable* cancellable;
	RygelMediaObject* result;
	Block6Data* _data6_;
	RygelMediaObject* media_object;
	gboolean _tmp0_;
	Block7Data* _data7_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	RygelMediaObjects* _tmp6_;
	RygelMediaObjects* _tmp7_;
	RygelMediaObjects* _child_list;
	RygelMediaObjects* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	gint _child_size;
	gint _child_index;
	gint _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	RygelMediaObjects* _tmp14_;
	gint _tmp15_;
	gpointer _tmp16_;
	RygelMediaObject* child;
	RygelMediaObject* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	RygelMediaObject* _tmp20_;
	RygelMediaObject* _tmp21_;
	RygelMediaObject* _tmp22_;
	gulong _tmp23_;
	RygelMediaObject* _tmp24_;
	RygelMediaContainer* _tmp25_;
	RygelMediaContainer* container;
	RygelMediaContainer* _tmp26_;
	const gchar* _tmp27_;
	GCancellable* _tmp28_;
	RygelMediaObject* _tmp29_;
	RygelMediaObject* _tmp30_;
	gulong _tmp31_;
	gulong _tmp32_;
	RygelMediaObject* _tmp33_;
	gboolean _tmp34_;
	GError * _inner_error_;
};

struct _RygelSimpleContainerSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelSimpleContainer* self;
	RygelSearchExpression* expression;
	guint offset;
	guint max_count;
	guint total_matches;
	GCancellable* cancellable;
	RygelMediaObjects* result;
	RygelSearchExpression* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	GCancellable* _tmp3_;
	guint _tmp4_;
	RygelMediaObjects* _tmp5_;
	RygelMediaObjects* _tmp6_;
	GError * _inner_error_;
};


static gpointer rygel_simple_container_parent_class = NULL;
static RygelSearchableContainerIface* rygel_simple_container_rygel_searchable_container_parent_iface = NULL;

GType rygel_media_object_get_type (void) G_GNUC_CONST;
GType rygel_transcode_manager_get_type (void) G_GNUC_CONST;
GType rygel_http_server_get_type (void) G_GNUC_CONST;
GType rygel_media_container_get_type (void) G_GNUC_CONST;
GType rygel_media_objects_get_type (void) G_GNUC_CONST;
gpointer rygel_search_expression_ref (gpointer instance);
void rygel_search_expression_unref (gpointer instance);
GParamSpec* rygel_param_spec_search_expression (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_search_expression (GValue* value, gpointer v_object);
void rygel_value_take_search_expression (GValue* value, gpointer v_object);
gpointer rygel_value_get_search_expression (const GValue* value);
GType rygel_search_expression_get_type (void) G_GNUC_CONST;
GType rygel_searchable_container_get_type (void) G_GNUC_CONST;
GType rygel_simple_container_get_type (void) G_GNUC_CONST;
#define RYGEL_SIMPLE_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_SIMPLE_CONTAINER, RygelSimpleContainerPrivate))
enum  {
	RYGEL_SIMPLE_CONTAINER_DUMMY_PROPERTY,
	RYGEL_SIMPLE_CONTAINER_SEARCH_CLASSES
};
RygelSimpleContainer* rygel_simple_container_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelSimpleContainer* rygel_simple_container_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelMediaContainer* rygel_media_container_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, gint child_count);
RygelMediaObjects* rygel_media_objects_new (void);
RygelMediaObjects* rygel_media_objects_construct (GType object_type);
void rygel_searchable_container_set_search_classes (RygelSearchableContainer* self, GeeArrayList* value);
RygelSimpleContainer* rygel_simple_container_new_root (const gchar* title);
RygelSimpleContainer* rygel_simple_container_construct_root (GType object_type, const gchar* title);
GType rygel_media_item_get_type (void) G_GNUC_CONST;
void rygel_simple_container_add_child_item (RygelSimpleContainer* self, RygelMediaItem* child);
static void rygel_simple_container_add_child (RygelSimpleContainer* self, RygelMediaObject* child);
RygelMediaObjects* rygel_simple_container_get_all_children (RygelSimpleContainer* self);
void rygel_simple_container_add_child_container (RygelSimpleContainer* self, RygelMediaContainer* child);
GeeArrayList* rygel_searchable_container_get_search_classes (RygelSearchableContainer* self);
static void rygel_simple_container_on_container_updated (RygelSimpleContainer* self, RygelMediaContainer* source, RygelMediaContainer* updated);
static void _rygel_simple_container_on_container_updated_rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self);
void rygel_simple_container_remove_child (RygelSimpleContainer* self, RygelMediaObject* child);
void rygel_simple_container_clear (RygelSimpleContainer* self);
gboolean rygel_simple_container_is_child_id_unique (RygelSimpleContainer* self, const gchar* child_id);
static void rygel_simple_container_real_get_children_data_free (gpointer _data);
static void rygel_simple_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_simple_container_real_get_children_co (RygelSimpleContainerGetChildrenData* _data_);
static void rygel_simple_container_real_find_object_data_free (gpointer _data);
static void rygel_simple_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_simple_container_real_find_object_co (RygelSimpleContainerFindObjectData* _data_);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void ________lambda15_ (Block7Data* _data7_, RygelMediaContainer* _, RygelMediaContainer* updated);
static void _________lambda15__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self);
void rygel_media_container_find_object (RygelMediaContainer* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
RygelMediaObject* rygel_media_container_find_object_finish (RygelMediaContainer* self, GAsyncResult* _res_, GError** error);
static void rygel_simple_container_find_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void rygel_simple_container_real_search_data_free (gpointer _data);
static void rygel_simple_container_real_search (RygelSearchableContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_simple_container_real_search_co (RygelSimpleContainerSearchData* _data_);
void rygel_searchable_container_simple_search (RygelSearchableContainer* self, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
RygelMediaObjects* rygel_searchable_container_simple_search_finish (RygelSearchableContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
static void rygel_simple_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void rygel_media_container_updated (RygelMediaContainer* self);
static void rygel_simple_container_finalize (GObject* obj);
static void _vala_rygel_simple_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_rygel_simple_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


RygelSimpleContainer* rygel_simple_container_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title) {
	RygelSimpleContainer * self = NULL;
	const gchar* _tmp0_;
	RygelMediaContainer* _tmp1_;
	const gchar* _tmp2_;
	RygelMediaObjects* _tmp3_;
	RygelMediaObjects* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = id;
	_tmp1_ = parent;
	_tmp2_ = title;
	self = (RygelSimpleContainer*) rygel_media_container_construct (object_type, _tmp0_, _tmp1_, _tmp2_, 0);
	_tmp3_ = rygel_media_objects_new ();
	_g_object_unref0 (self->children);
	self->children = _tmp3_;
	_tmp4_ = rygel_media_objects_new ();
	_g_object_unref0 (self->priv->empty_children);
	self->priv->empty_children = _tmp4_;
	_tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	_tmp6_ = _tmp5_;
	rygel_searchable_container_set_search_classes ((RygelSearchableContainer*) self, _tmp6_);
	_g_object_unref0 (_tmp6_);
	return self;
}


RygelSimpleContainer* rygel_simple_container_new (const gchar* id, RygelMediaContainer* parent, const gchar* title) {
	return rygel_simple_container_construct (RYGEL_TYPE_SIMPLE_CONTAINER, id, parent, title);
}


RygelSimpleContainer* rygel_simple_container_construct_root (GType object_type, const gchar* title) {
	RygelSimpleContainer * self = NULL;
	const gchar* _tmp0_;
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = title;
	self = (RygelSimpleContainer*) rygel_simple_container_construct (object_type, "0", NULL, _tmp0_);
	return self;
}


RygelSimpleContainer* rygel_simple_container_new_root (const gchar* title) {
	return rygel_simple_container_construct_root (RYGEL_TYPE_SIMPLE_CONTAINER, title);
}


void rygel_simple_container_add_child_item (RygelSimpleContainer* self, RygelMediaItem* child) {
	RygelMediaItem* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	rygel_simple_container_add_child (self, (RygelMediaObject*) _tmp0_);
}


RygelMediaObjects* rygel_simple_container_get_all_children (RygelSimpleContainer* self) {
	RygelMediaObjects* result = NULL;
	RygelMediaObjects* _tmp0_;
	RygelMediaObjects* all;
	RygelMediaObjects* _tmp1_;
	RygelMediaObjects* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = rygel_media_objects_new ();
	all = _tmp0_;
	_tmp1_ = self->children;
	gee_abstract_collection_add_all ((GeeAbstractCollection*) all, (GeeCollection*) _tmp1_);
	_tmp2_ = self->priv->empty_children;
	gee_abstract_collection_add_all ((GeeAbstractCollection*) all, (GeeCollection*) _tmp2_);
	result = all;
	return result;
}


/**
     * NOTE: This method only actually adds the child container to the hierarchy
     * until it has any children to offer.
     */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static void _rygel_simple_container_on_container_updated_rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self) {
	rygel_simple_container_on_container_updated (self, _sender, container);
}


void rygel_simple_container_add_child_container (RygelSimpleContainer* self, RygelMediaContainer* child) {
	RygelMediaContainer* _tmp0_;
	RygelMediaContainer* _tmp8_;
	gint _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	if (RYGEL_IS_SEARCHABLE_CONTAINER (_tmp0_)) {
		RygelMediaContainer* _tmp1_;
		GeeArrayList* _tmp2_;
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		GeeArrayList* search_classes;
		GeeArrayList* _tmp5_;
		GeeArrayList* _tmp6_;
		GeeArrayList* _tmp7_;
		_tmp1_ = child;
		_tmp2_ = rygel_searchable_container_get_search_classes (RYGEL_IS_SEARCHABLE_CONTAINER (_tmp1_) ? ((RygelSearchableContainer*) _tmp1_) : NULL);
		_tmp3_ = _tmp2_;
		_tmp4_ = _g_object_ref0 (_tmp3_);
		search_classes = _tmp4_;
		_tmp5_ = rygel_searchable_container_get_search_classes ((RygelSearchableContainer*) self);
		_tmp6_ = _tmp5_;
		_tmp7_ = search_classes;
		gee_abstract_collection_add_all ((GeeAbstractCollection*) _tmp6_, (GeeCollection*) _tmp7_);
		_g_object_unref0 (search_classes);
	}
	_tmp8_ = child;
	_tmp9_ = _tmp8_->child_count;
	if (_tmp9_ > 0) {
		RygelMediaContainer* _tmp10_;
		_tmp10_ = child;
		rygel_simple_container_add_child (self, (RygelMediaObject*) _tmp10_);
	} else {
		RygelMediaContainer* _tmp11_;
		const gchar* _tmp12_;
		RygelMediaObjects* _tmp13_;
		RygelMediaContainer* _tmp14_;
		RygelMediaContainer* _tmp15_;
		_tmp11_ = child;
		_tmp12_ = ((RygelMediaObject*) _tmp11_)->id;
		g_debug ("Container '%s' empty, refusing to add to hierarchy " "until it has any children to offer.", _tmp12_);
		_tmp13_ = self->priv->empty_children;
		_tmp14_ = child;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, (RygelMediaObject*) _tmp14_);
		_tmp15_ = child;
		g_signal_connect_object (_tmp15_, "container-updated", (GCallback) _rygel_simple_container_on_container_updated_rygel_media_container_container_updated, self, 0);
	}
}


void rygel_simple_container_remove_child (RygelSimpleContainer* self, RygelMediaObject* child) {
	RygelMediaObjects* _tmp0_;
	RygelMediaObject* _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = self->children;
	_tmp1_ = child;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp0_, _tmp1_);
	_tmp2_ = ((RygelMediaContainer*) self)->child_count;
	((RygelMediaContainer*) self)->child_count = _tmp2_ - 1;
}


void rygel_simple_container_clear (RygelSimpleContainer* self) {
	RygelMediaObjects* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->children;
	gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp0_);
	((RygelMediaContainer*) self)->child_count = 0;
}


gboolean rygel_simple_container_is_child_id_unique (RygelSimpleContainer* self, const gchar* child_id) {
	gboolean result = FALSE;
	gboolean unique;
	gboolean _tmp14_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (child_id != NULL, FALSE);
	unique = TRUE;
	{
		RygelMediaObjects* _tmp0_;
		RygelMediaObjects* _tmp1_;
		RygelMediaObjects* _child_list;
		RygelMediaObjects* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _child_size;
		gint _child_index;
		_tmp0_ = self->children;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_child_list = _tmp1_;
		_tmp2_ = _child_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_child_size = _tmp4_;
		_child_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			RygelMediaObjects* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			RygelMediaObject* child;
			RygelMediaObject* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			_tmp5_ = _child_index;
			_child_index = _tmp5_ + 1;
			_tmp6_ = _child_index;
			_tmp7_ = _child_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _child_list;
			_tmp9_ = _child_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			child = (RygelMediaObject*) _tmp10_;
			_tmp11_ = child;
			_tmp12_ = _tmp11_->id;
			_tmp13_ = child_id;
			if (g_strcmp0 (_tmp12_, _tmp13_) == 0) {
				unique = FALSE;
				_g_object_unref0 (child);
				break;
			}
			_g_object_unref0 (child);
		}
		_g_object_unref0 (_child_list);
	}
	_tmp14_ = unique;
	if (_tmp14_) {
		{
			RygelMediaObjects* _tmp15_;
			RygelMediaObjects* _tmp16_;
			RygelMediaObjects* _child_list;
			RygelMediaObjects* _tmp17_;
			gint _tmp18_;
			gint _tmp19_;
			gint _child_size;
			gint _child_index;
			_tmp15_ = self->priv->empty_children;
			_tmp16_ = _g_object_ref0 (_tmp15_);
			_child_list = _tmp16_;
			_tmp17_ = _child_list;
			_tmp18_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp17_);
			_tmp19_ = _tmp18_;
			_child_size = _tmp19_;
			_child_index = -1;
			while (TRUE) {
				gint _tmp20_;
				gint _tmp21_;
				gint _tmp22_;
				RygelMediaObjects* _tmp23_;
				gint _tmp24_;
				gpointer _tmp25_ = NULL;
				RygelMediaObject* child;
				RygelMediaObject* _tmp26_;
				const gchar* _tmp27_;
				const gchar* _tmp28_;
				_tmp20_ = _child_index;
				_child_index = _tmp20_ + 1;
				_tmp21_ = _child_index;
				_tmp22_ = _child_size;
				if (!(_tmp21_ < _tmp22_)) {
					break;
				}
				_tmp23_ = _child_list;
				_tmp24_ = _child_index;
				_tmp25_ = gee_abstract_list_get ((GeeAbstractList*) _tmp23_, _tmp24_);
				child = (RygelMediaObject*) _tmp25_;
				_tmp26_ = child;
				_tmp27_ = _tmp26_->id;
				_tmp28_ = child_id;
				if (g_strcmp0 (_tmp27_, _tmp28_) == 0) {
					unique = FALSE;
					_g_object_unref0 (child);
					break;
				}
				_g_object_unref0 (child);
			}
			_g_object_unref0 (_child_list);
		}
	}
	result = unique;
	return result;
}


static void rygel_simple_container_real_get_children_data_free (gpointer _data) {
	RygelSimpleContainerGetChildrenData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelSimpleContainerGetChildrenData, _data_);
}


static void rygel_simple_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelSimpleContainer * self;
	RygelSimpleContainerGetChildrenData* _data_;
	RygelSimpleContainer* _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	self = (RygelSimpleContainer*) base;
	_data_ = g_slice_new0 (RygelSimpleContainerGetChildrenData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_simple_container_real_get_children);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_simple_container_real_get_children_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = offset;
	_data_->offset = _tmp1_;
	_tmp2_ = max_count;
	_data_->max_count = _tmp2_;
	_tmp3_ = cancellable;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_data_->cancellable = _tmp4_;
	rygel_simple_container_real_get_children_co (_data_);
}


static RygelMediaObjects* rygel_simple_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
	RygelMediaObjects* result;
	RygelSimpleContainerGetChildrenData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static gboolean rygel_simple_container_real_get_children_co (RygelSimpleContainerGetChildrenData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->offset;
	_data_->_tmp1_ = _data_->max_count;
	_data_->stop = _data_->_tmp0_ + _data_->_tmp1_;
	_data_->_tmp2_ = _data_->stop;
	_data_->_tmp3_ = ((RygelMediaContainer*) _data_->self)->child_count;
	_data_->_tmp4_ = 0U;
	_data_->_tmp4_ = CLAMP (_data_->_tmp2_, (guint) 0, (guint) _data_->_tmp3_);
	_data_->stop = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->self->children;
	_data_->_tmp6_ = _data_->offset;
	_data_->_tmp7_ = _data_->stop;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = gee_abstract_list_slice ((GeeAbstractList*) _data_->_tmp5_, (gint) _data_->_tmp6_, (gint) _data_->_tmp7_);
	_data_->result = RYGEL_IS_MEDIA_OBJECTS (_data_->_tmp8_) ? ((RygelMediaObjects*) _data_->_tmp8_) : NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void rygel_simple_container_real_find_object_data_free (gpointer _data) {
	RygelSimpleContainerFindObjectData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelSimpleContainerFindObjectData, _data_);
}


static void rygel_simple_container_real_find_object (RygelMediaContainer* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelSimpleContainer * self;
	RygelSimpleContainerFindObjectData* _data_;
	RygelSimpleContainer* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	self = (RygelSimpleContainer*) base;
	_data_ = g_slice_new0 (RygelSimpleContainerFindObjectData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_simple_container_real_find_object);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_simple_container_real_find_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_tmp2_ = g_strdup (_tmp1_);
	_data_->id = _tmp2_;
	_tmp3_ = cancellable;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_data_->cancellable = _tmp4_;
	rygel_simple_container_real_find_object_co (_data_);
}


static RygelMediaObject* rygel_simple_container_real_find_object_finish (RygelMediaContainer* base, GAsyncResult* _res_, GError** error) {
	RygelMediaObject* result;
	RygelSimpleContainerFindObjectData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static Block6Data* block6_data_ref (Block6Data* _data6_) {
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}


static void block6_data_unref (void * _userdata_) {
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		RygelSimpleContainer * self;
		self = _data6_->self;
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}


static Block7Data* block7_data_ref (Block7Data* _data7_) {
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}


static void block7_data_unref (void * _userdata_) {
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		RygelSimpleContainer * self;
		self = _data7_->_data6_->self;
		block6_data_unref (_data7_->_data6_);
		_data7_->_data6_ = NULL;
		g_slice_free (Block7Data, _data7_);
	}
}


static void ________lambda15_ (Block7Data* _data7_, RygelMediaContainer* _, RygelMediaContainer* updated) {
	Block6Data* _data6_;
	RygelSimpleContainer * self;
	RygelMediaContainer* _tmp0_;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	g_return_if_fail (_ != NULL);
	g_return_if_fail (updated != NULL);
	_tmp0_ = updated;
	if (_tmp0_ == RYGEL_MEDIA_CONTAINER (self)) {
		gint _tmp1_;
		gulong _tmp2_;
		_data6_->restart = TRUE;
		_tmp1_ = _data6_->restart_count;
		_data6_->restart_count = _tmp1_ + 1;
		_tmp2_ = _data7_->updated_id;
		g_signal_handler_disconnect ((GObject*) self, _tmp2_);
		_data7_->updated_id = (gulong) 0;
	}
}


static void _________lambda15__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self) {
	________lambda15_ (self, _sender, container);
}


static void rygel_simple_container_find_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelSimpleContainerFindObjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_simple_container_real_find_object_co (_data_);
}


static gboolean rygel_simple_container_real_find_object_co (RygelSimpleContainerFindObjectData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data6_ = g_slice_new0 (Block6Data);
	_data_->_data6_->_ref_count_ = 1;
	_data_->_data6_->self = g_object_ref (_data_->self);
	_data_->_data6_->_async_data_ = _data_;
	_data_->media_object = NULL;
	_data_->_data6_->restart_count = 0;
	_data_->_data6_->restart = FALSE;
	{
		_data_->_tmp0_ = TRUE;
		while (TRUE) {
			_data_->_data7_ = g_slice_new0 (Block7Data);
			_data_->_data7_->_ref_count_ = 1;
			_data_->_data7_->_data6_ = block6_data_ref (_data_->_data6_);
			_data_->_tmp1_ = _data_->_tmp0_;
			if (!_data_->_tmp1_) {
				_data_->_tmp3_ = _data_->_data6_->restart;
				if (_data_->_tmp3_) {
					_data_->_tmp4_ = _data_->_data6_->restart_count;
					_data_->_tmp2_ = _data_->_tmp4_ < 10;
				} else {
					_data_->_tmp2_ = FALSE;
				}
				_data_->_tmp5_ = _data_->_tmp2_;
				if (!_data_->_tmp5_) {
					block7_data_unref (_data_->_data7_);
					_data_->_data7_ = NULL;
					break;
				}
			}
			_data_->_tmp0_ = FALSE;
			_data_->_data6_->restart = FALSE;
			_data_->_data7_->updated_id = (gulong) 0;
			{
				_data_->_tmp6_ = _data_->self->children;
				_data_->_tmp7_ = _g_object_ref0 (_data_->_tmp6_);
				_data_->_child_list = _data_->_tmp7_;
				_data_->_tmp8_ = _data_->_child_list;
				_data_->_tmp9_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp8_);
				_data_->_tmp10_ = _data_->_tmp9_;
				_data_->_child_size = _data_->_tmp10_;
				_data_->_child_index = -1;
				while (TRUE) {
					_data_->_tmp11_ = _data_->_child_index;
					_data_->_child_index = _data_->_tmp11_ + 1;
					_data_->_tmp12_ = _data_->_child_index;
					_data_->_tmp13_ = _data_->_child_size;
					if (!(_data_->_tmp12_ < _data_->_tmp13_)) {
						break;
					}
					_data_->_tmp14_ = _data_->_child_list;
					_data_->_tmp15_ = _data_->_child_index;
					_data_->_tmp16_ = NULL;
					_data_->_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp14_, _data_->_tmp15_);
					_data_->child = (RygelMediaObject*) _data_->_tmp16_;
					_data_->_tmp17_ = _data_->child;
					_data_->_tmp18_ = _data_->_tmp17_->id;
					_data_->_tmp19_ = _data_->id;
					if (g_strcmp0 (_data_->_tmp18_, _data_->_tmp19_) == 0) {
						_data_->_tmp20_ = _data_->child;
						_data_->_tmp21_ = _g_object_ref0 (_data_->_tmp20_);
						_g_object_unref0 (_data_->media_object);
						_data_->media_object = _data_->_tmp21_;
						_g_object_unref0 (_data_->child);
						break;
					} else {
						_data_->_tmp22_ = _data_->child;
						if (RYGEL_IS_MEDIA_CONTAINER (_data_->_tmp22_)) {
							_data_->_tmp23_ = 0UL;
							_data_->_tmp23_ = g_signal_connect_data ((RygelMediaContainer*) _data_->self, "container-updated", (GCallback) _________lambda15__rygel_media_container_container_updated, block7_data_ref (_data_->_data7_), (GClosureNotify) block7_data_unref, 0);
							_data_->_data7_->updated_id = _data_->_tmp23_;
							_data_->_tmp24_ = _data_->child;
							_data_->_tmp25_ = _g_object_ref0 (RYGEL_IS_MEDIA_CONTAINER (_data_->_tmp24_) ? ((RygelMediaContainer*) _data_->_tmp24_) : NULL);
							_data_->container = _data_->_tmp25_;
							_data_->_tmp26_ = _data_->container;
							_data_->_tmp27_ = _data_->id;
							_data_->_tmp28_ = _data_->cancellable;
							_data_->_state_ = 1;
							rygel_media_container_find_object (_data_->_tmp26_, _data_->_tmp27_, _data_->_tmp28_, rygel_simple_container_find_object_ready, _data_);
							return FALSE;
							_state_1:
							_data_->_tmp29_ = NULL;
							_data_->_tmp29_ = rygel_media_container_find_object_finish (_data_->_tmp26_, _data_->_res_, &_data_->_inner_error_);
							_data_->_tmp30_ = _data_->_tmp29_;
							if (_data_->_inner_error_ != NULL) {
								g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
								g_error_free (_data_->_inner_error_);
								_g_object_unref0 (_data_->container);
								_g_object_unref0 (_data_->child);
								_g_object_unref0 (_data_->_child_list);
								block7_data_unref (_data_->_data7_);
								_data_->_data7_ = NULL;
								_g_object_unref0 (_data_->media_object);
								block6_data_unref (_data_->_data6_);
								_data_->_data6_ = NULL;
								if (_data_->_state_ == 0) {
									g_simple_async_result_complete_in_idle (_data_->_async_result);
								} else {
									g_simple_async_result_complete (_data_->_async_result);
								}
								g_object_unref (_data_->_async_result);
								return FALSE;
							}
							_g_object_unref0 (_data_->media_object);
							_data_->media_object = _data_->_tmp30_;
							_data_->_tmp31_ = _data_->_data7_->updated_id;
							if (_data_->_tmp31_ != ((gulong) 0)) {
								_data_->_tmp32_ = _data_->_data7_->updated_id;
								g_signal_handler_disconnect ((GObject*) _data_->self, _data_->_tmp32_);
							}
							_data_->_tmp33_ = _data_->media_object;
							if (_data_->_tmp33_ != NULL) {
								_data_->_data6_->restart = FALSE;
								_g_object_unref0 (_data_->container);
								_g_object_unref0 (_data_->child);
								break;
							}
							_data_->_tmp34_ = _data_->_data6_->restart;
							if (_data_->_tmp34_) {
								_g_object_unref0 (_data_->container);
								_g_object_unref0 (_data_->child);
								break;
							}
							_g_object_unref0 (_data_->container);
						}
					}
					_g_object_unref0 (_data_->child);
				}
				_g_object_unref0 (_data_->_child_list);
			}
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
		}
	}
	_data_->result = _data_->media_object;
	block6_data_unref (_data_->_data6_);
	_data_->_data6_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_object_unref0 (_data_->media_object);
	block6_data_unref (_data_->_data6_);
	_data_->_data6_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void rygel_simple_container_real_search_data_free (gpointer _data) {
	RygelSimpleContainerSearchData* _data_;
	_data_ = _data;
	_rygel_search_expression_unref0 (_data_->expression);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelSimpleContainerSearchData, _data_);
}


static gpointer _rygel_search_expression_ref0 (gpointer self) {
	return self ? rygel_search_expression_ref (self) : NULL;
}


static void rygel_simple_container_real_search (RygelSearchableContainer* base, RygelSearchExpression* expression, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelSimpleContainer * self;
	RygelSimpleContainerSearchData* _data_;
	RygelSimpleContainer* _tmp0_;
	RygelSearchExpression* _tmp1_;
	RygelSearchExpression* _tmp2_;
	guint _tmp3_;
	guint _tmp4_;
	GCancellable* _tmp5_;
	GCancellable* _tmp6_;
	self = (RygelSimpleContainer*) base;
	_data_ = g_slice_new0 (RygelSimpleContainerSearchData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_simple_container_real_search);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_simple_container_real_search_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = expression;
	_tmp2_ = _rygel_search_expression_ref0 (_tmp1_);
	_data_->expression = _tmp2_;
	_tmp3_ = offset;
	_data_->offset = _tmp3_;
	_tmp4_ = max_count;
	_data_->max_count = _tmp4_;
	_tmp5_ = cancellable;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_data_->cancellable = _tmp6_;
	rygel_simple_container_real_search_co (_data_);
}


static RygelMediaObjects* rygel_simple_container_real_search_finish (RygelSearchableContainer* base, GAsyncResult* _res_, guint* total_matches, GError** error) {
	RygelMediaObjects* result;
	RygelSimpleContainerSearchData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	if (total_matches) {
		*total_matches = _data_->total_matches;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void rygel_simple_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelSimpleContainerSearchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_simple_container_real_search_co (_data_);
}


static gboolean rygel_simple_container_real_search_co (RygelSimpleContainerSearchData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->expression;
	_data_->_tmp1_ = _data_->offset;
	_data_->_tmp2_ = _data_->max_count;
	_data_->_tmp3_ = _data_->cancellable;
	_data_->_tmp4_ = 0U;
	_data_->_state_ = 1;
	rygel_searchable_container_simple_search ((RygelSearchableContainer*) _data_->self, _data_->_tmp0_, _data_->_tmp1_, _data_->_tmp2_, _data_->_tmp3_, rygel_simple_container_search_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = rygel_searchable_container_simple_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp4_, &_data_->_inner_error_);
	_data_->total_matches = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->_tmp5_;
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->_tmp6_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void rygel_simple_container_add_child (RygelSimpleContainer* self, RygelMediaObject* child) {
	RygelMediaObjects* _tmp0_;
	RygelMediaObject* _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = self->children;
	_tmp1_ = child;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp1_);
	_tmp2_ = ((RygelMediaContainer*) self)->child_count;
	((RygelMediaContainer*) self)->child_count = _tmp2_ + 1;
}


static void rygel_simple_container_on_container_updated (RygelSimpleContainer* self, RygelMediaContainer* source, RygelMediaContainer* updated) {
	RygelMediaContainer* _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (source != NULL);
	g_return_if_fail (updated != NULL);
	_tmp0_ = updated;
	_tmp1_ = _tmp0_->child_count;
	if (_tmp1_ > 0) {
		RygelMediaObjects* _tmp2_;
		RygelMediaContainer* _tmp3_;
		gboolean _tmp4_ = FALSE;
		RygelMediaObjects* _tmp5_;
		RygelMediaContainer* _tmp6_;
		RygelMediaContainer* _tmp7_;
		RygelMediaContainer* _tmp8_;
		const gchar* _tmp9_;
		_tmp2_ = self->priv->empty_children;
		_tmp3_ = updated;
		_tmp4_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp2_, (RygelMediaObject*) _tmp3_);
		if (!_tmp4_) {
			return;
		}
		_tmp5_ = self->priv->empty_children;
		_tmp6_ = updated;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp5_, (RygelMediaObject*) _tmp6_);
		_tmp7_ = updated;
		rygel_simple_container_add_child (self, (RygelMediaObject*) _tmp7_);
		rygel_media_container_updated ((RygelMediaContainer*) self);
		_tmp8_ = updated;
		_tmp9_ = ((RygelMediaObject*) _tmp8_)->id;
		g_debug ("rygel-simple-container.vala:219: Container '%s' now non-empty, added i" \
"t to hierarchy now.", _tmp9_);
	} else {
		RygelMediaObjects* _tmp10_;
		RygelMediaContainer* _tmp11_;
		gboolean _tmp12_ = FALSE;
		RygelMediaContainer* _tmp13_;
		RygelMediaObjects* _tmp14_;
		RygelMediaContainer* _tmp15_;
		RygelMediaContainer* _tmp16_;
		const gchar* _tmp17_;
		_tmp10_ = self->children;
		_tmp11_ = updated;
		_tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, (RygelMediaObject*) _tmp11_);
		if (!_tmp12_) {
			return;
		}
		_tmp13_ = updated;
		rygel_simple_container_remove_child (self, (RygelMediaObject*) _tmp13_);
		_tmp14_ = self->priv->empty_children;
		_tmp15_ = updated;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, (RygelMediaObject*) _tmp15_);
		rygel_media_container_updated ((RygelMediaContainer*) self);
		_tmp16_ = updated;
		_tmp17_ = ((RygelMediaObject*) _tmp16_)->id;
		g_debug ("rygel-simple-container.vala:231: Container '%s' now empty, removing it" \
" from hierarchy now.", _tmp17_);
	}
}


static GeeArrayList* rygel_simple_container_real_get_search_classes (RygelSearchableContainer* base) {
	GeeArrayList* result;
	RygelSimpleContainer* self;
	GeeArrayList* _tmp0_;
	self = (RygelSimpleContainer*) base;
	_tmp0_ = self->priv->_search_classes;
	result = _tmp0_;
	return result;
}


static void rygel_simple_container_real_set_search_classes (RygelSearchableContainer* base, GeeArrayList* value) {
	RygelSimpleContainer* self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	self = (RygelSimpleContainer*) base;
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_search_classes);
	self->priv->_search_classes = _tmp1_;
	g_object_notify ((GObject *) self, "search-classes");
}


static void rygel_simple_container_class_init (RygelSimpleContainerClass * klass) {
	rygel_simple_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelSimpleContainerPrivate));
	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children = rygel_simple_container_real_get_children;
	RYGEL_MEDIA_CONTAINER_CLASS (klass)->get_children_finish = rygel_simple_container_real_get_children_finish;
	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object = rygel_simple_container_real_find_object;
	RYGEL_MEDIA_CONTAINER_CLASS (klass)->find_object_finish = rygel_simple_container_real_find_object_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_simple_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_simple_container_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_simple_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_SIMPLE_CONTAINER_SEARCH_CLASSES, g_param_spec_object ("search-classes", "search-classes", "search-classes", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void rygel_simple_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface * iface) {
	rygel_simple_container_rygel_searchable_container_parent_iface = g_type_interface_peek_parent (iface);
	iface->search = (RygelMediaObjects* (*)(RygelSearchableContainer*, RygelSearchExpression*, guint, guint, guint*, GCancellable*, GError**)) rygel_simple_container_real_search;
	iface->search_finish = rygel_simple_container_real_search_finish;
	iface->get_search_classes = rygel_simple_container_real_get_search_classes;
	iface->set_search_classes = rygel_simple_container_real_set_search_classes;
}


static void rygel_simple_container_instance_init (RygelSimpleContainer * self) {
	self->priv = RYGEL_SIMPLE_CONTAINER_GET_PRIVATE (self);
}


static void rygel_simple_container_finalize (GObject* obj) {
	RygelSimpleContainer * self;
	self = RYGEL_SIMPLE_CONTAINER (obj);
	_g_object_unref0 (self->children);
	_g_object_unref0 (self->priv->empty_children);
	_g_object_unref0 (self->priv->_search_classes);
	G_OBJECT_CLASS (rygel_simple_container_parent_class)->finalize (obj);
}


/**
 * A simple implementation of MediaContainer that keeps all MediaObjects
 * in memory. In order for it to be of any use, you must add children to
 * children ArrayList field.
 */
GType rygel_simple_container_get_type (void) {
	static volatile gsize rygel_simple_container_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_simple_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelSimpleContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_simple_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelSimpleContainer), 0, (GInstanceInitFunc) rygel_simple_container_instance_init, NULL };
		static const GInterfaceInfo rygel_searchable_container_info = { (GInterfaceInitFunc) rygel_simple_container_rygel_searchable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_simple_container_type_id;
		rygel_simple_container_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_CONTAINER, "RygelSimpleContainer", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_simple_container_type_id, RYGEL_TYPE_SEARCHABLE_CONTAINER, &rygel_searchable_container_info);
		g_once_init_leave (&rygel_simple_container_type_id__volatile, rygel_simple_container_type_id);
	}
	return rygel_simple_container_type_id__volatile;
}


static void _vala_rygel_simple_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	RygelSimpleContainer * self;
	self = RYGEL_SIMPLE_CONTAINER (object);
	switch (property_id) {
		case RYGEL_SIMPLE_CONTAINER_SEARCH_CLASSES:
		g_value_set_object (value, rygel_searchable_container_get_search_classes ((RygelSearchableContainer*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_rygel_simple_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	RygelSimpleContainer * self;
	self = RYGEL_SIMPLE_CONTAINER (object);
	switch (property_id) {
		case RYGEL_SIMPLE_CONTAINER_SEARCH_CLASSES:
		rygel_searchable_container_set_search_classes ((RygelSearchableContainer*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



