/* rygel-item-destroyer.c generated by valac 0.44.3, the Vala compiler
 * generated from rygel-item-destroyer.vala, do not modify */

/*
 * Copyright (C) 2010 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.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 <rygel-core.h>
#include <stdlib.h>
#include <string.h>
#include <libgupnp/gupnp.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gee.h>
#include <libgupnp-av/gupnp-av.h>

#define RYGEL_TYPE_ITEM_DESTROYER (rygel_item_destroyer_get_type ())
#define RYGEL_ITEM_DESTROYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyer))
#define RYGEL_ITEM_DESTROYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyerClass))
#define RYGEL_IS_ITEM_DESTROYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_ITEM_DESTROYER))
#define RYGEL_IS_ITEM_DESTROYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_ITEM_DESTROYER))
#define RYGEL_ITEM_DESTROYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyerClass))

typedef struct _RygelItemDestroyer RygelItemDestroyer;
typedef struct _RygelItemDestroyerClass RygelItemDestroyerClass;
typedef struct _RygelItemDestroyerPrivate RygelItemDestroyerPrivate;

#define RYGEL_TYPE_CONTENT_DIRECTORY (rygel_content_directory_get_type ())
#define RYGEL_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectory))
#define RYGEL_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))
#define RYGEL_IS_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_IS_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_CONTENT_DIRECTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))

typedef struct _RygelContentDirectory RygelContentDirectory;
typedef struct _RygelContentDirectoryClass RygelContentDirectoryClass;
enum  {
	RYGEL_ITEM_DESTROYER_0_PROPERTY,
	RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY,
	RYGEL_ITEM_DESTROYER_NUM_PROPERTIES
};
static GParamSpec* rygel_item_destroyer_properties[RYGEL_ITEM_DESTROYER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define __vala_GUPnPServiceAction_free0(var) ((var == NULL) ? NULL : (var = (_vala_GUPnPServiceAction_free (var), NULL)))
typedef struct _RygelContentDirectoryPrivate RygelContentDirectoryPrivate;

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

typedef struct _RygelHTTPServer RygelHTTPServer;
typedef struct _RygelHTTPServerClass RygelHTTPServerClass;

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

typedef struct _RygelMediaObject RygelMediaObject;
typedef struct _RygelMediaObjectClass RygelMediaObjectClass;

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

typedef struct _RygelMediaContainer RygelMediaContainer;
typedef struct _RygelMediaContainerClass RygelMediaContainerClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _RygelItemDestroyerRunData RygelItemDestroyerRunData;

#define RYGEL_TYPE_WRITABLE_CONTAINER (rygel_writable_container_get_type ())
#define RYGEL_WRITABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_WRITABLE_CONTAINER, RygelWritableContainer))
#define RYGEL_IS_WRITABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_WRITABLE_CONTAINER))
#define RYGEL_WRITABLE_CONTAINER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TYPE_WRITABLE_CONTAINER, RygelWritableContainerIface))

typedef struct _RygelWritableContainer RygelWritableContainer;
typedef struct _RygelWritableContainerIface RygelWritableContainerIface;

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

typedef struct _RygelMediaItem RygelMediaItem;
typedef struct _RygelMediaItemClass RygelMediaItemClass;

#define RYGEL_TYPE_MEDIA_FILE_ITEM (rygel_media_file_item_get_type ())
#define RYGEL_MEDIA_FILE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_FILE_ITEM, RygelMediaFileItem))
#define RYGEL_MEDIA_FILE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_FILE_ITEM, RygelMediaFileItemClass))
#define RYGEL_IS_MEDIA_FILE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_FILE_ITEM))
#define RYGEL_IS_MEDIA_FILE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_FILE_ITEM))
#define RYGEL_MEDIA_FILE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_FILE_ITEM, RygelMediaFileItemClass))

typedef struct _RygelMediaFileItem RygelMediaFileItem;
typedef struct _RygelMediaFileItemClass RygelMediaFileItemClass;

#define RYGEL_TYPE_OBJECT_REMOVAL_QUEUE (rygel_object_removal_queue_get_type ())
#define RYGEL_OBJECT_REMOVAL_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueue))
#define RYGEL_OBJECT_REMOVAL_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueueClass))
#define RYGEL_IS_OBJECT_REMOVAL_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE))
#define RYGEL_IS_OBJECT_REMOVAL_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE))
#define RYGEL_OBJECT_REMOVAL_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueueClass))

typedef struct _RygelObjectRemovalQueue RygelObjectRemovalQueue;
typedef struct _RygelObjectRemovalQueueClass RygelObjectRemovalQueueClass;
typedef struct _RygelItemDestroyerRemoveObjectData RygelItemDestroyerRemoveObjectData;
typedef struct _RygelItemDestroyerFetchObjectData RygelItemDestroyerFetchObjectData;

typedef enum  {
	RYGEL_ITEM_DESTROYER_ERROR_PARSE
} RygelItemDestroyerError;
#define RYGEL_ITEM_DESTROYER_ERROR rygel_item_destroyer_error_quark ()
struct _RygelItemDestroyer {
	GObject parent_instance;
	RygelItemDestroyerPrivate * priv;
};

struct _RygelItemDestroyerClass {
	GObjectClass parent_class;
};

struct _RygelItemDestroyerPrivate {
	gchar* object_id;
	RygelContentDirectory* content_dir;
	GUPnPServiceAction* action;
	GCancellable* _cancellable;
};

struct _RygelContentDirectory {
	GUPnPService parent_instance;
	RygelContentDirectoryPrivate * priv;
	gchar* feature_list;
	RygelHTTPServer* http_server;
	RygelMediaContainer* root_container;
	GCancellable* cancellable;
	guint32 system_update_id;
};

struct _RygelContentDirectoryClass {
	GUPnPServiceClass parent_class;
};

typedef enum  {
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_OBJECT = 701,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_CURRENT_TAG_VALUE = 702,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_NEW_TAG_VALUE = 703,
	RYGEL_CONTENT_DIRECTORY_ERROR_REQUIRED_TAG = 704,
	RYGEL_CONTENT_DIRECTORY_ERROR_READ_ONLY_TAG = 705,
	RYGEL_CONTENT_DIRECTORY_ERROR_PARAMETER_MISMATCH = 706,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SEARCH_CRITERIA = 708,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SORT_CRITERIA = 709,
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_CONTAINER = 710,
	RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_OBJECT = 711,
	RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA = 712,
	RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT = 713,
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_FILE_TRANSFER = 717,
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_DESTINATION_RESOURCE = 718,
	RYGEL_CONTENT_DIRECTORY_ERROR_CANT_PROCESS = 720,
	RYGEL_CONTENT_DIRECTORY_ERROR_OUTDATED_OBJECT_METADATA = 728,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS = 402
} RygelContentDirectoryError;
#define RYGEL_CONTENT_DIRECTORY_ERROR rygel_content_directory_error_quark ()
struct _RygelItemDestroyerRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelItemDestroyer* self;
	GUPnPServiceAction* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	GError* _tmp3_;
	GUPnPServiceAction* _tmp4_;
	const gchar* _tmp5_;
	GError* _error_;
	GError* _tmp6_;
	GUPnPServiceAction* _tmp7_;
	GError* _tmp8_;
	GError* _tmp9_;
	const gchar* _tmp10_;
	GUPnPServiceAction* _tmp11_;
	GError* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	GError* _tmp15_;
	const gchar* _tmp16_;
	GError* _inner_error0_;
};

struct _RygelWritableContainerIface {
	GTypeInterface parent_iface;
	void (*add_item) (RygelWritableContainer* self, RygelMediaFileItem* item, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*add_item_finish) (RygelWritableContainer* self, GAsyncResult* _res_, GError** error);
	void (*add_container) (RygelWritableContainer* self, RygelMediaContainer* container, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*add_container_finish) (RygelWritableContainer* self, GAsyncResult* _res_, GError** error);
	void (*add_reference) (RygelWritableContainer* self, RygelMediaObject* object, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gchar* (*add_reference_finish) (RygelWritableContainer* self, GAsyncResult* _res_, GError** error);
	void (*remove_item) (RygelWritableContainer* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*remove_item_finish) (RygelWritableContainer* self, GAsyncResult* _res_, GError** error);
	void (*remove_container) (RygelWritableContainer* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*remove_container_finish) (RygelWritableContainer* self, GAsyncResult* _res_, GError** error);
	GeeArrayList* (*get_create_classes) (RygelWritableContainer* self);
	void (*set_create_classes) (RygelWritableContainer* self, GeeArrayList* value);
};

struct _RygelItemDestroyerRemoveObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelItemDestroyer* self;
	RygelMediaObject* media_object;
	RygelMediaObject* _tmp0_;
	RygelWritableContainer* parent;
	RygelMediaObject* _tmp1_;
	RygelMediaContainer* _tmp2_;
	RygelMediaContainer* _tmp3_;
	RygelWritableContainer* _tmp4_;
	RygelMediaObject* _tmp5_;
	RygelWritableContainer* _tmp6_;
	const gchar* _tmp7_;
	GCancellable* _tmp8_;
	GCancellable* _tmp9_;
	RygelMediaObject* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	GeeArrayList* writables;
	RygelMediaObject* _tmp13_;
	GCancellable* _tmp14_;
	GCancellable* _tmp15_;
	GeeArrayList* _tmp16_;
	GeeArrayList* _file_list;
	GeeArrayList* _tmp17_;
	GeeArrayList* _tmp18_;
	gint _file_size;
	GeeArrayList* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	gint _file_index;
	GFile* file;
	GeeArrayList* _tmp22_;
	gpointer _tmp23_;
	GFile* _tmp24_;
	GCancellable* _tmp25_;
	GCancellable* _tmp26_;
	GFile* _tmp27_;
	GCancellable* _tmp28_;
	GCancellable* _tmp29_;
	RygelWritableContainer* _tmp30_;
	const gchar* _tmp31_;
	GCancellable* _tmp32_;
	GCancellable* _tmp33_;
	RygelObjectRemovalQueue* _tmp34_;
	RygelObjectRemovalQueue* _tmp35_;
	RygelMediaObject* _tmp36_;
	GError* _inner_error0_;
};

struct _RygelItemDestroyerFetchObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelItemDestroyer* self;
	RygelMediaObject* result;
	RygelMediaObject* media_object;
	RygelContentDirectory* _tmp0_;
	RygelMediaContainer* _tmp1_;
	const gchar* _tmp2_;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	RygelMediaObject* _tmp5_;
	RygelMediaObject* _tmp6_;
	GError* _tmp7_;
	RygelMediaObject* _tmp8_;
	GUPnPOCMFlags _tmp9_;
	GUPnPOCMFlags _tmp10_;
	RygelMediaObject* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GError* _tmp14_;
	RygelMediaObject* _tmp15_;
	RygelMediaContainer* _tmp16_;
	RygelMediaContainer* _tmp17_;
	gboolean _tmp18_;
	gboolean _tmp19_;
	gchar* msg;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	RygelMediaObject* _tmp22_;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	GError* _tmp25_;
	GError* _inner_error0_;
};

static gint RygelItemDestroyer_private_offset;
static gpointer rygel_item_destroyer_parent_class = NULL;
static RygelStateMachineIface * rygel_item_destroyer_rygel_state_machine_parent_iface = NULL;

GQuark rygel_item_destroyer_error_quark (void);
GType rygel_item_destroyer_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelItemDestroyer, g_object_unref)
GType rygel_content_directory_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelContentDirectory, g_object_unref)
static void _vala_GUPnPServiceAction_free (GUPnPServiceAction* self);
RygelItemDestroyer* rygel_item_destroyer_new (RygelContentDirectory* content_dir,
                                              GUPnPServiceAction* action);
RygelItemDestroyer* rygel_item_destroyer_construct (GType object_type,
                                                    RygelContentDirectory* content_dir,
                                                    GUPnPServiceAction* action);
GType rygel_http_server_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelHTTPServer, g_object_unref)
GType rygel_media_object_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelMediaObject, g_object_unref)
GType rygel_media_container_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelMediaContainer, g_object_unref)
static void rygel_item_destroyer_real_run_data_free (gpointer _data);
static void rygel_item_destroyer_real_run (RygelStateMachine* base,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
static gboolean rygel_item_destroyer_real_run_co (RygelItemDestroyerRunData* _data_);
GQuark rygel_content_directory_error_quark (void);
static void rygel_item_destroyer_remove_object (RygelItemDestroyer* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void rygel_item_destroyer_remove_object_finish (RygelItemDestroyer* self,
                                                GAsyncResult* _res_,
                                                GError** error);
static void rygel_item_destroyer_run_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_);
static void rygel_item_destroyer_remove_object_data_free (gpointer _data);
static gboolean rygel_item_destroyer_remove_object_co (RygelItemDestroyerRemoveObjectData* _data_);
static void rygel_item_destroyer_fetch_object (RygelItemDestroyer* self,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static RygelMediaObject* rygel_item_destroyer_fetch_object_finish (RygelItemDestroyer* self,
                                                            GAsyncResult* _res_,
                                                            GError** error);
static void rygel_item_destroyer_remove_object_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
GType rygel_media_item_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelMediaItem, g_object_unref)
GType rygel_media_file_item_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelMediaFileItem, g_object_unref)
GType rygel_writable_container_get_type (void) G_GNUC_CONST;
RygelMediaContainer* rygel_media_object_get_parent (RygelMediaObject* self);
void rygel_writable_container_remove_item (RygelWritableContainer* self,
                                           const gchar* id,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
void rygel_writable_container_remove_item_finish (RygelWritableContainer* self,
                                                  GAsyncResult* _res_,
                                                  GError** error);
gboolean rygel_media_file_item_get_place_holder (RygelMediaFileItem* self);
void rygel_media_object_get_writables (RygelMediaObject* self,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
GeeArrayList* rygel_media_object_get_writables_finish (RygelMediaObject* self,
                                                       GAsyncResult* _res_,
                                                       GError** error);
void rygel_writable_container_remove_container (RygelWritableContainer* self,
                                                const gchar* id,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
void rygel_writable_container_remove_container_finish (RygelWritableContainer* self,
                                                       GAsyncResult* _res_,
                                                       GError** error);
GType rygel_object_removal_queue_get_type (void) G_GNUC_CONST;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RygelObjectRemovalQueue, g_object_unref)
RygelObjectRemovalQueue* rygel_object_removal_queue_get_default (void);
gboolean rygel_object_removal_queue_dequeue (RygelObjectRemovalQueue* self,
                                             RygelMediaObject* object);
static void rygel_item_destroyer_fetch_object_data_free (gpointer _data);
static gboolean rygel_item_destroyer_fetch_object_co (RygelItemDestroyerFetchObjectData* _data_);
void rygel_media_container_find_object (RygelMediaContainer* self,
                                        const gchar* id,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
RygelMediaObject* rygel_media_container_find_object_finish (RygelMediaContainer* self,
                                                            GAsyncResult* _res_,
                                                            GError** error);
static void rygel_item_destroyer_fetch_object_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
GUPnPOCMFlags rygel_media_object_get_ocm_flags (RygelMediaObject* self);
const gchar* rygel_media_object_get_id (RygelMediaObject* self);
gboolean rygel_media_object_get_restricted (RygelMediaObject* self);
static void rygel_item_destroyer_finalize (GObject * obj);
static void _vala_rygel_item_destroyer_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_rygel_item_destroyer_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

GQuark
rygel_item_destroyer_error_quark (void)
{
	return g_quark_from_static_string ("rygel-item-destroyer-error-quark");
}

static inline gpointer
rygel_item_destroyer_get_instance_private (RygelItemDestroyer* self)
{
	return G_STRUCT_MEMBER_P (self, RygelItemDestroyer_private_offset);
}

static void
_vala_GUPnPServiceAction_free (GUPnPServiceAction* self)
{
	g_boxed_free (gupnp_service_action_get_type (), self);
}

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

RygelItemDestroyer*
rygel_item_destroyer_construct (GType object_type,
                                RygelContentDirectory* content_dir,
                                GUPnPServiceAction* action)
{
	RygelItemDestroyer * self = NULL;
	RygelContentDirectory* _tmp0_;
	GCancellable* _tmp1_;
	GUPnPServiceAction* _tmp2_;
	g_return_val_if_fail (content_dir != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	self = (RygelItemDestroyer*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (content_dir);
	_g_object_unref0 (self->priv->content_dir);
	self->priv->content_dir = _tmp0_;
	_tmp1_ = content_dir->cancellable;
	rygel_state_machine_set_cancellable ((RygelStateMachine*) self, _tmp1_);
	_tmp2_ = action;
	action = NULL;
	__vala_GUPnPServiceAction_free0 (self->priv->action);
	self->priv->action = _tmp2_;
	__vala_GUPnPServiceAction_free0 (action);
	return self;
}

RygelItemDestroyer*
rygel_item_destroyer_new (RygelContentDirectory* content_dir,
                          GUPnPServiceAction* action)
{
	return rygel_item_destroyer_construct (RYGEL_TYPE_ITEM_DESTROYER, content_dir, action);
}

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

static void
rygel_item_destroyer_real_run (RygelStateMachine* base,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	RygelItemDestroyer * self;
	RygelItemDestroyerRunData* _data_;
	RygelItemDestroyer* _tmp0_;
	self = (RygelItemDestroyer*) base;
	_data_ = g_slice_new0 (RygelItemDestroyerRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_item_destroyer_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_item_destroyer_real_run_co (_data_);
}

static void
rygel_item_destroyer_run_finish (RygelStateMachine* base,
                                 GAsyncResult* _res_)
{
	RygelItemDestroyerRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
rygel_item_destroyer_run_ready (GObject* source_object,
                                GAsyncResult* _res_,
                                gpointer _user_data_)
{
	RygelItemDestroyerRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_item_destroyer_real_run_co (_data_);
}

static gboolean
rygel_item_destroyer_real_run_co (RygelItemDestroyerRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = _data_->self->priv->action;
		_data_->_tmp1_ = NULL;
		gupnp_service_action_get (_data_->_tmp0_, "ObjectID", G_TYPE_STRING, &_data_->_tmp1_, NULL);
		_g_free0 (_data_->self->priv->object_id);
		_data_->self->priv->object_id = _data_->_tmp1_;
		_data_->_tmp2_ = _data_->self->priv->object_id;
		if (_data_->_tmp2_ == NULL) {
			_data_->_tmp3_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS, _ ("ContainerID missing"));
			_data_->_inner_error0_ = _data_->_tmp3_;
			goto __catch69_g_error;
		}
		_data_->_state_ = 1;
		rygel_item_destroyer_remove_object (_data_->self, rygel_item_destroyer_run_ready, _data_);
		return FALSE;
		_state_1:
		rygel_item_destroyer_remove_object_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch69_g_error;
		}
		_data_->_tmp4_ = _data_->self->priv->action;
		gupnp_service_action_return (_data_->_tmp4_);
		_data_->_tmp5_ = _data_->self->priv->object_id;
		g_debug (_ ("Successfully destroyed object “%s”"), _data_->_tmp5_);
	}
	goto __finally69;
	__catch69_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp6_ = _data_->_error_;
		if (_data_->_tmp6_->domain == RYGEL_CONTENT_DIRECTORY_ERROR) {
			_data_->_tmp7_ = _data_->self->priv->action;
			_data_->_tmp8_ = _data_->_error_;
			_data_->_tmp9_ = _data_->_error_;
			_data_->_tmp10_ = _data_->_tmp9_->message;
			gupnp_service_action_return_error (_data_->_tmp7_, (guint) _data_->_tmp8_->code, _data_->_tmp10_);
		} else {
			_data_->_tmp11_ = _data_->self->priv->action;
			_data_->_tmp12_ = _data_->_error_;
			_data_->_tmp13_ = _data_->_tmp12_->message;
			gupnp_service_action_return_error (_data_->_tmp11_, (guint) 701, _data_->_tmp13_);
		}
		_data_->_tmp14_ = _data_->self->priv->object_id;
		_data_->_tmp15_ = _data_->_error_;
		_data_->_tmp16_ = _data_->_tmp15_->message;
		g_warning (_ ("Failed to destroy object “%s”: %s"), _data_->_tmp14_, _data_->_tmp16_);
		_g_error_free0 (_data_->_error_);
	}
	__finally69:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_signal_emit_by_name ((RygelStateMachine*) _data_->self, "completed");
	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_item_destroyer_remove_object_data_free (gpointer _data)
{
	RygelItemDestroyerRemoveObjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelItemDestroyerRemoveObjectData, _data_);
}

static void
rygel_item_destroyer_remove_object (RygelItemDestroyer* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	RygelItemDestroyerRemoveObjectData* _data_;
	RygelItemDestroyer* _tmp0_;
	_data_ = g_slice_new0 (RygelItemDestroyerRemoveObjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_item_destroyer_remove_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_item_destroyer_remove_object_co (_data_);
}

static void
rygel_item_destroyer_remove_object_finish (RygelItemDestroyer* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	RygelItemDestroyerRemoveObjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
rygel_item_destroyer_remove_object_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	RygelItemDestroyerRemoveObjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_item_destroyer_remove_object_co (_data_);
}

static gboolean
rygel_item_destroyer_remove_object_co (RygelItemDestroyerRemoveObjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	rygel_item_destroyer_fetch_object (_data_->self, rygel_item_destroyer_remove_object_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = rygel_item_destroyer_fetch_object_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->media_object = _data_->_tmp0_;
	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_->_tmp1_ = _data_->media_object;
	_data_->_tmp2_ = rygel_media_object_get_parent (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp3_, RYGEL_TYPE_WRITABLE_CONTAINER) ? ((RygelWritableContainer*) _data_->_tmp3_) : NULL);
	_data_->parent = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->media_object;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp5_, RYGEL_TYPE_MEDIA_FILE_ITEM)) {
		_data_->_tmp6_ = _data_->parent;
		_data_->_tmp7_ = _data_->self->priv->object_id;
		_data_->_tmp8_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_state_ = 2;
		rygel_writable_container_remove_item (_data_->_tmp6_, _data_->_tmp7_, _data_->_tmp9_, rygel_item_destroyer_remove_object_ready, _data_);
		return FALSE;
		_state_2:
		rygel_writable_container_remove_item_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->parent);
			_g_object_unref0 (_data_->media_object);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp10_ = _data_->media_object;
		_data_->_tmp11_ = rygel_media_file_item_get_place_holder (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp10_, RYGEL_TYPE_MEDIA_FILE_ITEM) ? ((RygelMediaFileItem*) _data_->_tmp10_) : NULL);
		_data_->_tmp12_ = _data_->_tmp11_;
		if (!_data_->_tmp12_) {
			_data_->_tmp13_ = _data_->media_object;
			_data_->_tmp14_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp15_ = _data_->_tmp14_;
			_data_->_state_ = 3;
			rygel_media_object_get_writables (_data_->_tmp13_, _data_->_tmp15_, rygel_item_destroyer_remove_object_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp16_ = rygel_media_object_get_writables_finish (_data_->_tmp13_, _data_->_res_, &_data_->_inner_error0_);
			_data_->writables = _data_->_tmp16_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->parent);
				_g_object_unref0 (_data_->media_object);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			{
				_data_->_tmp17_ = _data_->writables;
				_data_->_tmp18_ = _g_object_ref0 (_data_->_tmp17_);
				_data_->_file_list = _data_->_tmp18_;
				_data_->_tmp19_ = _data_->_file_list;
				_data_->_tmp20_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp19_);
				_data_->_tmp21_ = _data_->_tmp20_;
				_data_->_file_size = _data_->_tmp21_;
				_data_->_file_index = -1;
				while (TRUE) {
					_data_->_file_index = _data_->_file_index + 1;
					if (!(_data_->_file_index < _data_->_file_size)) {
						break;
					}
					_data_->_tmp22_ = _data_->_file_list;
					_data_->_tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp22_, _data_->_file_index);
					_data_->file = (GFile*) _data_->_tmp23_;
					_data_->_tmp24_ = _data_->file;
					_data_->_tmp25_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
					_data_->_tmp26_ = _data_->_tmp25_;
					if (g_file_query_exists (_data_->_tmp24_, _data_->_tmp26_)) {
						_data_->_tmp27_ = _data_->file;
						_data_->_tmp28_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
						_data_->_tmp29_ = _data_->_tmp28_;
						g_file_delete (_data_->_tmp27_, _data_->_tmp29_, &_data_->_inner_error0_);
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
							_g_object_unref0 (_data_->file);
							_g_object_unref0 (_data_->_file_list);
							_g_object_unref0 (_data_->writables);
							_g_object_unref0 (_data_->parent);
							_g_object_unref0 (_data_->media_object);
							g_object_unref (_data_->_async_result);
							return FALSE;
						}
					}
					_g_object_unref0 (_data_->file);
				}
				_g_object_unref0 (_data_->_file_list);
			}
			_g_object_unref0 (_data_->writables);
		}
	} else {
		_data_->_tmp30_ = _data_->parent;
		_data_->_tmp31_ = _data_->self->priv->object_id;
		_data_->_tmp32_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp33_ = _data_->_tmp32_;
		_data_->_state_ = 4;
		rygel_writable_container_remove_container (_data_->_tmp30_, _data_->_tmp31_, _data_->_tmp33_, rygel_item_destroyer_remove_object_ready, _data_);
		return FALSE;
		_state_4:
		rygel_writable_container_remove_container_finish (_data_->_tmp30_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->parent);
			_g_object_unref0 (_data_->media_object);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp34_ = rygel_object_removal_queue_get_default ();
	_data_->_tmp35_ = _data_->_tmp34_;
	_data_->_tmp36_ = _data_->media_object;
	rygel_object_removal_queue_dequeue (_data_->_tmp35_, _data_->_tmp36_);
	_g_object_unref0 (_data_->_tmp35_);
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->media_object);
	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_item_destroyer_fetch_object_data_free (gpointer _data)
{
	RygelItemDestroyerFetchObjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelItemDestroyerFetchObjectData, _data_);
}

static void
rygel_item_destroyer_fetch_object (RygelItemDestroyer* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	RygelItemDestroyerFetchObjectData* _data_;
	RygelItemDestroyer* _tmp0_;
	_data_ = g_slice_new0 (RygelItemDestroyerFetchObjectData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_item_destroyer_fetch_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_item_destroyer_fetch_object_co (_data_);
}

static RygelMediaObject*
rygel_item_destroyer_fetch_object_finish (RygelItemDestroyer* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	RygelMediaObject* result;
	RygelItemDestroyerFetchObjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
rygel_item_destroyer_fetch_object_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	RygelItemDestroyerFetchObjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_item_destroyer_fetch_object_co (_data_);
}

static gboolean
rygel_item_destroyer_fetch_object_co (RygelItemDestroyerFetchObjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->content_dir;
	_data_->_tmp1_ = _data_->_tmp0_->root_container;
	_data_->_tmp2_ = _data_->self->priv->object_id;
	_data_->_tmp3_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_state_ = 1;
	rygel_media_container_find_object (_data_->_tmp1_, _data_->_tmp2_, _data_->_tmp4_, rygel_item_destroyer_fetch_object_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp5_ = rygel_media_container_find_object_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
	_data_->media_object = _data_->_tmp5_;
	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_->_tmp6_ = _data_->media_object;
	if (_data_->_tmp6_ == NULL) {
		_data_->_tmp7_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_OBJECT, _ ("No such object"));
		_data_->_inner_error0_ = _data_->_tmp7_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->media_object);
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		_data_->_tmp8_ = _data_->media_object;
		_data_->_tmp9_ = rygel_media_object_get_ocm_flags (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		if (!((_data_->_tmp10_ & GUPNP_OCM_FLAGS_DESTROYABLE) == GUPNP_OCM_FLAGS_DESTROYABLE)) {
			_data_->_tmp11_ = _data_->media_object;
			_data_->_tmp12_ = rygel_media_object_get_id (_data_->_tmp11_);
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_tmp14_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_OBJECT, _ ("Removal of object %s not allowed"), _data_->_tmp13_);
			_data_->_inner_error0_ = _data_->_tmp14_;
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->media_object);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_data_->_tmp15_ = _data_->media_object;
			_data_->_tmp16_ = rygel_media_object_get_parent (_data_->_tmp15_);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = rygel_media_object_get_restricted ((RygelMediaObject*) _data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			if (_data_->_tmp19_) {
				_data_->_tmp20_ = g_strdup (_ ("Object removal from %s not allowed"));
				_data_->msg = _data_->_tmp20_;
				_data_->_tmp21_ = _data_->msg;
				_data_->_tmp22_ = _data_->media_object;
				_data_->_tmp23_ = rygel_media_object_get_id (_data_->_tmp22_);
				_data_->_tmp24_ = _data_->_tmp23_;
				_data_->_tmp25_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT, _data_->_tmp21_, _data_->_tmp24_);
				_data_->_inner_error0_ = _data_->_tmp25_;
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->msg);
				_g_object_unref0 (_data_->media_object);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	_data_->result = _data_->media_object;
	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 GCancellable*
rygel_item_destroyer_real_get_cancellable (RygelStateMachine* base)
{
	GCancellable* result;
	RygelItemDestroyer* self;
	GCancellable* _tmp0_;
	self = (RygelItemDestroyer*) base;
	_tmp0_ = self->priv->_cancellable;
	result = _tmp0_;
	return result;
}

static void
rygel_item_destroyer_real_set_cancellable (RygelStateMachine* base,
                                           GCancellable* value)
{
	RygelItemDestroyer* self;
	self = (RygelItemDestroyer*) base;
	if (rygel_item_destroyer_real_get_cancellable (base) != value) {
		GCancellable* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cancellable);
		self->priv->_cancellable = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, rygel_item_destroyer_properties[RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY]);
	}
}

static void
rygel_item_destroyer_class_init (RygelItemDestroyerClass * klass,
                                 gpointer klass_data)
{
	rygel_item_destroyer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelItemDestroyer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_item_destroyer_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_item_destroyer_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_item_destroyer_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY, rygel_item_destroyer_properties[RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY] = g_param_spec_object ("cancellable", "cancellable", "cancellable", g_cancellable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
rygel_item_destroyer_rygel_state_machine_interface_init (RygelStateMachineIface * iface,
                                                         gpointer iface_data)
{
	rygel_item_destroyer_rygel_state_machine_parent_iface = g_type_interface_peek_parent (iface);
	iface->run = (void (*) (RygelStateMachine*, GAsyncReadyCallback, gpointer)) rygel_item_destroyer_real_run;
	iface->run_finish = (void (*) (RygelStateMachine*, GAsyncResult*)) rygel_item_destroyer_run_finish;
	iface->get_cancellable = rygel_item_destroyer_real_get_cancellable;
	iface->set_cancellable = rygel_item_destroyer_real_set_cancellable;
}

static void
rygel_item_destroyer_instance_init (RygelItemDestroyer * self,
                                    gpointer klass)
{
	self->priv = rygel_item_destroyer_get_instance_private (self);
}

static void
rygel_item_destroyer_finalize (GObject * obj)
{
	RygelItemDestroyer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyer);
	_g_free0 (self->priv->object_id);
	_g_object_unref0 (self->priv->content_dir);
	__vala_GUPnPServiceAction_free0 (self->priv->action);
	_g_object_unref0 (self->priv->_cancellable);
	G_OBJECT_CLASS (rygel_item_destroyer_parent_class)->finalize (obj);
}

/**
 * DestroyObject action implementation.
 */
GType
rygel_item_destroyer_get_type (void)
{
	static volatile gsize rygel_item_destroyer_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_item_destroyer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelItemDestroyerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_item_destroyer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelItemDestroyer), 0, (GInstanceInitFunc) rygel_item_destroyer_instance_init, NULL };
		static const GInterfaceInfo rygel_state_machine_info = { (GInterfaceInitFunc) rygel_item_destroyer_rygel_state_machine_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_item_destroyer_type_id;
		rygel_item_destroyer_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelItemDestroyer", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_item_destroyer_type_id, RYGEL_TYPE_STATE_MACHINE, &rygel_state_machine_info);
		RygelItemDestroyer_private_offset = g_type_add_instance_private (rygel_item_destroyer_type_id, sizeof (RygelItemDestroyerPrivate));
		g_once_init_leave (&rygel_item_destroyer_type_id__volatile, rygel_item_destroyer_type_id);
	}
	return rygel_item_destroyer_type_id__volatile;
}

static void
_vala_rygel_item_destroyer_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	RygelItemDestroyer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyer);
	switch (property_id) {
		case RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY:
		g_value_set_object (value, rygel_state_machine_get_cancellable ((RygelStateMachine*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_rygel_item_destroyer_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	RygelItemDestroyer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_ITEM_DESTROYER, RygelItemDestroyer);
	switch (property_id) {
		case RYGEL_ITEM_DESTROYER_CANCELLABLE_PROPERTY:
		rygel_state_machine_set_cancellable ((RygelStateMachine*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

