/* rygel-media-export-playlist-container.c generated by valac 0.56.1, the Vala compiler
 * generated from rygel-media-export-playlist-container.vala, do not modify */

/*
 * Copyright (C) 2013 Intel Corporation.
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.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 "rygel-media-export.h"
#include "rygel-server.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib/gi18n-lib.h>
#include <libgupnp-av/gupnp-av.h>

#define RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_URI RYGEL_WRITABLE_CONTAINER_WRITABLE_SCHEME "playlist-container"

#define RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER (rygel_media_export_playlist_container_get_type ())
#define RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainer))
#define RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainerClass))
#define RYGEL_MEDIA_EXPORT_IS_PLAYLIST_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER))
#define RYGEL_MEDIA_EXPORT_IS_PLAYLIST_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER))
#define RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainerClass))

typedef struct _RygelMediaExportPlaylistContainer RygelMediaExportPlaylistContainer;
typedef struct _RygelMediaExportPlaylistContainerClass RygelMediaExportPlaylistContainerClass;
typedef struct _RygelMediaExportPlaylistContainerPrivate RygelMediaExportPlaylistContainerPrivate;
enum  {
	RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_0_PROPERTY,
	RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY,
	RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_OCM_FLAGS_PROPERTY,
	RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_NUM_PROPERTIES
};
static GParamSpec* rygel_media_export_playlist_container_properties[RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _RygelMediaExportPlaylistContainerAddItemData RygelMediaExportPlaylistContainerAddItemData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _RygelMediaExportPlaylistContainerAddReferenceData RygelMediaExportPlaylistContainerAddReferenceData;
typedef struct _RygelMediaExportPlaylistContainerRemoveItemData RygelMediaExportPlaylistContainerRemoveItemData;
typedef struct _RygelMediaExportPlaylistContainerAddContainerData RygelMediaExportPlaylistContainerAddContainerData;
typedef struct _RygelMediaExportPlaylistContainerRemoveContainerData RygelMediaExportPlaylistContainerRemoveContainerData;

struct _RygelMediaExportPlaylistContainer {
	RygelMediaExportDBContainer parent_instance;
	RygelMediaExportPlaylistContainerPrivate * priv;
};

struct _RygelMediaExportPlaylistContainerClass {
	RygelMediaExportDBContainerClass parent_class;
	void (*add_reference) (RygelMediaExportPlaylistContainer* self, RygelMediaObject* object, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gchar* (*add_reference_finish) (RygelMediaExportPlaylistContainer* self, GAsyncResult* _res_, GError** error);
};

struct _RygelMediaExportPlaylistContainerPrivate {
	GeeArrayList* _create_classes;
};

struct _RygelMediaExportPlaylistContainerAddItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportPlaylistContainer* self;
	RygelMediaFileItem* item;
	GCancellable* cancellable;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GError* _tmp2_;
	GError* _inner_error0_;
};

struct _RygelMediaExportPlaylistContainerAddReferenceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportPlaylistContainer* self;
	RygelMediaObject* object;
	GCancellable* cancellable;
	gchar* result;
	gchar* _tmp0_;
	RygelMediaExportMediaCache* _tmp1_;
	RygelMediaExportMediaCache* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _inner_error0_;
};

struct _RygelMediaExportPlaylistContainerRemoveItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportPlaylistContainer* self;
	gchar* id;
	GCancellable* cancellable;
	RygelMediaExportMediaCache* _tmp0_;
	GError* _inner_error0_;
};

struct _RygelMediaExportPlaylistContainerAddContainerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportPlaylistContainer* self;
	RygelMediaContainer* container;
	GCancellable* cancellable;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GError* _tmp2_;
	GError* _inner_error0_;
};

struct _RygelMediaExportPlaylistContainerRemoveContainerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelMediaExportPlaylistContainer* self;
	gchar* id;
	GCancellable* cancellable;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GError* _tmp2_;
	GError* _inner_error0_;
};

static gint RygelMediaExportPlaylistContainer_private_offset;
static gpointer rygel_media_export_playlist_container_parent_class = NULL;
static RygelWritableContainerIface * rygel_media_export_playlist_container_rygel_writable_container_parent_iface = NULL;

VALA_EXTERN GType rygel_media_export_playlist_container_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void rygel_media_export_playlist_container_add_reference (RygelMediaExportPlaylistContainer* self,
                                                          RygelMediaObject* object,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
VALA_EXTERN gchar* rygel_media_export_playlist_container_add_reference_finish (RygelMediaExportPlaylistContainer* self,
                                                                   GAsyncResult* _res_,
                                                                   GError** error);
VALA_EXTERN RygelMediaExportPlaylistContainer* rygel_media_export_playlist_container_new (const gchar* id,
                                                                              const gchar* title);
VALA_EXTERN RygelMediaExportPlaylistContainer* rygel_media_export_playlist_container_construct (GType object_type,
                                                                                    const gchar* id,
                                                                                    const gchar* title);
static void rygel_media_export_playlist_container_real_constructed (GObject* base);
static void rygel_media_export_playlist_container_real_add_item_data_free (gpointer _data);
static void rygel_media_export_playlist_container_real_add_item (RygelWritableContainer* base,
                                                          RygelMediaFileItem* item,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static gboolean rygel_media_export_playlist_container_real_add_item_co (RygelMediaExportPlaylistContainerAddItemData* _data_);
static void rygel_media_export_playlist_container_real_add_reference_data_free (gpointer _data);
static void rygel_media_export_playlist_container_real_add_reference (RygelMediaExportPlaylistContainer* self,
                                                               RygelMediaObject* object,
                                                               GCancellable* cancellable,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static gboolean rygel_media_export_playlist_container_real_add_reference_co (RygelMediaExportPlaylistContainerAddReferenceData* _data_);
static void rygel_media_export_playlist_container_real_remove_item_data_free (gpointer _data);
static void rygel_media_export_playlist_container_real_remove_item (RygelWritableContainer* base,
                                                             const gchar* id,
                                                             GCancellable* cancellable,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean rygel_media_export_playlist_container_real_remove_item_co (RygelMediaExportPlaylistContainerRemoveItemData* _data_);
static void rygel_media_export_playlist_container_real_add_container_data_free (gpointer _data);
static void rygel_media_export_playlist_container_real_add_container (RygelWritableContainer* base,
                                                               RygelMediaContainer* container,
                                                               GCancellable* cancellable,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static gboolean rygel_media_export_playlist_container_real_add_container_co (RygelMediaExportPlaylistContainerAddContainerData* _data_);
static void rygel_media_export_playlist_container_real_remove_container_data_free (gpointer _data);
static void rygel_media_export_playlist_container_real_remove_container (RygelWritableContainer* base,
                                                                  const gchar* id,
                                                                  GCancellable* cancellable,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static gboolean rygel_media_export_playlist_container_real_remove_container_co (RygelMediaExportPlaylistContainerRemoveContainerData* _data_);
static void rygel_media_export_playlist_container_finalize (GObject * obj);
static GType rygel_media_export_playlist_container_get_type_once (void);
static void _vala_rygel_media_export_playlist_container_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec);
static void _vala_rygel_media_export_playlist_container_set_property (GObject * object,
                                                               guint property_id,
                                                               const GValue * value,
                                                               GParamSpec * pspec);

static inline gpointer
rygel_media_export_playlist_container_get_instance_private (RygelMediaExportPlaylistContainer* self)
{
	return G_STRUCT_MEMBER_P (self, RygelMediaExportPlaylistContainer_private_offset);
}

RygelMediaExportPlaylistContainer*
rygel_media_export_playlist_container_construct (GType object_type,
                                                 const gchar* id,
                                                 const gchar* title)
{
	RygelMediaExportPlaylistContainer * self = NULL;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	self = (RygelMediaExportPlaylistContainer*) g_object_new (object_type, "id", id, "title", title, "parent", NULL, "child-count", 0, NULL);
	return self;
}

RygelMediaExportPlaylistContainer*
rygel_media_export_playlist_container_new (const gchar* id,
                                           const gchar* title)
{
	return rygel_media_export_playlist_container_construct (RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, id, title);
}

static void
rygel_media_export_playlist_container_real_constructed (GObject* base)
{
	RygelMediaExportPlaylistContainer * self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	GeeArrayList* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	GeeArrayList* _tmp10_;
	GeeArrayList* _tmp11_;
	self = (RygelMediaExportPlaylistContainer*) base;
	G_OBJECT_CLASS (rygel_media_export_playlist_container_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer));
	rygel_media_object_set_upnp_class ((RygelMediaObject*) self, RYGEL_MEDIA_CONTAINER_PLAYLIST);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_tmp1_ = _tmp0_;
	rygel_writable_container_set_create_classes ((RygelWritableContainer*) self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
	_tmp3_ = _tmp2_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, RYGEL_IMAGE_ITEM_UPNP_CLASS);
	_tmp4_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
	_tmp5_ = _tmp4_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, RYGEL_PHOTO_ITEM_UPNP_CLASS);
	_tmp6_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
	_tmp7_ = _tmp6_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, RYGEL_VIDEO_ITEM_UPNP_CLASS);
	_tmp8_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
	_tmp9_ = _tmp8_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, RYGEL_AUDIO_ITEM_UPNP_CLASS);
	_tmp10_ = rygel_writable_container_get_create_classes ((RygelWritableContainer*) self);
	_tmp11_ = _tmp10_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, RYGEL_MUSIC_ITEM_UPNP_CLASS);
	rygel_media_object_add_uri ((RygelMediaObject*) self, RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_URI);
}

static void
rygel_media_export_playlist_container_real_add_item_data_free (gpointer _data)
{
	RygelMediaExportPlaylistContainerAddItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->item);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportPlaylistContainerAddItemData, _data_);
}

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

static void
rygel_media_export_playlist_container_real_add_item (RygelWritableContainer* base,
                                                     RygelMediaFileItem* item,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	RygelMediaExportPlaylistContainer * self;
	RygelMediaExportPlaylistContainerAddItemData* _data_;
	RygelMediaExportPlaylistContainer* _tmp0_;
	RygelMediaFileItem* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (item != NULL);
	self = (RygelMediaExportPlaylistContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportPlaylistContainerAddItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_playlist_container_real_add_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (item);
	_g_object_unref0 (_data_->item);
	_data_->item = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_playlist_container_real_add_item_co (_data_);
}

static void
rygel_media_export_playlist_container_add_item_finish (RygelWritableContainer* base,
                                                       GAsyncResult* _res_,
                                                       GError** error)
{
	RygelMediaExportPlaylistContainerAddItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
rygel_media_export_playlist_container_real_add_item_co (RygelMediaExportPlaylistContainerAddItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = g_error_new (RYGEL_WRITABLE_CONTAINER_ERROR, RYGEL_WRITABLE_CONTAINER_ERROR_NOT_IMPLEMENTED, _ ("Can’t create items in %s"), _data_->_tmp1_);
	_data_->_inner_error0_ = _data_->_tmp2_;
	g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
rygel_media_export_playlist_container_real_add_reference_data_free (gpointer _data)
{
	RygelMediaExportPlaylistContainerAddReferenceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportPlaylistContainerAddReferenceData, _data_);
}

static void
rygel_media_export_playlist_container_real_add_reference (RygelMediaExportPlaylistContainer* self,
                                                          RygelMediaObject* object,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	RygelMediaExportPlaylistContainerAddReferenceData* _data_;
	RygelMediaExportPlaylistContainer* _tmp0_;
	RygelMediaObject* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (object != NULL);
	_data_ = g_slice_new0 (RygelMediaExportPlaylistContainerAddReferenceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_playlist_container_real_add_reference_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (object);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_playlist_container_real_add_reference_co (_data_);
}

static gchar*
rygel_media_export_playlist_container_real_add_reference_finish (RygelMediaExportPlaylistContainer* self,
                                                                 GAsyncResult* _res_,
                                                                 GError** error)
{
	gchar* result;
	RygelMediaExportPlaylistContainerAddReferenceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
rygel_media_export_playlist_container_real_add_reference_co (RygelMediaExportPlaylistContainerAddReferenceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = rygel_media_export_media_cache_get_default ();
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = rygel_media_export_media_cache_create_reference (_data_->_tmp2_, _data_->object, (RygelMediaContainer*) _data_->self, &_data_->_inner_error0_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->_tmp0_ = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp5_;
	_g_free0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
rygel_media_export_playlist_container_add_reference (RygelMediaExportPlaylistContainer* self,
                                                     RygelMediaObject* object,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	RygelMediaExportPlaylistContainerClass* _klass_;
	_klass_ = RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_GET_CLASS (self);
	if (_klass_->add_reference) {
		_klass_->add_reference (self, object, cancellable, _callback_, _user_data_);
	}
}

gchar*
rygel_media_export_playlist_container_add_reference_finish (RygelMediaExportPlaylistContainer* self,
                                                            GAsyncResult* _res_,
                                                            GError** error)
{
	RygelMediaExportPlaylistContainerClass* _klass_;
	_klass_ = RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_GET_CLASS (self);
	if (_klass_->add_reference_finish) {
		return _klass_->add_reference_finish (self, _res_, error);
	}
	return NULL;
}

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

static void
rygel_media_export_playlist_container_real_remove_item (RygelWritableContainer* base,
                                                        const gchar* id,
                                                        GCancellable* cancellable,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	RygelMediaExportPlaylistContainer * self;
	RygelMediaExportPlaylistContainerRemoveItemData* _data_;
	RygelMediaExportPlaylistContainer* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (id != NULL);
	self = (RygelMediaExportPlaylistContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportPlaylistContainerRemoveItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_playlist_container_real_remove_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_playlist_container_real_remove_item_co (_data_);
}

static void
rygel_media_export_playlist_container_remove_item_finish (RygelWritableContainer* base,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	RygelMediaExportPlaylistContainerRemoveItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
rygel_media_export_playlist_container_real_remove_item_co (RygelMediaExportPlaylistContainerRemoveItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((RygelMediaExportDBContainer*) _data_->self)->media_db;
	rygel_media_export_media_cache_remove_by_id (_data_->_tmp0_, _data_->id, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	rygel_media_container_updated ((RygelMediaContainer*) _data_->self, NULL, RYGEL_OBJECT_EVENT_TYPE_MODIFIED, FALSE);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
rygel_media_export_playlist_container_real_add_container_data_free (gpointer _data)
{
	RygelMediaExportPlaylistContainerAddContainerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->container);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportPlaylistContainerAddContainerData, _data_);
}

static void
rygel_media_export_playlist_container_real_add_container (RygelWritableContainer* base,
                                                          RygelMediaContainer* container,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	RygelMediaExportPlaylistContainer * self;
	RygelMediaExportPlaylistContainerAddContainerData* _data_;
	RygelMediaExportPlaylistContainer* _tmp0_;
	RygelMediaContainer* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (container != NULL);
	self = (RygelMediaExportPlaylistContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportPlaylistContainerAddContainerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_playlist_container_real_add_container_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (container);
	_g_object_unref0 (_data_->container);
	_data_->container = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_playlist_container_real_add_container_co (_data_);
}

static void
rygel_media_export_playlist_container_add_container_finish (RygelWritableContainer* base,
                                                            GAsyncResult* _res_,
                                                            GError** error)
{
	RygelMediaExportPlaylistContainerAddContainerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
rygel_media_export_playlist_container_real_add_container_co (RygelMediaExportPlaylistContainerAddContainerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = g_error_new (RYGEL_WRITABLE_CONTAINER_ERROR, RYGEL_WRITABLE_CONTAINER_ERROR_NOT_IMPLEMENTED, _ ("Can’t add containers in %s"), _data_->_tmp1_);
	_data_->_inner_error0_ = _data_->_tmp2_;
	g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
rygel_media_export_playlist_container_real_remove_container (RygelWritableContainer* base,
                                                             const gchar* id,
                                                             GCancellable* cancellable,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	RygelMediaExportPlaylistContainer * self;
	RygelMediaExportPlaylistContainerRemoveContainerData* _data_;
	RygelMediaExportPlaylistContainer* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (id != NULL);
	self = (RygelMediaExportPlaylistContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportPlaylistContainerRemoveContainerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_playlist_container_real_remove_container_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_playlist_container_real_remove_container_co (_data_);
}

static void
rygel_media_export_playlist_container_remove_container_finish (RygelWritableContainer* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	RygelMediaExportPlaylistContainerRemoveContainerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
rygel_media_export_playlist_container_real_remove_container_co (RygelMediaExportPlaylistContainerRemoveContainerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = g_error_new (RYGEL_WRITABLE_CONTAINER_ERROR, RYGEL_WRITABLE_CONTAINER_ERROR_NOT_IMPLEMENTED, _ ("Can’t remove containers in %s"), _data_->_tmp1_);
	_data_->_inner_error0_ = _data_->_tmp2_;
	g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static GeeArrayList*
rygel_media_export_playlist_container_real_get_create_classes (RygelWritableContainer* base)
{
	GeeArrayList* result;
	RygelMediaExportPlaylistContainer* self;
	GeeArrayList* _tmp0_;
	self = (RygelMediaExportPlaylistContainer*) base;
	_tmp0_ = self->priv->_create_classes;
	result = _tmp0_;
	return result;
}

static void
rygel_media_export_playlist_container_real_set_create_classes (RygelWritableContainer* base,
                                                               GeeArrayList* value)
{
	RygelMediaExportPlaylistContainer* self;
	GeeArrayList* old_value;
	self = (RygelMediaExportPlaylistContainer*) base;
	old_value = rygel_media_export_playlist_container_real_get_create_classes (base);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_create_classes);
		self->priv->_create_classes = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, rygel_media_export_playlist_container_properties[RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY]);
	}
}

static GUPnPOCMFlags
rygel_media_export_playlist_container_real_get_ocm_flags (RygelMediaObject* base)
{
	GUPnPOCMFlags result;
	RygelMediaExportPlaylistContainer* self;
	GUPnPOCMFlags flags = 0U;
	GUPnPOCMFlags _tmp0_;
	self = (RygelMediaExportPlaylistContainer*) base;
	_tmp0_ = RYGEL_MEDIA_OBJECT_CLASS (rygel_media_export_playlist_container_parent_class)->get_ocm_flags ((RygelMediaObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, RygelMediaExportDBContainer));
	flags = _tmp0_;
	flags &= ~(GUPNP_OCM_FLAGS_UPLOAD | GUPNP_OCM_FLAGS_UPLOAD_DESTROYABLE);
	flags &= ~GUPNP_OCM_FLAGS_CREATE_CONTAINER;
	result = flags;
	return result;
}

static void
rygel_media_export_playlist_container_class_init (RygelMediaExportPlaylistContainerClass * klass,
                                                  gpointer klass_data)
{
	rygel_media_export_playlist_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelMediaExportPlaylistContainer_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_media_export_playlist_container_real_constructed;
	((RygelMediaExportPlaylistContainerClass *) klass)->add_reference = (void (*) (RygelMediaExportPlaylistContainer*, RygelMediaObject*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_real_add_reference;
	((RygelMediaExportPlaylistContainerClass *) klass)->add_reference_finish = (gchar* (*) (RygelMediaExportPlaylistContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_real_add_reference_finish;
	RYGEL_MEDIA_OBJECT_CLASS (klass)->get_ocm_flags = rygel_media_export_playlist_container_real_get_ocm_flags;
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_playlist_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_playlist_container_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_playlist_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY, rygel_media_export_playlist_container_properties[RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY] = g_param_spec_object ("create-classes", "create-classes", "create-classes", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_OCM_FLAGS_PROPERTY, rygel_media_export_playlist_container_properties[RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_OCM_FLAGS_PROPERTY] = g_param_spec_flags ("ocm-flags", "ocm-flags", "ocm-flags", gupnp_ocm_flags_get_type (), 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
rygel_media_export_playlist_container_rygel_writable_container_interface_init (RygelWritableContainerIface * iface,
                                                                               gpointer iface_data)
{
	rygel_media_export_playlist_container_rygel_writable_container_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_item = (void (*) (RygelWritableContainer*, RygelMediaFileItem*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_real_add_item;
	iface->add_item_finish = (void (*) (RygelWritableContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_add_item_finish;
	iface->add_reference = (void (*) (RygelWritableContainer*, RygelMediaObject*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_add_reference;
	iface->add_reference_finish = (gchar* (*) (RygelWritableContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_add_reference_finish;
	iface->remove_item = (void (*) (RygelWritableContainer*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_real_remove_item;
	iface->remove_item_finish = (void (*) (RygelWritableContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_remove_item_finish;
	iface->add_container = (void (*) (RygelWritableContainer*, RygelMediaContainer*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_real_add_container;
	iface->add_container_finish = (void (*) (RygelWritableContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_add_container_finish;
	iface->remove_container = (void (*) (RygelWritableContainer*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_playlist_container_real_remove_container;
	iface->remove_container_finish = (void (*) (RygelWritableContainer*, GAsyncResult*, GError**)) rygel_media_export_playlist_container_remove_container_finish;
	iface->get_create_classes = rygel_media_export_playlist_container_real_get_create_classes;
	iface->set_create_classes = rygel_media_export_playlist_container_real_set_create_classes;
}

static void
rygel_media_export_playlist_container_instance_init (RygelMediaExportPlaylistContainer * self,
                                                     gpointer klass)
{
	self->priv = rygel_media_export_playlist_container_get_instance_private (self);
}

static void
rygel_media_export_playlist_container_finalize (GObject * obj)
{
	RygelMediaExportPlaylistContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainer);
	_g_object_unref0 (self->priv->_create_classes);
	G_OBJECT_CLASS (rygel_media_export_playlist_container_parent_class)->finalize (obj);
}

static GType
rygel_media_export_playlist_container_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportPlaylistContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_playlist_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportPlaylistContainer), 0, (GInstanceInitFunc) rygel_media_export_playlist_container_instance_init, NULL };
	static const GInterfaceInfo rygel_writable_container_info = { (GInterfaceInitFunc) rygel_media_export_playlist_container_rygel_writable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType rygel_media_export_playlist_container_type_id;
	rygel_media_export_playlist_container_type_id = g_type_register_static (RYGEL_MEDIA_EXPORT_TYPE_DB_CONTAINER, "RygelMediaExportPlaylistContainer", &g_define_type_info, 0);
	g_type_add_interface_static (rygel_media_export_playlist_container_type_id, RYGEL_TYPE_WRITABLE_CONTAINER, &rygel_writable_container_info);
	RygelMediaExportPlaylistContainer_private_offset = g_type_add_instance_private (rygel_media_export_playlist_container_type_id, sizeof (RygelMediaExportPlaylistContainerPrivate));
	return rygel_media_export_playlist_container_type_id;
}

GType
rygel_media_export_playlist_container_get_type (void)
{
	static volatile gsize rygel_media_export_playlist_container_type_id__once = 0;
	if (g_once_init_enter (&rygel_media_export_playlist_container_type_id__once)) {
		GType rygel_media_export_playlist_container_type_id;
		rygel_media_export_playlist_container_type_id = rygel_media_export_playlist_container_get_type_once ();
		g_once_init_leave (&rygel_media_export_playlist_container_type_id__once, rygel_media_export_playlist_container_type_id);
	}
	return rygel_media_export_playlist_container_type_id__once;
}

static void
_vala_rygel_media_export_playlist_container_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec)
{
	RygelMediaExportPlaylistContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainer);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY:
		g_value_set_object (value, rygel_writable_container_get_create_classes ((RygelWritableContainer*) self));
		break;
		case RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_OCM_FLAGS_PROPERTY:
		g_value_set_flags (value, rygel_media_object_get_ocm_flags ((RygelMediaObject*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_rygel_media_export_playlist_container_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec)
{
	RygelMediaExportPlaylistContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_CONTAINER, RygelMediaExportPlaylistContainer);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_PLAYLIST_CONTAINER_CREATE_CLASSES_PROPERTY:
		rygel_writable_container_set_create_classes ((RygelWritableContainer*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

