/* test.c generated by valac 0.32.1, the Vala compiler
 * generated from test.vala, do not modify */

/*
 * Copyright (C) 2012 Jens Georg.
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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 library; 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 <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gee.h>
#include <libgupnp-av/gupnp-av.h>


#define TYPE_SEARCH_EXPRESSION (search_expression_get_type ())
#define SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SEARCH_EXPRESSION, SearchExpression))
#define SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SEARCH_EXPRESSION, SearchExpressionClass))
#define IS_SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SEARCH_EXPRESSION))
#define IS_SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SEARCH_EXPRESSION))
#define SEARCH_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SEARCH_EXPRESSION, SearchExpressionClass))

typedef struct _SearchExpression SearchExpression;
typedef struct _SearchExpressionClass SearchExpressionClass;
typedef struct _SearchExpressionPrivate SearchExpressionPrivate;

#define TYPE_RELATIONAL_EXPRESSION (relational_expression_get_type ())
#define RELATIONAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RELATIONAL_EXPRESSION, RelationalExpression))
#define RELATIONAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RELATIONAL_EXPRESSION, RelationalExpressionClass))
#define IS_RELATIONAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RELATIONAL_EXPRESSION))
#define IS_RELATIONAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RELATIONAL_EXPRESSION))
#define RELATIONAL_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RELATIONAL_EXPRESSION, RelationalExpressionClass))

typedef struct _RelationalExpression RelationalExpression;
typedef struct _RelationalExpressionClass RelationalExpressionClass;
typedef struct _RelationalExpressionPrivate RelationalExpressionPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_MEDIA_OBJECT (media_object_get_type ())
#define MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_OBJECT, MediaObject))
#define MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_OBJECT, MediaObjectClass))
#define IS_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_OBJECT))
#define IS_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_OBJECT))
#define MEDIA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_OBJECT, MediaObjectClass))

typedef struct _MediaObject MediaObject;
typedef struct _MediaObjectClass MediaObjectClass;
typedef struct _MediaObjectPrivate MediaObjectPrivate;

#define TYPE_MEDIA_CONTAINER (media_container_get_type ())
#define MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_CONTAINER, MediaContainer))
#define MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_CONTAINER, MediaContainerClass))
#define IS_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_CONTAINER))
#define IS_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_CONTAINER))
#define MEDIA_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_CONTAINER, MediaContainerClass))

typedef struct _MediaContainer MediaContainer;
typedef struct _MediaContainerClass MediaContainerClass;
typedef struct _MediaContainerPrivate MediaContainerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_MEDIA_OBJECTS (media_objects_get_type ())
#define MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_OBJECTS, MediaObjects))
#define MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_OBJECTS, MediaObjectsClass))
#define IS_MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_OBJECTS))
#define IS_MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_OBJECTS))
#define MEDIA_OBJECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_OBJECTS, MediaObjectsClass))

typedef struct _MediaObjects MediaObjects;
typedef struct _MediaObjectsClass MediaObjectsClass;
typedef struct _Block1Data Block1Data;
typedef struct _MediaContainerGetChildrenData MediaContainerGetChildrenData;

#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 TYPE_TEST_CONTAINER (test_container_get_type ())
#define TEST_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST_CONTAINER, TestContainer))
#define TEST_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TEST_CONTAINER, TestContainerClass))
#define IS_TEST_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST_CONTAINER))
#define IS_TEST_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TEST_CONTAINER))
#define TEST_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TEST_CONTAINER, TestContainerClass))

typedef struct _TestContainer TestContainer;
typedef struct _TestContainerClass TestContainerClass;
typedef struct _TestContainerPrivate TestContainerPrivate;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _TestContainerTestSearchNoLimitData TestContainerTestSearchNoLimitData;
typedef struct _TestContainerTestSearchWithLimitData TestContainerTestSearchWithLimitData;
typedef struct _TestContainerSearchData TestContainerSearchData;
typedef struct _MediaObjectsPrivate MediaObjectsPrivate;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _SearchExpression {
	GObject parent_instance;
	SearchExpressionPrivate * priv;
	gchar* operand1;
	gchar* operand2;
	gchar* op;
};

struct _SearchExpressionClass {
	GObjectClass parent_class;
};

struct _RelationalExpression {
	SearchExpression parent_instance;
	RelationalExpressionPrivate * priv;
};

struct _RelationalExpressionClass {
	SearchExpressionClass parent_class;
};

struct _MediaObject {
	GObject parent_instance;
	MediaObjectPrivate * priv;
};

struct _MediaObjectClass {
	GObjectClass parent_class;
};

struct _MediaContainer {
	MediaObject parent_instance;
	MediaContainerPrivate * priv;
	gchar* sort_criteria;
	gint child_count;
	gboolean create_mode_enabled;
};

struct _MediaContainerClass {
	MediaObjectClass parent_class;
};

struct _Block1Data {
	int _ref_count_;
	MediaContainer* self;
	gpointer _async_data_;
};

struct _MediaContainerGetChildrenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	MediaContainer* self;
	guint offset;
	guint max_count;
	gchar* sort_criteria;
	GCancellable* cancellable;
	MediaObjects* result;
	Block1Data* _data1_;
	MediaObjects* _result_;
	MediaObjects* _tmp0_;
	gint i;
	gboolean _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	MediaObjects* _tmp4_;
	MediaObject* _tmp5_;
	MediaObject* _tmp6_;
};

struct _RygelSearchableContainerIface {
	GTypeInterface parent_iface;
	void (*search) (RygelSearchableContainer* self, SearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	MediaObjects* (*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 _TestContainer {
	MediaContainer parent_instance;
	TestContainerPrivate * priv;
	GMainLoop* loop;
};

struct _TestContainerClass {
	MediaContainerClass parent_class;
};

struct _TestContainerPrivate {
	GeeArrayList* _search_classes;
};

struct _TestContainerTestSearchNoLimitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TestContainer* self;
	guint total_matches;
	MediaObjects* _result_;
	guint _tmp0_;
	MediaObjects* _tmp1_;
	guint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	GError* _error_;
	MediaObjects* _vala1__result_;
	guint _tmp5_;
	MediaObjects* _tmp6_;
	guint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GError* _vala1__error_;
	gint i;
	gboolean _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	MediaObjects* _vala2__result_;
	gint _tmp13_;
	guint _tmp14_;
	MediaObjects* _tmp15_;
	guint _tmp16_;
	MediaObjects* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	GError* _vala2__error_;
	GMainLoop* _tmp21_;
	GError * _inner_error_;
};

struct _TestContainerTestSearchWithLimitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TestContainer* self;
	guint total_matches;
	MediaObjects* _result_;
	guint _tmp0_;
	MediaObjects* _tmp1_;
	guint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	GError* _error_;
	MediaObjects* _vala1__result_;
	guint _tmp5_;
	MediaObjects* _tmp6_;
	guint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	GError* _vala1__error_;
	gint i;
	gboolean _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	MediaObjects* _vala2__result_;
	gint _tmp13_;
	guint _tmp14_;
	MediaObjects* _tmp15_;
	guint _tmp16_;
	MediaObjects* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	GError* _vala2__error_;
	GMainLoop* _tmp22_;
	GError * _inner_error_;
};

struct _TestContainerSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TestContainer* self;
	SearchExpression* expression;
	guint offset;
	guint max_count;
	guint total_matches;
	gchar* sort_criteria;
	GCancellable* cancellable;
	MediaObjects* result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	MediaObjects* _tmp3_;
	SearchExpression* _tmp4_;
	guint _tmp5_;
	guint _tmp6_;
	GCancellable* _tmp7_;
	guint _tmp8_;
	MediaObjects* _tmp9_;
	MediaObjects* _tmp10_;
	GError * _inner_error_;
};

struct _MediaObjects {
	GeeArrayList parent_instance;
	MediaObjectsPrivate * priv;
};

struct _MediaObjectsClass {
	GeeArrayListClass parent_class;
};


static gpointer relational_expression_parent_class = NULL;
static gpointer search_expression_parent_class = NULL;
static gpointer media_object_parent_class = NULL;
static gpointer media_container_parent_class = NULL;
static gpointer test_container_parent_class = NULL;
static RygelSearchableContainerIface* test_container_rygel_searchable_container_parent_iface = NULL;
static gpointer media_objects_parent_class = NULL;

GType search_expression_get_type (void) G_GNUC_CONST;
GType relational_expression_get_type (void) G_GNUC_CONST;
enum  {
	RELATIONAL_EXPRESSION_DUMMY_PROPERTY
};
RelationalExpression* relational_expression_new (void);
RelationalExpression* relational_expression_construct (GType object_type);
SearchExpression* search_expression_new (void);
SearchExpression* search_expression_construct (GType object_type);
#define SEARCH_CRITERIA_OP_EQ "="
enum  {
	SEARCH_EXPRESSION_DUMMY_PROPERTY
};
GType media_object_get_type (void) G_GNUC_CONST;
gboolean search_expression_satisfied_by (SearchExpression* self, MediaObject* object);
static void search_expression_finalize (GObject* obj);
enum  {
	MEDIA_OBJECT_DUMMY_PROPERTY
};
MediaObject* media_object_new (void);
MediaObject* media_object_construct (GType object_type);
GType media_container_get_type (void) G_GNUC_CONST;
enum  {
	MEDIA_CONTAINER_DUMMY_PROPERTY,
	MEDIA_CONTAINER_ALL_CHILD_COUNT
};
static void media_container_get_children_data_free (gpointer _data);
GType media_objects_get_type (void) G_GNUC_CONST;
void media_container_get_children (MediaContainer* self, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
MediaObjects* media_container_get_children_finish (MediaContainer* self, GAsyncResult* _res_, GError** error);
static gboolean media_container_get_children_co (MediaContainerGetChildrenData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean __lambda4_ (Block1Data* _data1_);
static gboolean ___lambda4__gsource_func (gpointer self);
MediaObjects* media_objects_new (void);
MediaObjects* media_objects_construct (GType object_type);
void media_container_check_search_expression (MediaContainer* self, SearchExpression* expression);
MediaContainer* media_container_new (void);
MediaContainer* media_container_construct (GType object_type);
gint media_container_get_all_child_count (MediaContainer* self);
static void media_container_finalize (GObject* obj);
static void _vala_media_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
GType rygel_searchable_container_get_type (void) G_GNUC_CONST;
GType test_container_get_type (void) G_GNUC_CONST;
#define TEST_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TEST_CONTAINER, TestContainerPrivate))
enum  {
	TEST_CONTAINER_DUMMY_PROPERTY,
	TEST_CONTAINER_SEARCH_CLASSES
};
static void test_container_test_search_no_limit_data_free (gpointer _data);
void test_container_test_search_no_limit (TestContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void test_container_test_search_no_limit_finish (TestContainer* self, GAsyncResult* _res_);
static gboolean test_container_test_search_no_limit_co (TestContainerTestSearchNoLimitData* _data_);
void rygel_searchable_container_search (RygelSearchableContainer* self, SearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
MediaObjects* rygel_searchable_container_search_finish (RygelSearchableContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
static void test_container_test_search_no_limit_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void test_container_test_search_with_limit_data_free (gpointer _data);
void test_container_test_search_with_limit (TestContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void test_container_test_search_with_limit_finish (TestContainer* self, GAsyncResult* _res_);
static gboolean test_container_test_search_with_limit_co (TestContainerTestSearchWithLimitData* _data_);
static void test_container_test_search_with_limit_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void test_container_test_serialization (TestContainer* self);
void rygel_searchable_container_serialize_search_parameters (RygelSearchableContainer* self, GUPnPDIDLLiteContainer* didl_container);
static void test_container_real_search_data_free (gpointer _data);
static void test_container_real_search (RygelSearchableContainer* base, SearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean test_container_real_search_co (TestContainerSearchData* _data_);
void rygel_searchable_container_simple_search (RygelSearchableContainer* self, SearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
MediaObjects* rygel_searchable_container_simple_search_finish (RygelSearchableContainer* self, GAsyncResult* _res_, guint* total_matches, GError** error);
static void test_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
TestContainer* test_container_new (void);
TestContainer* test_container_construct (GType object_type);
static void test_container_finalize (GObject* obj);
GeeArrayList* rygel_searchable_container_get_search_classes (RygelSearchableContainer* self);
static void _vala_test_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
void rygel_searchable_container_set_search_classes (RygelSearchableContainer* self, GeeArrayList* value);
static void _vala_test_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
enum  {
	MEDIA_OBJECTS_DUMMY_PROPERTY
};
static GeeList* media_objects_real_slice (GeeAbstractList* base, gint start, gint stop);
gint _vala_main (void);


RelationalExpression* relational_expression_construct (GType object_type) {
	RelationalExpression * self = NULL;
	self = (RelationalExpression*) search_expression_construct (object_type);
	return self;
}


RelationalExpression* relational_expression_new (void) {
	return relational_expression_construct (TYPE_RELATIONAL_EXPRESSION);
}


static void relational_expression_class_init (RelationalExpressionClass * klass) {
	relational_expression_parent_class = g_type_class_peek_parent (klass);
}


static void relational_expression_instance_init (RelationalExpression * self) {
}


GType relational_expression_get_type (void) {
	static volatile gsize relational_expression_type_id__volatile = 0;
	if (g_once_init_enter (&relational_expression_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RelationalExpressionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) relational_expression_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RelationalExpression), 0, (GInstanceInitFunc) relational_expression_instance_init, NULL };
		GType relational_expression_type_id;
		relational_expression_type_id = g_type_register_static (TYPE_SEARCH_EXPRESSION, "RelationalExpression", &g_define_type_info, 0);
		g_once_init_leave (&relational_expression_type_id__volatile, relational_expression_type_id);
	}
	return relational_expression_type_id__volatile;
}


gboolean search_expression_satisfied_by (SearchExpression* self, MediaObject* object) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (object != NULL, FALSE);
	result = TRUE;
	return result;
}


SearchExpression* search_expression_construct (GType object_type) {
	SearchExpression * self = NULL;
	self = (SearchExpression*) g_object_new (object_type, NULL);
	return self;
}


SearchExpression* search_expression_new (void) {
	return search_expression_construct (TYPE_SEARCH_EXPRESSION);
}


static void search_expression_class_init (SearchExpressionClass * klass) {
	search_expression_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = search_expression_finalize;
}


static void search_expression_instance_init (SearchExpression * self) {
}


static void search_expression_finalize (GObject* obj) {
	SearchExpression * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_SEARCH_EXPRESSION, SearchExpression);
	_g_free0 (self->operand1);
	_g_free0 (self->operand2);
	_g_free0 (self->op);
	G_OBJECT_CLASS (search_expression_parent_class)->finalize (obj);
}


GType search_expression_get_type (void) {
	static volatile gsize search_expression_type_id__volatile = 0;
	if (g_once_init_enter (&search_expression_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SearchExpressionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) search_expression_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SearchExpression), 0, (GInstanceInitFunc) search_expression_instance_init, NULL };
		GType search_expression_type_id;
		search_expression_type_id = g_type_register_static (G_TYPE_OBJECT, "SearchExpression", &g_define_type_info, 0);
		g_once_init_leave (&search_expression_type_id__volatile, search_expression_type_id);
	}
	return search_expression_type_id__volatile;
}


MediaObject* media_object_construct (GType object_type) {
	MediaObject * self = NULL;
	self = (MediaObject*) g_object_new (object_type, NULL);
	return self;
}


MediaObject* media_object_new (void) {
	return media_object_construct (TYPE_MEDIA_OBJECT);
}


static void media_object_class_init (MediaObjectClass * klass) {
	media_object_parent_class = g_type_class_peek_parent (klass);
}


static void media_object_instance_init (MediaObject * self) {
}


GType media_object_get_type (void) {
	static volatile gsize media_object_type_id__volatile = 0;
	if (g_once_init_enter (&media_object_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (MediaObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaObject), 0, (GInstanceInitFunc) media_object_instance_init, NULL };
		GType media_object_type_id;
		media_object_type_id = g_type_register_static (G_TYPE_OBJECT, "MediaObject", &g_define_type_info, 0);
		g_once_init_leave (&media_object_type_id__volatile, media_object_type_id);
	}
	return media_object_type_id__volatile;
}


static void media_container_get_children_data_free (gpointer _data) {
	MediaContainerGetChildrenData* _data_;
	_data_ = _data;
	_g_free0 (_data_->sort_criteria);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (MediaContainerGetChildrenData, _data_);
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void media_container_get_children (MediaContainer* self, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	MediaContainerGetChildrenData* _data_;
	MediaContainer* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GCancellable* _tmp5_ = NULL;
	GCancellable* _tmp6_ = NULL;
	_data_ = g_slice_new0 (MediaContainerGetChildrenData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, media_container_get_children);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, media_container_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_ = sort_criteria;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_data_->sort_criteria);
	_data_->sort_criteria = _tmp4_;
	_tmp5_ = cancellable;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp6_;
	media_container_get_children_co (_data_);
}


MediaObjects* media_container_get_children_finish (MediaContainer* self, GAsyncResult* _res_, GError** error) {
	MediaObjects* result;
	MediaContainerGetChildrenData* _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 Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		MediaContainer* self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static gboolean __lambda4_ (Block1Data* _data1_) {
	MediaContainer* self;
	gboolean result = FALSE;
	self = _data1_->self;
	media_container_get_children_co (_data1_->_async_data_);
	result = FALSE;
	return result;
}


static gboolean ___lambda4__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda4_ (self);
	return result;
}


static gboolean media_container_get_children_co (MediaContainerGetChildrenData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_data_->_data1_->self = g_object_ref (_data_->self);
	_data_->_data1_->_async_data_ = _data_;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda4__gsource_func, block1_data_ref (_data_->_data1_), block1_data_unref);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = media_objects_new ();
	_data_->_result_ = _data_->_tmp0_;
	{
		_data_->i = 0;
		{
			_data_->_tmp1_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp1_) {
					_data_->_tmp2_ = 0;
					_data_->_tmp2_ = _data_->i;
					_data_->i = _data_->_tmp2_ + 1;
				}
				_data_->_tmp1_ = FALSE;
				_data_->_tmp3_ = 0;
				_data_->_tmp3_ = _data_->i;
				if (!(_data_->_tmp3_ < 10)) {
					break;
				}
				_data_->_tmp4_ = NULL;
				_data_->_tmp4_ = _data_->_result_;
				_data_->_tmp5_ = NULL;
				_data_->_tmp5_ = media_object_new ();
				_data_->_tmp6_ = NULL;
				_data_->_tmp6_ = _data_->_tmp5_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp4_, _data_->_tmp6_);
				_g_object_unref0 (_data_->_tmp6_);
			}
		}
	}
	_data_->result = _data_->_result_;
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = 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_->_result_);
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = 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;
}


void media_container_check_search_expression (MediaContainer* self, SearchExpression* expression) {
	g_return_if_fail (self != NULL);
}


MediaContainer* media_container_construct (GType object_type) {
	MediaContainer * self = NULL;
	self = (MediaContainer*) media_object_construct (object_type);
	return self;
}


MediaContainer* media_container_new (void) {
	return media_container_construct (TYPE_MEDIA_CONTAINER);
}


gint media_container_get_all_child_count (MediaContainer* self) {
	gint result;
	gint _tmp0_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->child_count;
	result = _tmp0_;
	return result;
}


static void media_container_class_init (MediaContainerClass * klass) {
	media_container_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_media_container_get_property;
	G_OBJECT_CLASS (klass)->finalize = media_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), MEDIA_CONTAINER_ALL_CHILD_COUNT, g_param_spec_int ("all-child-count", "all-child-count", "all-child-count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void media_container_instance_init (MediaContainer * self) {
	gchar* _tmp0_ = NULL;
	_tmp0_ = g_strdup ("+dc:title");
	self->sort_criteria = _tmp0_;
	self->child_count = 10;
	self->create_mode_enabled = FALSE;
}


static void media_container_finalize (GObject* obj) {
	MediaContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MEDIA_CONTAINER, MediaContainer);
	_g_free0 (self->sort_criteria);
	G_OBJECT_CLASS (media_container_parent_class)->finalize (obj);
}


GType media_container_get_type (void) {
	static volatile gsize media_container_type_id__volatile = 0;
	if (g_once_init_enter (&media_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (MediaContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaContainer), 0, (GInstanceInitFunc) media_container_instance_init, NULL };
		GType media_container_type_id;
		media_container_type_id = g_type_register_static (TYPE_MEDIA_OBJECT, "MediaContainer", &g_define_type_info, 0);
		g_once_init_leave (&media_container_type_id__volatile, media_container_type_id);
	}
	return media_container_type_id__volatile;
}


static void _vala_media_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	MediaContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_MEDIA_CONTAINER, MediaContainer);
	switch (property_id) {
		case MEDIA_CONTAINER_ALL_CHILD_COUNT:
		g_value_set_int (value, media_container_get_all_child_count (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void test_container_test_search_no_limit_data_free (gpointer _data) {
	TestContainerTestSearchNoLimitData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (TestContainerTestSearchNoLimitData, _data_);
}


void test_container_test_search_no_limit (TestContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TestContainerTestSearchNoLimitData* _data_;
	TestContainer* _tmp0_ = NULL;
	_data_ = g_slice_new0 (TestContainerTestSearchNoLimitData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, test_container_test_search_no_limit);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, test_container_test_search_no_limit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	test_container_test_search_no_limit_co (_data_);
}


void test_container_test_search_no_limit_finish (TestContainer* self, GAsyncResult* _res_) {
	TestContainerTestSearchNoLimitData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void test_container_test_search_no_limit_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TestContainerTestSearchNoLimitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	test_container_test_search_no_limit_co (_data_);
}


static gboolean test_container_test_search_no_limit_co (TestContainerTestSearchNoLimitData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->total_matches = (guint) 0;
	{
		_data_->_tmp0_ = 0U;
		_data_->_state_ = 1;
		rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) 0, (guint) 0, "", NULL, test_container_test_search_no_limit_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = NULL;
		_data_->_tmp1_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp0_, &_data_->_inner_error_);
		_data_->total_matches = _data_->_tmp0_;
		_data_->_result_ = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = 0U;
		_data_->_tmp2_ = _data_->total_matches;
		_vala_assert (_data_->_tmp2_ == ((guint) 10), "total_matches == 10");
		_data_->_tmp3_ = 0;
		_data_->_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_result_);
		_data_->_tmp4_ = 0;
		_data_->_tmp4_ = _data_->_tmp3_;
		_vala_assert (_data_->_tmp4_ == 10, "result.size == 10");
		_g_object_unref0 (_data_->_result_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_data_->_error_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	{
		_data_->_tmp5_ = 0U;
		_data_->_state_ = 2;
		rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) 10, (guint) 0, "", NULL, test_container_test_search_no_limit_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp5_, &_data_->_inner_error_);
		_data_->total_matches = _data_->_tmp5_;
		_data_->_vala1__result_ = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp7_ = 0U;
		_data_->_tmp7_ = _data_->total_matches;
		_vala_assert (_data_->_tmp7_ == ((guint) 10), "total_matches == 10");
		_data_->_tmp8_ = 0;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_vala1__result_);
		_data_->_tmp9_ = 0;
		_data_->_tmp9_ = _data_->_tmp8_;
		_vala_assert (_data_->_tmp9_ == 0, "result.size == 0");
		_g_object_unref0 (_data_->_vala1__result_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1__error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_data_->_vala1__error_);
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	{
		_data_->i = 1;
		{
			_data_->_tmp10_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp10_) {
					_data_->_tmp11_ = 0;
					_data_->_tmp11_ = _data_->i;
					_data_->i = _data_->_tmp11_ + 1;
				}
				_data_->_tmp10_ = FALSE;
				_data_->_tmp12_ = 0;
				_data_->_tmp12_ = _data_->i;
				if (!(_data_->_tmp12_ < 10)) {
					break;
				}
				{
					_data_->_tmp13_ = 0;
					_data_->_tmp13_ = _data_->i;
					_data_->_tmp14_ = 0U;
					_data_->_state_ = 3;
					rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) _data_->_tmp13_, (guint) 0, "", NULL, test_container_test_search_no_limit_ready, _data_);
					return FALSE;
					_state_3:
					_data_->_tmp15_ = NULL;
					_data_->_tmp15_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp14_, &_data_->_inner_error_);
					_data_->total_matches = _data_->_tmp14_;
					_data_->_vala2__result_ = _data_->_tmp15_;
					if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
						goto __catch2_g_error;
					}
					_data_->_tmp16_ = 0U;
					_data_->_tmp16_ = _data_->total_matches;
					_vala_assert (_data_->_tmp16_ == ((guint) 10), "total_matches == 10");
					_data_->_tmp17_ = NULL;
					_data_->_tmp17_ = _data_->_vala2__result_;
					_data_->_tmp18_ = 0;
					_data_->_tmp18_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp17_);
					_data_->_tmp19_ = 0;
					_data_->_tmp19_ = _data_->_tmp18_;
					_data_->_tmp20_ = 0;
					_data_->_tmp20_ = _data_->i;
					_vala_assert (_data_->_tmp19_ == (10 - _data_->_tmp20_), "result.size == 10 - i");
					_g_object_unref0 (_data_->_vala2__result_);
				}
				goto __finally2;
				__catch2_g_error:
				{
					_data_->_vala2__error_ = _data_->_inner_error_;
					_data_->_inner_error_ = NULL;
					g_assert_not_reached ();
					_g_error_free0 (_data_->_vala2__error_);
				}
				__finally2:
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
		}
	}
	_data_->_tmp21_ = NULL;
	_data_->_tmp21_ = _data_->self->loop;
	g_main_loop_quit (_data_->_tmp21_);
	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 test_container_test_search_with_limit_data_free (gpointer _data) {
	TestContainerTestSearchWithLimitData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (TestContainerTestSearchWithLimitData, _data_);
}


void test_container_test_search_with_limit (TestContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TestContainerTestSearchWithLimitData* _data_;
	TestContainer* _tmp0_ = NULL;
	_data_ = g_slice_new0 (TestContainerTestSearchWithLimitData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, test_container_test_search_with_limit);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, test_container_test_search_with_limit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	test_container_test_search_with_limit_co (_data_);
}


void test_container_test_search_with_limit_finish (TestContainer* self, GAsyncResult* _res_) {
	TestContainerTestSearchWithLimitData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void test_container_test_search_with_limit_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TestContainerTestSearchWithLimitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	test_container_test_search_with_limit_co (_data_);
}


static gboolean test_container_test_search_with_limit_co (TestContainerTestSearchWithLimitData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = 0U;
		_data_->_state_ = 1;
		rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) 0, (guint) 4, "", NULL, test_container_test_search_with_limit_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = NULL;
		_data_->_tmp1_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp0_, &_data_->_inner_error_);
		_data_->total_matches = _data_->_tmp0_;
		_data_->_result_ = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch3_g_error;
		}
		_data_->_tmp2_ = 0U;
		_data_->_tmp2_ = _data_->total_matches;
		_vala_assert (_data_->_tmp2_ == ((guint) 0), "total_matches == 0");
		_data_->_tmp3_ = 0;
		_data_->_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_result_);
		_data_->_tmp4_ = 0;
		_data_->_tmp4_ = _data_->_tmp3_;
		_vala_assert (_data_->_tmp4_ == 4, "result.size == 4");
		_g_object_unref0 (_data_->_result_);
	}
	goto __finally3;
	__catch3_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_data_->_error_);
	}
	__finally3:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	{
		_data_->_tmp5_ = 0U;
		_data_->_state_ = 2;
		rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) 10, (guint) 4, "", NULL, test_container_test_search_with_limit_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp5_, &_data_->_inner_error_);
		_data_->total_matches = _data_->_tmp5_;
		_data_->_vala1__result_ = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch4_g_error;
		}
		_data_->_tmp7_ = 0U;
		_data_->_tmp7_ = _data_->total_matches;
		_vala_assert (_data_->_tmp7_ == ((guint) 0), "total_matches == 0");
		_data_->_tmp8_ = 0;
		_data_->_tmp8_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_vala1__result_);
		_data_->_tmp9_ = 0;
		_data_->_tmp9_ = _data_->_tmp8_;
		_vala_assert (_data_->_tmp9_ == 0, "result.size == 0");
		_g_object_unref0 (_data_->_vala1__result_);
	}
	goto __finally4;
	__catch4_g_error:
	{
		_data_->_vala1__error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_data_->_vala1__error_);
	}
	__finally4:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	{
		_data_->i = 1;
		{
			_data_->_tmp10_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp10_) {
					_data_->_tmp11_ = 0;
					_data_->_tmp11_ = _data_->i;
					_data_->i = _data_->_tmp11_ + 1;
				}
				_data_->_tmp10_ = FALSE;
				_data_->_tmp12_ = 0;
				_data_->_tmp12_ = _data_->i;
				if (!(_data_->_tmp12_ < 10)) {
					break;
				}
				{
					_data_->_tmp13_ = 0;
					_data_->_tmp13_ = _data_->i;
					_data_->_tmp14_ = 0U;
					_data_->_state_ = 3;
					rygel_searchable_container_search ((RygelSearchableContainer*) _data_->self, NULL, (guint) _data_->_tmp13_, (guint) 3, "", NULL, test_container_test_search_with_limit_ready, _data_);
					return FALSE;
					_state_3:
					_data_->_tmp15_ = NULL;
					_data_->_tmp15_ = rygel_searchable_container_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp14_, &_data_->_inner_error_);
					_data_->total_matches = _data_->_tmp14_;
					_data_->_vala2__result_ = _data_->_tmp15_;
					if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
						goto __catch5_g_error;
					}
					_data_->_tmp16_ = 0U;
					_data_->_tmp16_ = _data_->total_matches;
					_vala_assert (_data_->_tmp16_ == ((guint) 0), "total_matches == 0");
					_data_->_tmp17_ = NULL;
					_data_->_tmp17_ = _data_->_vala2__result_;
					_data_->_tmp18_ = 0;
					_data_->_tmp18_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp17_);
					_data_->_tmp19_ = 0;
					_data_->_tmp19_ = _data_->_tmp18_;
					_data_->_tmp20_ = 0;
					_data_->_tmp20_ = _data_->i;
					_data_->_tmp21_ = 0;
					_data_->_tmp21_ = MIN (10 - _data_->_tmp20_, 3);
					_vala_assert (_data_->_tmp19_ == _data_->_tmp21_, "result.size == int.min (10 - i, 3)");
					_g_object_unref0 (_data_->_vala2__result_);
				}
				goto __finally5;
				__catch5_g_error:
				{
					_data_->_vala2__error_ = _data_->_inner_error_;
					_data_->_inner_error_ = NULL;
					g_assert_not_reached ();
					_g_error_free0 (_data_->_vala2__error_);
				}
				__finally5:
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
					g_clear_error (&_data_->_inner_error_);
					return FALSE;
				}
			}
		}
	}
	_data_->_tmp22_ = NULL;
	_data_->_tmp22_ = _data_->self->loop;
	g_main_loop_quit (_data_->_tmp22_);
	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;
}


void test_container_test_serialization (TestContainer* self) {
	GUPnPDIDLLiteWriter* writer = NULL;
	GUPnPDIDLLiteWriter* _tmp0_ = NULL;
	GUPnPDIDLLiteContainer* didl_container = NULL;
	GUPnPDIDLLiteContainer* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = gupnp_didl_lite_writer_new (NULL);
	writer = _tmp0_;
	_tmp1_ = gupnp_didl_lite_writer_add_container (writer);
	didl_container = _tmp1_;
	rygel_searchable_container_serialize_search_parameters ((RygelSearchableContainer*) self, didl_container);
	_g_object_unref0 (didl_container);
	_g_object_unref0 (writer);
}


static void test_container_real_search_data_free (gpointer _data) {
	TestContainerSearchData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->expression);
	_g_free0 (_data_->sort_criteria);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (TestContainerSearchData, _data_);
}


static void test_container_real_search (RygelSearchableContainer* base, SearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TestContainer * self;
	TestContainerSearchData* _data_;
	TestContainer* _tmp0_ = NULL;
	SearchExpression* _tmp1_ = NULL;
	SearchExpression* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	guint _tmp4_ = 0U;
	const gchar* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	GCancellable* _tmp7_ = NULL;
	GCancellable* _tmp8_ = NULL;
	self = (TestContainer*) base;
	_data_ = g_slice_new0 (TestContainerSearchData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, test_container_real_search);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, test_container_real_search_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = expression;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->expression);
	_data_->expression = _tmp2_;
	_tmp3_ = offset;
	_data_->offset = _tmp3_;
	_tmp4_ = max_count;
	_data_->max_count = _tmp4_;
	_tmp5_ = sort_criteria;
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (_data_->sort_criteria);
	_data_->sort_criteria = _tmp6_;
	_tmp7_ = cancellable;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp8_;
	test_container_real_search_co (_data_);
}


static MediaObjects* test_container_real_search_finish (RygelSearchableContainer* base, GAsyncResult* _res_, guint* total_matches, GError** error) {
	MediaObjects* result;
	TestContainerSearchData* _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 test_container_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TestContainerSearchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	test_container_real_search_co (_data_);
}


static gboolean test_container_real_search_co (TestContainerSearchData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->sort_criteria;
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = ((MediaContainer*) _data_->self)->sort_criteria;
		_data_->_tmp0_ = _data_->_tmp2_;
	}
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->expression;
	_data_->_tmp5_ = 0U;
	_data_->_tmp5_ = _data_->offset;
	_data_->_tmp6_ = 0U;
	_data_->_tmp6_ = _data_->max_count;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->cancellable;
	_data_->_tmp8_ = 0U;
	_data_->_state_ = 1;
	rygel_searchable_container_simple_search ((RygelSearchableContainer*) _data_->self, _data_->_tmp4_, _data_->_tmp5_, _data_->_tmp6_, _data_->_tmp0_, _data_->_tmp7_, test_container_search_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = rygel_searchable_container_simple_search_finish ((RygelSearchableContainer*) _data_->self, _data_->_res_, &_data_->_tmp8_, &_data_->_inner_error_);
	_data_->total_matches = _data_->_tmp8_;
	_data_->_tmp3_ = _data_->_tmp9_;
	if (G_UNLIKELY (_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_->_tmp10_ = NULL;
	_data_->_tmp10_ = _data_->_tmp3_;
	_data_->_tmp3_ = NULL;
	_data_->result = _data_->_tmp10_;
	_g_object_unref0 (_data_->_tmp3_);
	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_->_tmp3_);
	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;
}


TestContainer* test_container_construct (GType object_type) {
	TestContainer * self = NULL;
	self = (TestContainer*) media_container_construct (object_type);
	return self;
}


TestContainer* test_container_new (void) {
	return test_container_construct (TYPE_TEST_CONTAINER);
}


static GeeArrayList* test_container_real_get_search_classes (RygelSearchableContainer* base) {
	GeeArrayList* result;
	TestContainer* self;
	GeeArrayList* _tmp0_ = NULL;
	self = (TestContainer*) base;
	_tmp0_ = self->priv->_search_classes;
	result = _tmp0_;
	return result;
}


static void test_container_real_set_search_classes (RygelSearchableContainer* base, GeeArrayList* value) {
	TestContainer* self;
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	self = (TestContainer*) 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 test_container_class_init (TestContainerClass * klass) {
	test_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TestContainerPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_test_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_test_container_set_property;
	G_OBJECT_CLASS (klass)->finalize = test_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TEST_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 test_container_rygel_searchable_container_interface_init (RygelSearchableContainerIface * iface) {
	test_container_rygel_searchable_container_parent_iface = g_type_interface_peek_parent (iface);
	iface->search = (MediaObjects* (*)(RygelSearchableContainer*, SearchExpression*, guint, guint, guint*, const gchar*, GCancellable*, GError**)) test_container_real_search;
	iface->search_finish = test_container_real_search_finish;
	iface->get_search_classes = test_container_real_get_search_classes;
	iface->set_search_classes = test_container_real_set_search_classes;
}


static void test_container_instance_init (TestContainer * self) {
	GeeArrayList* _tmp0_ = NULL;
	self->priv = TEST_CONTAINER_GET_PRIVATE (self);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
	self->priv->_search_classes = _tmp0_;
}


static void test_container_finalize (GObject* obj) {
	TestContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TEST_CONTAINER, TestContainer);
	_g_main_loop_unref0 (self->loop);
	_g_object_unref0 (self->priv->_search_classes);
	G_OBJECT_CLASS (test_container_parent_class)->finalize (obj);
}


GType test_container_get_type (void) {
	static volatile gsize test_container_type_id__volatile = 0;
	if (g_once_init_enter (&test_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TestContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TestContainer), 0, (GInstanceInitFunc) test_container_instance_init, NULL };
		static const GInterfaceInfo rygel_searchable_container_info = { (GInterfaceInitFunc) test_container_rygel_searchable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType test_container_type_id;
		test_container_type_id = g_type_register_static (TYPE_MEDIA_CONTAINER, "TestContainer", &g_define_type_info, 0);
		g_type_add_interface_static (test_container_type_id, RYGEL_TYPE_SEARCHABLE_CONTAINER, &rygel_searchable_container_info);
		g_once_init_leave (&test_container_type_id__volatile, test_container_type_id);
	}
	return test_container_type_id__volatile;
}


static void _vala_test_container_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TestContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_CONTAINER, TestContainer);
	switch (property_id) {
		case TEST_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_test_container_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	TestContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_TEST_CONTAINER, TestContainer);
	switch (property_id) {
		case TEST_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;
	}
}


static GeeList* media_objects_real_slice (GeeAbstractList* base, gint start, gint stop) {
	MediaObjects * self;
	GeeList* result = NULL;
	GeeList* slice = NULL;
	gint _tmp0_ = 0;
	gint _tmp1_ = 0;
	GeeList* _tmp2_ = NULL;
	MediaObjects* ret = NULL;
	MediaObjects* _tmp3_ = NULL;
	self = (MediaObjects*) base;
	_tmp0_ = start;
	_tmp1_ = stop;
	_tmp2_ = GEE_ABSTRACT_LIST_CLASS (media_objects_parent_class)->slice ((GeeAbstractList*) G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_ARRAY_LIST, GeeArrayList), _tmp0_, _tmp1_);
	slice = _tmp2_;
	_tmp3_ = media_objects_new ();
	ret = _tmp3_;
	gee_array_list_add_all ((GeeArrayList*) ret, (GeeCollection*) slice);
	result = (GeeList*) ret;
	_g_object_unref0 (slice);
	return result;
}


MediaObjects* media_objects_construct (GType object_type) {
	MediaObjects * self = NULL;
	self = (MediaObjects*) gee_array_list_construct (object_type, TYPE_MEDIA_OBJECT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	return self;
}


MediaObjects* media_objects_new (void) {
	return media_objects_construct (TYPE_MEDIA_OBJECTS);
}


static void media_objects_class_init (MediaObjectsClass * klass) {
	media_objects_parent_class = g_type_class_peek_parent (klass);
	((GeeAbstractListClass *) klass)->slice = media_objects_real_slice;
}


static void media_objects_instance_init (MediaObjects * self) {
}


GType media_objects_get_type (void) {
	static volatile gsize media_objects_type_id__volatile = 0;
	if (g_once_init_enter (&media_objects_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (MediaObjectsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_objects_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaObjects), 0, (GInstanceInitFunc) media_objects_instance_init, NULL };
		GType media_objects_type_id;
		media_objects_type_id = g_type_register_static (GEE_TYPE_ARRAY_LIST, "MediaObjects", &g_define_type_info, 0);
		g_once_init_leave (&media_objects_type_id__volatile, media_objects_type_id);
	}
	return media_objects_type_id__volatile;
}


gint _vala_main (void) {
	gint result = 0;
	TestContainer* c = NULL;
	TestContainer* _tmp0_ = NULL;
	GMainLoop* _tmp1_ = NULL;
	GMainLoop* _tmp2_ = NULL;
	GMainLoop* _tmp3_ = NULL;
	_tmp0_ = test_container_new ();
	c = _tmp0_;
	_tmp1_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (c->loop);
	c->loop = _tmp1_;
	test_container_test_search_no_limit (c, NULL, NULL);
	_tmp2_ = c->loop;
	g_main_loop_run (_tmp2_);
	test_container_test_search_with_limit (c, NULL, NULL);
	_tmp3_ = c->loop;
	g_main_loop_run (_tmp3_);
	result = 0;
	_g_object_unref0 (c);
	return result;
}


int main (int argc, char ** argv) {
#if !GLIB_CHECK_VERSION (2,35,0)
	g_type_init ();
#endif
	return _vala_main ();
}



