/* rygel-content-directory.c generated by valac 0.56.19, the Vala compiler
 * generated from rygel-content-directory.vala, do not modify */

/*
 * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
 * Copyright (C) 2007 OpenedHand Ltd.
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Zeeshan Ali <zeenix@gmail.com>
 *         Jorn Baayen <jorn@openedhand.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.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-server.h"
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libgupnp/gupnp.h>
#include "rygel-core.h"
#include <glib/gi18n-lib.h>
#include <libgupnp-av/gupnp-av.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define RYGEL_TYPE_CONTENT_DIRECTORY_ERROR (rygel_content_directory_error_get_type ())

#define RYGEL_TYPE_IMPORT_RESOURCE (rygel_import_resource_get_type ())
#define RYGEL_IMPORT_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_IMPORT_RESOURCE, RygelImportResource))
#define RYGEL_IMPORT_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_IMPORT_RESOURCE, RygelImportResourceClass))
#define RYGEL_IS_IMPORT_RESOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_IMPORT_RESOURCE))
#define RYGEL_IS_IMPORT_RESOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_IMPORT_RESOURCE))
#define RYGEL_IMPORT_RESOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_IMPORT_RESOURCE, RygelImportResourceClass))

typedef struct _RygelImportResource RygelImportResource;
typedef struct _RygelImportResourceClass RygelImportResourceClass;

#define RYGEL_TYPE_LAST_CHANGE (rygel_last_change_get_type ())
#define RYGEL_LAST_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE, RygelLastChange))
#define RYGEL_LAST_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE, RygelLastChangeClass))
#define RYGEL_IS_LAST_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE))
#define RYGEL_IS_LAST_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE))
#define RYGEL_LAST_CHANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE, RygelLastChangeClass))

typedef struct _RygelLastChange RygelLastChange;
typedef struct _RygelLastChangeClass RygelLastChangeClass;
enum  {
	RYGEL_CONTENT_DIRECTORY_0_PROPERTY,
	RYGEL_CONTENT_DIRECTORY_NUM_PROPERTIES
};
static GParamSpec* rygel_content_directory_properties[RYGEL_CONTENT_DIRECTORY_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 RYGEL_TYPE_MEDIA_QUERY_ACTION (rygel_media_query_action_get_type ())
#define RYGEL_MEDIA_QUERY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryAction))
#define RYGEL_MEDIA_QUERY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryActionClass))
#define RYGEL_IS_MEDIA_QUERY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION))
#define RYGEL_IS_MEDIA_QUERY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_QUERY_ACTION))
#define RYGEL_MEDIA_QUERY_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryActionClass))

typedef struct _RygelMediaQueryAction RygelMediaQueryAction;
typedef struct _RygelMediaQueryActionClass RygelMediaQueryActionClass;

#define RYGEL_TYPE_BROWSE (rygel_browse_get_type ())
#define RYGEL_BROWSE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_BROWSE, RygelBrowse))
#define RYGEL_BROWSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_BROWSE, RygelBrowseClass))
#define RYGEL_IS_BROWSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_BROWSE))
#define RYGEL_IS_BROWSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_BROWSE))
#define RYGEL_BROWSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_BROWSE, RygelBrowseClass))

typedef struct _RygelBrowse RygelBrowse;
typedef struct _RygelBrowseClass RygelBrowseClass;

#define RYGEL_TYPE_SEARCH (rygel_search_get_type ())
#define RYGEL_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCH, RygelSearch))
#define RYGEL_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEARCH, RygelSearchClass))
#define RYGEL_IS_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCH))
#define RYGEL_IS_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEARCH))
#define RYGEL_SEARCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEARCH, RygelSearchClass))

typedef struct _RygelSearch RygelSearch;
typedef struct _RygelSearchClass RygelSearchClass;

#define RYGEL_TYPE_OBJECT_CREATOR (rygel_object_creator_get_type ())
#define RYGEL_OBJECT_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreator))
#define RYGEL_OBJECT_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreatorClass))
#define RYGEL_IS_OBJECT_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_OBJECT_CREATOR))
#define RYGEL_IS_OBJECT_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_OBJECT_CREATOR))
#define RYGEL_OBJECT_CREATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreatorClass))

typedef struct _RygelObjectCreator RygelObjectCreator;
typedef struct _RygelObjectCreatorClass RygelObjectCreatorClass;

#define RYGEL_TYPE_REFERENCE_CREATOR (rygel_reference_creator_get_type ())
#define RYGEL_REFERENCE_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_REFERENCE_CREATOR, RygelReferenceCreator))
#define RYGEL_REFERENCE_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_REFERENCE_CREATOR, RygelReferenceCreatorClass))
#define RYGEL_IS_REFERENCE_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_REFERENCE_CREATOR))
#define RYGEL_IS_REFERENCE_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_REFERENCE_CREATOR))
#define RYGEL_REFERENCE_CREATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_REFERENCE_CREATOR, RygelReferenceCreatorClass))

typedef struct _RygelReferenceCreator RygelReferenceCreator;
typedef struct _RygelReferenceCreatorClass RygelReferenceCreatorClass;

#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;

#define RYGEL_TYPE_ITEM_UPDATER (rygel_item_updater_get_type ())
#define RYGEL_ITEM_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_ITEM_UPDATER, RygelItemUpdater))
#define RYGEL_ITEM_UPDATER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_ITEM_UPDATER, RygelItemUpdaterClass))
#define RYGEL_IS_ITEM_UPDATER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_ITEM_UPDATER))
#define RYGEL_IS_ITEM_UPDATER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_ITEM_UPDATER))
#define RYGEL_ITEM_UPDATER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_ITEM_UPDATER, RygelItemUpdaterClass))

typedef struct _RygelItemUpdater RygelItemUpdater;
typedef struct _RygelItemUpdaterClass RygelItemUpdaterClass;
typedef struct _RygelImportResourcePrivate RygelImportResourcePrivate;
typedef enum  {
	RYGEL_TRANSFER_STATUS_COMPLETED,
	RYGEL_TRANSFER_STATUS_ERROR,
	RYGEL_TRANSFER_STATUS_IN_PROGRESS,
	RYGEL_TRANSFER_STATUS_STOPPED
} RygelTransferStatus;

#define RYGEL_TYPE_TRANSFER_STATUS (rygel_transfer_status_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define RYGEL_TYPE_LAST_CHANGE_ENTRY (rygel_last_change_entry_get_type ())
#define RYGEL_LAST_CHANGE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE_ENTRY, RygelLastChangeEntry))
#define RYGEL_LAST_CHANGE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE_ENTRY, RygelLastChangeEntryClass))
#define RYGEL_IS_LAST_CHANGE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE_ENTRY))
#define RYGEL_IS_LAST_CHANGE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE_ENTRY))
#define RYGEL_LAST_CHANGE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE_ENTRY, RygelLastChangeEntryClass))

typedef struct _RygelLastChangeEntry RygelLastChangeEntry;
typedef struct _RygelLastChangeEntryClass RygelLastChangeEntryClass;

#define RYGEL_TYPE_LAST_CHANGE_ST_DONE (rygel_last_change_st_done_get_type ())
#define RYGEL_LAST_CHANGE_ST_DONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE_ST_DONE, RygelLastChangeStDone))
#define RYGEL_LAST_CHANGE_ST_DONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE_ST_DONE, RygelLastChangeStDoneClass))
#define RYGEL_IS_LAST_CHANGE_ST_DONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE_ST_DONE))
#define RYGEL_IS_LAST_CHANGE_ST_DONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE_ST_DONE))
#define RYGEL_LAST_CHANGE_ST_DONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE_ST_DONE, RygelLastChangeStDoneClass))

typedef struct _RygelLastChangeStDone RygelLastChangeStDone;
typedef struct _RygelLastChangeStDoneClass RygelLastChangeStDoneClass;
typedef struct _Block5Data Block5Data;

#define RYGEL_TYPE_LAST_CHANGE_OBJ_ADD (rygel_last_change_obj_add_get_type ())
#define RYGEL_LAST_CHANGE_OBJ_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_ADD, RygelLastChangeObjAdd))
#define RYGEL_LAST_CHANGE_OBJ_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_ADD, RygelLastChangeObjAddClass))
#define RYGEL_IS_LAST_CHANGE_OBJ_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_ADD))
#define RYGEL_IS_LAST_CHANGE_OBJ_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_ADD))
#define RYGEL_LAST_CHANGE_OBJ_ADD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_ADD, RygelLastChangeObjAddClass))

typedef struct _RygelLastChangeObjAdd RygelLastChangeObjAdd;
typedef struct _RygelLastChangeObjAddClass RygelLastChangeObjAddClass;

#define RYGEL_TYPE_LAST_CHANGE_OBJ_MOD (rygel_last_change_obj_mod_get_type ())
#define RYGEL_LAST_CHANGE_OBJ_MOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_MOD, RygelLastChangeObjMod))
#define RYGEL_LAST_CHANGE_OBJ_MOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_MOD, RygelLastChangeObjModClass))
#define RYGEL_IS_LAST_CHANGE_OBJ_MOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_MOD))
#define RYGEL_IS_LAST_CHANGE_OBJ_MOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_MOD))
#define RYGEL_LAST_CHANGE_OBJ_MOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_MOD, RygelLastChangeObjModClass))

typedef struct _RygelLastChangeObjMod RygelLastChangeObjMod;
typedef struct _RygelLastChangeObjModClass RygelLastChangeObjModClass;

#define RYGEL_TYPE_LAST_CHANGE_OBJ_DEL (rygel_last_change_obj_del_get_type ())
#define RYGEL_LAST_CHANGE_OBJ_DEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_DEL, RygelLastChangeObjDel))
#define RYGEL_LAST_CHANGE_OBJ_DEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_DEL, RygelLastChangeObjDelClass))
#define RYGEL_IS_LAST_CHANGE_OBJ_DEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_DEL))
#define RYGEL_IS_LAST_CHANGE_OBJ_DEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LAST_CHANGE_OBJ_DEL))
#define RYGEL_LAST_CHANGE_OBJ_DEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LAST_CHANGE_OBJ_DEL, RygelLastChangeObjDelClass))

typedef struct _RygelLastChangeObjDel RygelLastChangeObjDel;
typedef struct _RygelLastChangeObjDelClass RygelLastChangeObjDelClass;
#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
typedef struct _RygelContentDirectoryServiceResetData RygelContentDirectoryServiceResetData;
#define _rygel_dlna_profile_unref0(var) ((var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))

/**
 * Errors used by ContentDirectory and deriving classes.
 */
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 _RygelContentDirectoryPrivate {
	GeeArrayList* updated_containers;
	GeeArrayList* active_imports;
	GeeArrayList* finished_imports;
	gboolean clear_updated_containers;
	guint update_notify_id;
	RygelLastChange* last_change;
	gchar* service_reset_token;
};

struct _RygelImportResource {
	GObject parent_instance;
	RygelImportResourcePrivate * priv;
	gchar* source_uri;
	gchar* destination_uri;
	guint32 transfer_id;
	RygelTransferStatus status;
	gint64 bytes_copied;
	gint64 bytes_total;
};

struct _RygelImportResourceClass {
	GObjectClass parent_class;
};

struct _Block5Data {
	int _ref_count_;
	RygelContentDirectory* self;
	RygelImportResource* import;
};

struct _RygelContentDirectoryServiceResetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelContentDirectory* self;
	RygelMediaServerPlugin* plugin;
	GUPnPRootDevice* _tmp0_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPResourceFactory* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	RygelMediaServerPlugin* _tmp5_;
	RygelMediaServerPlugin* _tmp6_;
	RygelMediaServerPlugin* _tmp7_;
	gchar* _tmp8_;
	RygelMediaContainer* _tmp9_;
	RygelTrackableContainer* trackable;
	RygelMediaContainer* _tmp10_;
	RygelTrackableContainer* _tmp11_;
	RygelTrackableContainer* _tmp12_;
	const gchar* _tmp13_;
	RygelRelationalExpression* expression;
	RygelRelationalExpression* _tmp14_;
	RygelRelationalExpression* _tmp15_;
	gchar* _tmp16_;
	RygelRelationalExpression* _tmp17_;
	gchar* _tmp18_;
	RygelRelationalExpression* _tmp19_;
	RygelSearchableContainer* root;
	RygelMediaContainer* _tmp20_;
	RygelSearchableContainer* _tmp21_;
	RygelSearchableContainer* _tmp22_;
	guint32 matches;
	RygelMediaObjects* objects;
	RygelSearchableContainer* _tmp23_;
	RygelRelationalExpression* _tmp24_;
	guint _tmp25_;
	RygelMediaObjects* _tmp26_;
	RygelMediaObjects* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	guint32 count;
	RygelMediaObjects* _object_list;
	RygelMediaObjects* _tmp30_;
	gint _object_size;
	RygelMediaObjects* _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	gint _object_index;
	gint _tmp34_;
	gint _tmp35_;
	RygelMediaObject* object;
	RygelMediaObjects* _tmp36_;
	gpointer _tmp37_;
	RygelMediaObject* _tmp38_;
	guint32 _tmp39_;
	RygelMediaObject* _tmp40_;
	RygelMediaContainer* container;
	RygelMediaObject* _tmp41_;
	RygelMediaContainer* _tmp42_;
	RygelMediaContainer* _tmp43_;
	RygelMediaContainer* _tmp44_;
	guint _tmp45_;
	guint _tmp46_;
	RygelMediaContainer* _tmp47_;
	RygelMediaServerPlugin* _tmp48_;
	const gchar* _tmp49_;
	GError* _inner_error0_;
};

static gint RygelContentDirectory_private_offset;
static gpointer rygel_content_directory_parent_class = NULL;

VALA_EXTERN GQuark rygel_content_directory_error_quark (void);
VALA_EXTERN GType rygel_content_directory_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_import_resource_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_last_change_get_type (void) G_GNUC_CONST ;
static void rygel_content_directory_real_constructed (GObject* base);
static gboolean _rygel_media_container_equal_func_gee_equal_data_func (gconstpointer a,
                                                                gconstpointer b,
                                                                gpointer self);
static void rygel_content_directory_on_container_updated (RygelContentDirectory* self,
                                                   RygelMediaContainer* root_container,
                                                   RygelMediaContainer* updated_container,
                                                   RygelMediaObject* object,
                                                   RygelObjectEventType event_type,
                                                   gboolean sub_tree_update);
static void _rygel_content_directory_on_container_updated_rygel_media_container_container_updated (RygelMediaContainer* _sender,
                                                                                            RygelMediaContainer* container,
                                                                                            RygelMediaObject* object,
                                                                                            RygelObjectEventType event_type,
                                                                                            gboolean sub_tree_update,
                                                                                            gpointer self);
static void rygel_content_directory_on_sub_tree_updates_finished (RygelContentDirectory* self,
                                                           RygelMediaContainer* root_container,
                                                           RygelMediaObject* sub_tree_root);
static void _rygel_content_directory_on_sub_tree_updates_finished_rygel_media_container_sub_tree_updates_finished (RygelMediaContainer* _sender,
                                                                                                            RygelMediaObject* sub_tree_root,
                                                                                                            gpointer self);
VALA_EXTERN RygelLastChange* rygel_last_change_new (void);
VALA_EXTERN RygelLastChange* rygel_last_change_construct (GType object_type);
static void rygel_content_directory_browse_cb (RygelContentDirectory* self,
                                        GUPnPService* content_dir,
                                        GUPnPServiceAction* action);
static void _rygel_content_directory_browse_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                      GUPnPServiceAction* action,
                                                                      gpointer self);
static void rygel_content_directory_search_cb (RygelContentDirectory* self,
                                        GUPnPService* content_dir,
                                        GUPnPServiceAction* action);
static void _rygel_content_directory_search_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                      GUPnPServiceAction* action,
                                                                      gpointer self);
static void rygel_content_directory_create_object_cb (RygelContentDirectory* self,
                                               GUPnPService* content_dir,
                                               GUPnPServiceAction* action);
static void _rygel_content_directory_create_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                             GUPnPServiceAction* action,
                                                                             gpointer self);
static void rygel_content_directory_create_reference_cb (RygelContentDirectory* self,
                                                  GUPnPService* content_dir,
                                                  GUPnPServiceAction* action);
static void _rygel_content_directory_create_reference_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                GUPnPServiceAction* action,
                                                                                gpointer self);
static void rygel_content_directory_destroy_object_cb (RygelContentDirectory* self,
                                                GUPnPService* content_dir,
                                                GUPnPServiceAction* action);
static void _rygel_content_directory_destroy_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                              GUPnPServiceAction* action,
                                                                              gpointer self);
static void rygel_content_directory_update_object_cb (RygelContentDirectory* self,
                                               GUPnPService* content_dir,
                                               GUPnPServiceAction* action);
static void _rygel_content_directory_update_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                             GUPnPServiceAction* action,
                                                                             gpointer self);
static void rygel_content_directory_import_resource_cb (RygelContentDirectory* self,
                                                 GUPnPService* content_dir,
                                                 GUPnPServiceAction* action);
static void _rygel_content_directory_import_resource_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                               GUPnPServiceAction* action,
                                                                               gpointer self);
static void rygel_content_directory_get_transfer_progress_cb (RygelContentDirectory* self,
                                                       GUPnPService* content_dir,
                                                       GUPnPServiceAction* action);
static void _rygel_content_directory_get_transfer_progress_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                     GUPnPServiceAction* action,
                                                                                     gpointer self);
static void rygel_content_directory_stop_transfer_resource_cb (RygelContentDirectory* self,
                                                        GUPnPService* content_dir,
                                                        GUPnPServiceAction* action);
static void _rygel_content_directory_stop_transfer_resource_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                      GUPnPServiceAction* action,
                                                                                      gpointer self);
static void rygel_content_directory_get_dlna_upload_profiles_cb (RygelContentDirectory* self,
                                                          GUPnPService* content_dir,
                                                          GUPnPServiceAction* action);
static void _rygel_content_directory_get_dlna_upload_profiles_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                        GUPnPServiceAction* action,
                                                                                        gpointer self);
static void rygel_content_directory_query_transfer_ids (RygelContentDirectory* self,
                                                 GUPnPService* content_dir,
                                                 const gchar* variable,
                                                 GValue* value);
static void _rygel_content_directory_query_transfer_ids_gupnp_service_query_variable (GUPnPService* _sender,
                                                                               const gchar* variable,
                                                                               GValue* value,
                                                                               gpointer self);
static void rygel_content_directory_get_system_update_id_cb (RygelContentDirectory* self,
                                                      GUPnPService* content_dir,
                                                      GUPnPServiceAction* action);
static void _rygel_content_directory_get_system_update_id_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                    GUPnPServiceAction* action,
                                                                                    gpointer self);
static void rygel_content_directory_query_system_update_id (RygelContentDirectory* self,
                                                     GUPnPService* content_dir,
                                                     const gchar* variable,
                                                     GValue* value);
static void _rygel_content_directory_query_system_update_id_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                   const gchar* variable,
                                                                                   GValue* value,
                                                                                   gpointer self);
static void rygel_content_directory_query_container_update_ids (RygelContentDirectory* self,
                                                         GUPnPService* content_dir,
                                                         const gchar* variable,
                                                         GValue* value);
static void _rygel_content_directory_query_container_update_ids_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                       const gchar* variable,
                                                                                       GValue* value,
                                                                                       gpointer self);
static void rygel_content_directory_get_search_capabilities_cb (RygelContentDirectory* self,
                                                         GUPnPService* content_dir,
                                                         GUPnPServiceAction* action);
static void _rygel_content_directory_get_search_capabilities_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                       GUPnPServiceAction* action,
                                                                                       gpointer self);
static void rygel_content_directory_query_search_capabilities (RygelContentDirectory* self,
                                                        GUPnPService* content_dir,
                                                        const gchar* variable,
                                                        GValue* value);
static void _rygel_content_directory_query_search_capabilities_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                      const gchar* variable,
                                                                                      GValue* value,
                                                                                      gpointer self);
static void rygel_content_directory_get_sort_capabilities_cb (RygelContentDirectory* self,
                                                       GUPnPService* content_dir,
                                                       GUPnPServiceAction* action);
static void _rygel_content_directory_get_sort_capabilities_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                     GUPnPServiceAction* action,
                                                                                     gpointer self);
static void rygel_content_directory_query_sort_capabilities (RygelContentDirectory* self,
                                                      GUPnPService* content_dir,
                                                      const gchar* variable,
                                                      GValue* value);
static void _rygel_content_directory_query_sort_capabilities_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                    const gchar* variable,
                                                                                    GValue* value,
                                                                                    gpointer self);
static void rygel_content_directory_get_feature_list_cb (RygelContentDirectory* self,
                                                  GUPnPService* content_dir,
                                                  GUPnPServiceAction* action);
static void _rygel_content_directory_get_feature_list_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                GUPnPServiceAction* action,
                                                                                gpointer self);
static void rygel_content_directory_query_feature_list (RygelContentDirectory* self,
                                                 GUPnPService* content_dir,
                                                 const gchar* variable,
                                                 GValue* value);
static void _rygel_content_directory_query_feature_list_gupnp_service_query_variable (GUPnPService* _sender,
                                                                               const gchar* variable,
                                                                               GValue* value,
                                                                               gpointer self);
static void rygel_content_directory_query_last_change (RygelContentDirectory* self,
                                                GUPnPService* content_dir,
                                                const gchar* variable,
                                                GValue* value);
static void _rygel_content_directory_query_last_change_gupnp_service_query_variable (GUPnPService* _sender,
                                                                              const gchar* variable,
                                                                              GValue* value,
                                                                              gpointer self);
static void rygel_content_directory_query_service_reset_token (RygelContentDirectory* self,
                                                        GUPnPService* content_dir,
                                                        const gchar* variable,
                                                        GValue* value);
static void _rygel_content_directory_query_service_reset_token_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                      const gchar* variable,
                                                                                      GValue* value,
                                                                                      gpointer self);
static void rygel_content_directory_get_service_reset_token_cb (RygelContentDirectory* self,
                                                         GUPnPService* content_dir,
                                                         GUPnPServiceAction* action);
static void _rygel_content_directory_get_service_reset_token_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                       GUPnPServiceAction* action,
                                                                                       gpointer self);
VALA_EXTERN GType rygel_media_query_action_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_browse_get_type (void) G_GNUC_CONST ;
static GUPnPServiceAction* _vala_GUPnPServiceAction_copy (GUPnPServiceAction* self);
VALA_EXTERN RygelBrowse* rygel_browse_new (RygelContentDirectory* content_dir,
                               GUPnPServiceAction* action);
VALA_EXTERN RygelBrowse* rygel_browse_construct (GType object_type,
                                     RygelContentDirectory* content_dir,
                                     GUPnPServiceAction* action);
VALA_EXTERN GType rygel_search_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelSearch* rygel_search_new (RygelContentDirectory* content_dir,
                               GUPnPServiceAction* action);
VALA_EXTERN RygelSearch* rygel_search_construct (GType object_type,
                                     RygelContentDirectory* content_dir,
                                     GUPnPServiceAction* action);
VALA_EXTERN GType rygel_object_creator_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelObjectCreator* rygel_object_creator_new (RygelContentDirectory* content_dir,
                                              GUPnPServiceAction* action);
VALA_EXTERN RygelObjectCreator* rygel_object_creator_construct (GType object_type,
                                                    RygelContentDirectory* content_dir,
                                                    GUPnPServiceAction* action);
VALA_EXTERN GType rygel_reference_creator_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelReferenceCreator* rygel_reference_creator_new (RygelContentDirectory* content_dir,
                                                    GUPnPServiceAction* action);
VALA_EXTERN RygelReferenceCreator* rygel_reference_creator_construct (GType object_type,
                                                          RygelContentDirectory* content_dir,
                                                          GUPnPServiceAction* action);
VALA_EXTERN GType rygel_item_destroyer_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelItemDestroyer* rygel_item_destroyer_new (RygelContentDirectory* content_dir,
                                              GUPnPServiceAction* action);
VALA_EXTERN RygelItemDestroyer* rygel_item_destroyer_construct (GType object_type,
                                                    RygelContentDirectory* content_dir,
                                                    GUPnPServiceAction* action);
VALA_EXTERN GType rygel_item_updater_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelItemUpdater* rygel_item_updater_new (RygelContentDirectory* content_dir,
                                          GUPnPServiceAction* action);
VALA_EXTERN RygelItemUpdater* rygel_item_updater_construct (GType object_type,
                                                RygelContentDirectory* content_dir,
                                                GUPnPServiceAction* action);
VALA_EXTERN RygelImportResource* rygel_import_resource_new (RygelContentDirectory* content_dir,
                                                GUPnPServiceAction* action);
VALA_EXTERN RygelImportResource* rygel_import_resource_construct (GType object_type,
                                                      RygelContentDirectory* content_dir,
                                                      GUPnPServiceAction* action);
static void rygel_content_directory_on_import_completed (RygelContentDirectory* self,
                                                  RygelStateMachine* machine);
static void _rygel_content_directory_on_import_completed_rygel_state_machine_completed (RygelStateMachine* _sender,
                                                                                 gpointer self);
static gchar* rygel_content_directory_create_transfer_ids (RygelContentDirectory* self);
static RygelImportResource* rygel_content_directory_find_import_for_action (RygelContentDirectory* self,
                                                                     GUPnPServiceAction* action,
                                                                     GError** error);
VALA_EXTERN const gchar* rygel_import_resource_get_status_as_string (RygelImportResource* self);
VALA_EXTERN GType rygel_transfer_status_get_type (void) G_GNUC_CONST ;
static gchar* rygel_content_directory_create_container_update_ids (RygelContentDirectory* self);
static gboolean rygel_content_directory_handle_system_update (RygelContentDirectory* self);
static void rygel_content_directory_service_reset (RygelContentDirectory* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void rygel_content_directory_service_reset_finish (RygelContentDirectory* self,
                                                   GAsyncResult* _res_);
static void rygel_content_directory_handle_last_change (RygelContentDirectory* self,
                                                 RygelMediaContainer* updated_container,
                                                 RygelMediaObject* object,
                                                 RygelObjectEventType event_type,
                                                 gboolean sub_tree_update);
static void rygel_content_directory_add_last_change_entry (RygelContentDirectory* self,
                                                    RygelMediaObject* object,
                                                    RygelObjectEventType event_type,
                                                    gboolean sub_tree_update);
static gboolean rygel_content_directory_set_update_ids (RygelContentDirectory* self,
                                                 RygelMediaContainer* updated_container,
                                                 RygelMediaObject* object,
                                                 RygelObjectEventType event_type);
static void rygel_content_directory_handle_container_update_ids (RygelContentDirectory* self,
                                                          RygelMediaContainer* updated_container,
                                                          RygelMediaObject* object);
static void rygel_content_directory_ensure_timeout (RygelContentDirectory* self);
VALA_EXTERN GType rygel_last_change_entry_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_last_change_st_done_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelLastChangeStDone* rygel_last_change_st_done_new (const gchar* id,
                                                      guint update_id);
VALA_EXTERN RygelLastChangeStDone* rygel_last_change_st_done_construct (GType object_type,
                                                            const gchar* id,
                                                            guint update_id);
VALA_EXTERN void rygel_last_change_add_event (RygelLastChange* self,
                                  RygelLastChangeEntry* entry);
static gboolean rygel_content_directory_update_notify (RygelContentDirectory* self);
VALA_EXTERN gchar* rygel_last_change_get_log (RygelLastChange* self);
VALA_EXTERN void rygel_last_change_clear_on_new_event (RygelLastChange* self);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static gboolean __lambda11_ (Block5Data* _data5_);
static gboolean ___lambda11__gsource_func (gpointer self);
static gboolean _rygel_content_directory_update_notify_gsource_func (gpointer self);
VALA_EXTERN RygelLastChangeObjAdd* rygel_last_change_obj_add_new (const gchar* id,
                                                      guint update_id,
                                                      gboolean sub_tree_update,
                                                      const gchar* parent_id,
                                                      const gchar* upnp_class);
VALA_EXTERN RygelLastChangeObjAdd* rygel_last_change_obj_add_construct (GType object_type,
                                                            const gchar* id,
                                                            guint update_id,
                                                            gboolean sub_tree_update,
                                                            const gchar* parent_id,
                                                            const gchar* upnp_class);
VALA_EXTERN GType rygel_last_change_obj_add_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelLastChangeObjMod* rygel_last_change_obj_mod_new (const gchar* id,
                                                      guint update_id,
                                                      gboolean sub_tree_update);
VALA_EXTERN RygelLastChangeObjMod* rygel_last_change_obj_mod_construct (GType object_type,
                                                            const gchar* id,
                                                            guint update_id,
                                                            gboolean sub_tree_update);
VALA_EXTERN GType rygel_last_change_obj_mod_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelLastChangeObjDel* rygel_last_change_obj_del_new (const gchar* id,
                                                      guint update_id,
                                                      gboolean sub_tree_update);
VALA_EXTERN RygelLastChangeObjDel* rygel_last_change_obj_del_construct (GType object_type,
                                                            const gchar* id,
                                                            guint update_id,
                                                            gboolean sub_tree_update);
VALA_EXTERN GType rygel_last_change_obj_del_get_type (void) G_GNUC_CONST ;
static void rygel_content_directory_service_reset_data_free (gpointer _data);
static gboolean rygel_content_directory_service_reset_co (RygelContentDirectoryServiceResetData* _data_);
static void rygel_content_directory_service_reset_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void rygel_content_directory_finalize (GObject * obj);
static GType rygel_content_directory_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GQuark
rygel_content_directory_error_quark (void)
{
	return g_quark_from_static_string ("rygel-content-directory-error-quark");
}

 G_GNUC_NO_INLINE static GType
rygel_content_directory_error_get_type_once (void)
{
	static const GEnumValue values[] = {{RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_OBJECT, "RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_OBJECT", "no-such-object"}, {RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_CURRENT_TAG_VALUE, "RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_CURRENT_TAG_VALUE", "invalid-current-tag-value"}, {RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_NEW_TAG_VALUE, "RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_NEW_TAG_VALUE", "invalid-new-tag-value"}, {RYGEL_CONTENT_DIRECTORY_ERROR_REQUIRED_TAG, "RYGEL_CONTENT_DIRECTORY_ERROR_REQUIRED_TAG", "required-tag"}, {RYGEL_CONTENT_DIRECTORY_ERROR_READ_ONLY_TAG, "RYGEL_CONTENT_DIRECTORY_ERROR_READ_ONLY_TAG", "read-only-tag"}, {RYGEL_CONTENT_DIRECTORY_ERROR_PARAMETER_MISMATCH, "RYGEL_CONTENT_DIRECTORY_ERROR_PARAMETER_MISMATCH", "parameter-mismatch"}, {RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SEARCH_CRITERIA, "RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SEARCH_CRITERIA", "invalid-search-criteria"}, {RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SORT_CRITERIA, "RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_SORT_CRITERIA", "invalid-sort-criteria"}, {RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_CONTAINER, "RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_CONTAINER", "no-such-container"}, {RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_OBJECT, "RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_OBJECT", "restricted-object"}, {RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, "RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA", "bad-metadata"}, {RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT, "RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT", "restricted-parent"}, {RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_FILE_TRANSFER, "RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_FILE_TRANSFER", "no-such-file-transfer"}, {RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_DESTINATION_RESOURCE, "RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_DESTINATION_RESOURCE", "no-such-destination-resource"}, {RYGEL_CONTENT_DIRECTORY_ERROR_CANT_PROCESS, "RYGEL_CONTENT_DIRECTORY_ERROR_CANT_PROCESS", "cant-process"}, {RYGEL_CONTENT_DIRECTORY_ERROR_OUTDATED_OBJECT_METADATA, "RYGEL_CONTENT_DIRECTORY_ERROR_OUTDATED_OBJECT_METADATA", "outdated-object-metadata"}, {RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS, "RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS", "invalid-args"}, {0, NULL, NULL}};
	GType rygel_content_directory_error_type_id;
	rygel_content_directory_error_type_id = g_enum_register_static ("RygelContentDirectoryError", values);
	return rygel_content_directory_error_type_id;
}

GType
rygel_content_directory_error_get_type (void)
{
	static volatile gsize rygel_content_directory_error_type_id__once = 0;
	if (g_once_init_enter (&rygel_content_directory_error_type_id__once)) {
		GType rygel_content_directory_error_type_id;
		rygel_content_directory_error_type_id = rygel_content_directory_error_get_type_once ();
		g_once_init_leave (&rygel_content_directory_error_type_id__once, rygel_content_directory_error_type_id);
	}
	return rygel_content_directory_error_type_id__once;
}

static inline gpointer
rygel_content_directory_get_instance_private (RygelContentDirectory* self)
{
	return G_STRUCT_MEMBER_P (self, RygelContentDirectory_private_offset);
}

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

static gboolean
_rygel_media_container_equal_func_gee_equal_data_func (gconstpointer a,
                                                       gconstpointer b,
                                                       gpointer self)
{
	gboolean result;
	result = rygel_media_container_equal_func ((RygelMediaContainer*) a, (RygelMediaContainer*) b);
	return result;
}

static void
_rygel_content_directory_on_container_updated_rygel_media_container_container_updated (RygelMediaContainer* _sender,
                                                                                       RygelMediaContainer* container,
                                                                                       RygelMediaObject* object,
                                                                                       RygelObjectEventType event_type,
                                                                                       gboolean sub_tree_update,
                                                                                       gpointer self)
{
	rygel_content_directory_on_container_updated ((RygelContentDirectory*) self, _sender, container, object, event_type, sub_tree_update);
}

static void
_rygel_content_directory_on_sub_tree_updates_finished_rygel_media_container_sub_tree_updates_finished (RygelMediaContainer* _sender,
                                                                                                       RygelMediaObject* sub_tree_root,
                                                                                                       gpointer self)
{
	rygel_content_directory_on_sub_tree_updates_finished ((RygelContentDirectory*) self, _sender, sub_tree_root);
}

static void
_rygel_content_directory_browse_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                 GUPnPServiceAction* action,
                                                                 gpointer self)
{
	rygel_content_directory_browse_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_search_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                 GUPnPServiceAction* action,
                                                                 gpointer self)
{
	rygel_content_directory_search_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_create_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                        GUPnPServiceAction* action,
                                                                        gpointer self)
{
	rygel_content_directory_create_object_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_create_reference_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                           GUPnPServiceAction* action,
                                                                           gpointer self)
{
	rygel_content_directory_create_reference_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_destroy_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                         GUPnPServiceAction* action,
                                                                         gpointer self)
{
	rygel_content_directory_destroy_object_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_update_object_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                        GUPnPServiceAction* action,
                                                                        gpointer self)
{
	rygel_content_directory_update_object_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_import_resource_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                          GUPnPServiceAction* action,
                                                                          gpointer self)
{
	rygel_content_directory_import_resource_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_get_transfer_progress_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                GUPnPServiceAction* action,
                                                                                gpointer self)
{
	rygel_content_directory_get_transfer_progress_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_stop_transfer_resource_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                 GUPnPServiceAction* action,
                                                                                 gpointer self)
{
	rygel_content_directory_stop_transfer_resource_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_get_dlna_upload_profiles_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                   GUPnPServiceAction* action,
                                                                                   gpointer self)
{
	rygel_content_directory_get_dlna_upload_profiles_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_query_transfer_ids_gupnp_service_query_variable (GUPnPService* _sender,
                                                                          const gchar* variable,
                                                                          GValue* value,
                                                                          gpointer self)
{
	rygel_content_directory_query_transfer_ids ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_get_system_update_id_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                               GUPnPServiceAction* action,
                                                                               gpointer self)
{
	rygel_content_directory_get_system_update_id_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_query_system_update_id_gupnp_service_query_variable (GUPnPService* _sender,
                                                                              const gchar* variable,
                                                                              GValue* value,
                                                                              gpointer self)
{
	rygel_content_directory_query_system_update_id ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_query_container_update_ids_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                  const gchar* variable,
                                                                                  GValue* value,
                                                                                  gpointer self)
{
	rygel_content_directory_query_container_update_ids ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_get_search_capabilities_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                  GUPnPServiceAction* action,
                                                                                  gpointer self)
{
	rygel_content_directory_get_search_capabilities_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_query_search_capabilities_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                 const gchar* variable,
                                                                                 GValue* value,
                                                                                 gpointer self)
{
	rygel_content_directory_query_search_capabilities ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_get_sort_capabilities_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                GUPnPServiceAction* action,
                                                                                gpointer self)
{
	rygel_content_directory_get_sort_capabilities_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_query_sort_capabilities_gupnp_service_query_variable (GUPnPService* _sender,
                                                                               const gchar* variable,
                                                                               GValue* value,
                                                                               gpointer self)
{
	rygel_content_directory_query_sort_capabilities ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_get_feature_list_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                           GUPnPServiceAction* action,
                                                                           gpointer self)
{
	rygel_content_directory_get_feature_list_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
_rygel_content_directory_query_feature_list_gupnp_service_query_variable (GUPnPService* _sender,
                                                                          const gchar* variable,
                                                                          GValue* value,
                                                                          gpointer self)
{
	rygel_content_directory_query_feature_list ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_query_last_change_gupnp_service_query_variable (GUPnPService* _sender,
                                                                         const gchar* variable,
                                                                         GValue* value,
                                                                         gpointer self)
{
	rygel_content_directory_query_last_change ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_query_service_reset_token_gupnp_service_query_variable (GUPnPService* _sender,
                                                                                 const gchar* variable,
                                                                                 GValue* value,
                                                                                 gpointer self)
{
	rygel_content_directory_query_service_reset_token ((RygelContentDirectory*) self, _sender, variable, value);
}

static void
_rygel_content_directory_get_service_reset_token_cb_gupnp_service_action_invoked (GUPnPService* _sender,
                                                                                  GUPnPServiceAction* action,
                                                                                  gpointer self)
{
	rygel_content_directory_get_service_reset_token_cb ((RygelContentDirectory*) self, _sender, action);
}

static void
rygel_content_directory_real_constructed (GObject* base)
{
	RygelContentDirectory * self;
	GCancellable* _tmp0_;
	RygelMediaServerPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPRootDevice* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	GUPnPResourceFactory* _tmp5_;
	RygelMediaServerPlugin* _tmp6_;
	RygelMediaServerPlugin* _tmp7_;
	RygelMediaServerPlugin* _tmp8_;
	RygelMediaContainer* _tmp9_;
	RygelMediaContainer* _tmp10_;
	RygelMediaContainer* _tmp11_;
	RygelMediaServerPlugin* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	RygelHTTPServer* _tmp15_;
	GeeArrayList* _tmp16_;
	GeeArrayList* _tmp17_;
	GeeArrayList* _tmp18_;
	RygelMediaContainer* _tmp19_;
	RygelMediaContainer* _tmp26_;
	RygelMediaContainer* _tmp27_;
	RygelLastChange* _tmp28_;
	gchar* _tmp29_;
	RygelHTTPServer* _tmp30_;
	self = (RygelContentDirectory*) base;
	G_OBJECT_CLASS (rygel_content_directory_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gupnp_service_get_type (), GUPnPService));
	_tmp0_ = g_cancellable_new ();
	_g_object_unref0 (self->cancellable);
	self->cancellable = _tmp0_;
	g_object_get ((GUPnPService*) self, "root-device", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_tmp5_) ? ((RygelMediaServerPlugin*) _tmp5_) : NULL);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp3_);
	plugin = _tmp7_;
	_tmp8_ = plugin;
	_tmp9_ = rygel_media_server_plugin_get_root_container (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	_g_object_unref0 (self->root_container);
	self->root_container = _tmp11_;
	_tmp12_ = plugin;
	_tmp13_ = rygel_plugin_get_name ((RygelPlugin*) _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = rygel_http_server_new (self, _tmp14_);
	_g_object_unref0 (self->http_server);
	self->http_server = _tmp15_;
	_tmp16_ = gee_array_list_new (RYGEL_TYPE_MEDIA_CONTAINER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _rygel_media_container_equal_func_gee_equal_data_func, NULL, NULL);
	_g_object_unref0 (self->priv->updated_containers);
	self->priv->updated_containers = _tmp16_;
	_tmp17_ = gee_array_list_new (RYGEL_TYPE_IMPORT_RESOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->active_imports);
	self->priv->active_imports = _tmp17_;
	_tmp18_ = gee_array_list_new (RYGEL_TYPE_IMPORT_RESOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->finished_imports);
	self->priv->finished_imports = _tmp18_;
	_tmp19_ = self->root_container;
	if (RYGEL_IS_TRACKABLE_CONTAINER (_tmp19_)) {
		RygelTrackableContainer* trackable = NULL;
		RygelMediaContainer* _tmp20_;
		RygelTrackableContainer* _tmp21_;
		RygelTrackableContainer* _tmp22_;
		gchar* _tmp23_;
		RygelTrackableContainer* _tmp24_;
		_tmp20_ = self->root_container;
		_tmp21_ = _g_object_ref0 (RYGEL_IS_TRACKABLE_CONTAINER (_tmp20_) ? ((RygelTrackableContainer*) _tmp20_) : NULL);
		trackable = _tmp21_;
		_tmp22_ = trackable;
		_tmp23_ = rygel_trackable_container_get_service_reset_token (_tmp22_);
		_g_free0 (self->priv->service_reset_token);
		self->priv->service_reset_token = _tmp23_;
		_tmp24_ = trackable;
		self->system_update_id = rygel_trackable_container_get_system_update_id (_tmp24_);
		_g_object_unref0 (trackable);
	} else {
		gchar* _tmp25_;
		_tmp25_ = g_uuid_string_random ();
		_g_free0 (self->priv->service_reset_token);
		self->priv->service_reset_token = _tmp25_;
		self->system_update_id = (guint32) 0;
	}
	_tmp26_ = self->root_container;
	g_signal_connect_object (_tmp26_, "container-updated", (GCallback) _rygel_content_directory_on_container_updated_rygel_media_container_container_updated, self, 0);
	_tmp27_ = self->root_container;
	g_signal_connect_object (_tmp27_, "sub-tree-updates-finished", (GCallback) _rygel_content_directory_on_sub_tree_updates_finished_rygel_media_container_sub_tree_updates_finished, self, 0);
	_tmp28_ = rygel_last_change_new ();
	_g_object_unref0 (self->priv->last_change);
	self->priv->last_change = _tmp28_;
	_tmp29_ = g_strdup ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" "<Features xmlns=\"urn:schemas-upnp-org:av:avs\" " "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "xsi:schemaLocation=\"urn:schemas-upnp-org:av:avs" "http://www.upnp.org/schemas/av/avs-v1-20060531.xsd\">" "</Features>");
	_g_free0 (self->feature_list);
	self->feature_list = _tmp29_;
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::Browse", (GCallback) _rygel_content_directory_browse_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::Search", (GCallback) _rygel_content_directory_search_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::CreateObject", (GCallback) _rygel_content_directory_create_object_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::CreateReference", (GCallback) _rygel_content_directory_create_reference_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::DestroyObject", (GCallback) _rygel_content_directory_destroy_object_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::UpdateObject", (GCallback) _rygel_content_directory_update_object_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::ImportResource", (GCallback) _rygel_content_directory_import_resource_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetTransferProgress", (GCallback) _rygel_content_directory_get_transfer_progress_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::StopTransferResource", (GCallback) _rygel_content_directory_stop_transfer_resource_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::X_GetDLNAUploadProfiles", (GCallback) _rygel_content_directory_get_dlna_upload_profiles_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::TransferIDs", (GCallback) _rygel_content_directory_query_transfer_ids_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetSystemUpdateID", (GCallback) _rygel_content_directory_get_system_update_id_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::SystemUpdateID", (GCallback) _rygel_content_directory_query_system_update_id_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::ContainerUpdateIDs", (GCallback) _rygel_content_directory_query_container_update_ids_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetSearchCapabilities", (GCallback) _rygel_content_directory_get_search_capabilities_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::SearchCapabilities", (GCallback) _rygel_content_directory_query_search_capabilities_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetSortCapabilities", (GCallback) _rygel_content_directory_get_sort_capabilities_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::SortCapabilities", (GCallback) _rygel_content_directory_query_sort_capabilities_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetFeatureList", (GCallback) _rygel_content_directory_get_feature_list_cb_gupnp_service_action_invoked, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::FeatureList", (GCallback) _rygel_content_directory_query_feature_list_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::LastChange", (GCallback) _rygel_content_directory_query_last_change_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "query-variable::ServiceResetToken", (GCallback) _rygel_content_directory_query_service_reset_token_gupnp_service_query_variable, self, 0);
	g_signal_connect_object ((GUPnPService*) self, "action-invoked::GetServiceResetToken", (GCallback) _rygel_content_directory_get_service_reset_token_cb_gupnp_service_action_invoked, self, 0);
	_tmp30_ = self->http_server;
	rygel_state_machine_run ((RygelStateMachine*) _tmp30_, NULL, NULL);
	_g_object_unref0 (plugin);
}

static GUPnPServiceAction*
_vala_GUPnPServiceAction_copy (GUPnPServiceAction* self)
{
	return g_boxed_copy (gupnp_service_action_get_type (), self);
}

static gpointer
__vala_GUPnPServiceAction_copy0 (gpointer self)
{
	return self ? _vala_GUPnPServiceAction_copy (self) : NULL;
}

static void
rygel_content_directory_browse_cb (RygelContentDirectory* self,
                                   GUPnPService* content_dir,
                                   GUPnPServiceAction* action)
{
	RygelBrowse* browse = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelBrowse* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_browse_new (self, _tmp0_);
	browse = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) browse, NULL, NULL);
	_g_object_unref0 (browse);
}

static void
rygel_content_directory_search_cb (RygelContentDirectory* self,
                                   GUPnPService* content_dir,
                                   GUPnPServiceAction* action)
{
	RygelSearch* search = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelSearch* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_search_new (self, _tmp0_);
	search = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) search, NULL, NULL);
	_g_object_unref0 (search);
}

static void
rygel_content_directory_create_object_cb (RygelContentDirectory* self,
                                          GUPnPService* content_dir,
                                          GUPnPServiceAction* action)
{
	RygelObjectCreator* creator = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelObjectCreator* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_object_creator_new (self, _tmp0_);
	creator = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) creator, NULL, NULL);
	_g_object_unref0 (creator);
}

static void
rygel_content_directory_create_reference_cb (RygelContentDirectory* self,
                                             GUPnPService* content_dir,
                                             GUPnPServiceAction* action)
{
	RygelReferenceCreator* creator = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelReferenceCreator* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_reference_creator_new (self, _tmp0_);
	creator = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) creator, NULL, NULL);
	_g_object_unref0 (creator);
}

static void
rygel_content_directory_destroy_object_cb (RygelContentDirectory* self,
                                           GUPnPService* content_dir,
                                           GUPnPServiceAction* action)
{
	RygelItemDestroyer* destroyer = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelItemDestroyer* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_item_destroyer_new (self, _tmp0_);
	destroyer = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) destroyer, NULL, NULL);
	_g_object_unref0 (destroyer);
}

static void
rygel_content_directory_update_object_cb (RygelContentDirectory* self,
                                          GUPnPService* content_dir,
                                          GUPnPServiceAction* action)
{
	RygelItemUpdater* updater = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelItemUpdater* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_item_updater_new (self, _tmp0_);
	updater = _tmp1_;
	rygel_state_machine_run ((RygelStateMachine*) updater, NULL, NULL);
	_g_object_unref0 (updater);
}

static void
_rygel_content_directory_on_import_completed_rygel_state_machine_completed (RygelStateMachine* _sender,
                                                                            gpointer self)
{
	rygel_content_directory_on_import_completed ((RygelContentDirectory*) self, _sender);
}

static void
rygel_content_directory_import_resource_cb (RygelContentDirectory* self,
                                            GUPnPService* content_dir,
                                            GUPnPServiceAction* action)
{
	RygelImportResource* import = NULL;
	GUPnPServiceAction* _tmp0_;
	RygelImportResource* _tmp1_;
	GeeArrayList* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = __vala_GUPnPServiceAction_copy0 (action);
	_tmp1_ = rygel_import_resource_new (self, _tmp0_);
	import = _tmp1_;
	g_signal_connect_object ((RygelStateMachine*) import, "completed", (GCallback) _rygel_content_directory_on_import_completed_rygel_state_machine_completed, self, 0);
	_tmp2_ = self->priv->active_imports;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, import);
	rygel_state_machine_run ((RygelStateMachine*) import, NULL, NULL);
	_tmp3_ = rygel_content_directory_create_transfer_ids (self);
	_tmp4_ = _tmp3_;
	gupnp_service_notify ((GUPnPService*) self, "TransferIDs", G_TYPE_STRING, _tmp4_, NULL);
	_g_free0 (_tmp4_);
	_g_object_unref0 (import);
}

static void
rygel_content_directory_query_transfer_ids (RygelContentDirectory* self,
                                            GUPnPService* content_dir,
                                            const gchar* variable,
                                            GValue* value)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_STRING);
	_tmp0_ = rygel_content_directory_create_transfer_ids (self);
	_tmp1_ = _tmp0_;
	g_value_set_string (value, _tmp1_);
	_g_free0 (_tmp1_);
}

static void
rygel_content_directory_get_transfer_progress_cb (RygelContentDirectory* self,
                                                  GUPnPService* content_dir,
                                                  GUPnPServiceAction* action)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 1)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	{
		RygelImportResource* import = NULL;
		RygelImportResource* _tmp0_;
		RygelImportResource* _tmp1_;
		const gchar* _tmp2_;
		const gchar* _tmp3_;
		RygelImportResource* _tmp4_;
		RygelImportResource* _tmp5_;
		_tmp0_ = rygel_content_directory_find_import_for_action (self, action, &_inner_error0_);
		import = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = import;
		_tmp2_ = rygel_import_resource_get_status_as_string (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = import;
		_tmp5_ = import;
		gupnp_service_action_set (action, "TransferStatus", G_TYPE_STRING, _tmp3_, "TransferLength", G_TYPE_INT64, _tmp4_->bytes_copied, "TransferTotal", G_TYPE_INT64, _tmp5_->bytes_total, NULL);
		gupnp_service_action_return_success (action);
		_g_object_unref0 (import);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = _error_;
		_tmp7_ = _error_;
		_tmp8_ = _tmp7_->message;
		gupnp_service_action_return_error (action, (guint) _tmp6_->code, _tmp8_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
rygel_content_directory_stop_transfer_resource_cb (RygelContentDirectory* self,
                                                   GUPnPService* content_dir,
                                                   GUPnPServiceAction* action)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 1)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	{
		RygelImportResource* import = NULL;
		RygelImportResource* _tmp0_;
		RygelImportResource* _tmp1_;
		GCancellable* _tmp2_;
		GCancellable* _tmp3_;
		_tmp0_ = rygel_content_directory_find_import_for_action (self, action, &_inner_error0_);
		import = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp1_ = import;
		_tmp2_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _tmp1_);
		_tmp3_ = _tmp2_;
		g_cancellable_cancel (_tmp3_);
		gupnp_service_action_return_success (action);
		_g_object_unref0 (import);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp4_;
		GError* _tmp5_;
		const gchar* _tmp6_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = _error_;
		_tmp5_ = _error_;
		_tmp6_ = _tmp5_->message;
		gupnp_service_action_return_error (action, (guint) _tmp4_->code, _tmp6_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
rygel_content_directory_get_system_update_id_cb (RygelContentDirectory* self,
                                                 GUPnPService* content_dir,
                                                 GUPnPServiceAction* action)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 0)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	gupnp_service_action_set (action, "Id", G_TYPE_UINT, self->system_update_id, NULL);
	gupnp_service_action_return_success (action);
}

static void
rygel_content_directory_query_system_update_id (RygelContentDirectory* self,
                                                GUPnPService* content_dir,
                                                const gchar* variable,
                                                GValue* value)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_UINT);
	g_value_set_uint (value, (guint) self->system_update_id);
}

static void
rygel_content_directory_query_container_update_ids (RygelContentDirectory* self,
                                                    GUPnPService* content_dir,
                                                    const gchar* variable,
                                                    GValue* value)
{
	gchar* update_ids = NULL;
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = rygel_content_directory_create_container_update_ids (self);
	update_ids = _tmp0_;
	g_value_init (value, G_TYPE_STRING);
	g_value_set_string (value, update_ids);
	_g_free0 (update_ids);
}

static void
rygel_content_directory_get_search_capabilities_cb (RygelContentDirectory* self,
                                                    GUPnPService* content_dir,
                                                    GUPnPServiceAction* action)
{
	RygelMediaServerPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp0_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPResourceFactory* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	RygelMediaServerPlugin* _tmp5_;
	RygelMediaServerPlugin* _tmp6_;
	RygelMediaServerPlugin* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 0)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_tmp4_) ? ((RygelMediaServerPlugin*) _tmp4_) : NULL);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp2_);
	plugin = _tmp6_;
	_tmp7_ = plugin;
	_tmp8_ = rygel_media_server_plugin_get_search_caps (_tmp7_);
	_tmp9_ = _tmp8_;
	gupnp_service_action_set (action, "SearchCaps", G_TYPE_STRING, _tmp9_, NULL);
	gupnp_service_action_return_success (action);
	_g_object_unref0 (plugin);
}

static void
rygel_content_directory_query_search_capabilities (RygelContentDirectory* self,
                                                   GUPnPService* content_dir,
                                                   const gchar* variable,
                                                   GValue* value)
{
	RygelMediaServerPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp0_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPResourceFactory* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	RygelMediaServerPlugin* _tmp5_;
	RygelMediaServerPlugin* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_tmp4_) ? ((RygelMediaServerPlugin*) _tmp4_) : NULL);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp2_);
	plugin = _tmp6_;
	g_value_init (value, G_TYPE_STRING);
	_tmp7_ = rygel_media_server_plugin_get_search_caps (plugin);
	_tmp8_ = _tmp7_;
	g_value_set_string (value, _tmp8_);
	_g_object_unref0 (plugin);
}

static void
rygel_content_directory_get_sort_capabilities_cb (RygelContentDirectory* self,
                                                  GUPnPService* content_dir,
                                                  GUPnPServiceAction* action)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 0)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	gupnp_service_action_set (action, "SortCaps", G_TYPE_STRING, RYGEL_MEDIA_OBJECTS_SORT_CAPS, NULL);
	gupnp_service_action_return_success (action);
}

static void
rygel_content_directory_query_sort_capabilities (RygelContentDirectory* self,
                                                 GUPnPService* content_dir,
                                                 const gchar* variable,
                                                 GValue* value)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_STRING);
	g_value_set_string (value, RYGEL_MEDIA_OBJECTS_SORT_CAPS);
}

static void
rygel_content_directory_get_feature_list_cb (RygelContentDirectory* self,
                                             GUPnPService* content_dir,
                                             GUPnPServiceAction* action)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	if (gupnp_service_action_get_argument_count (action) != ((guint) 0)) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		return;
	}
	_tmp0_ = self->feature_list;
	gupnp_service_action_set (action, "FeatureList", G_TYPE_STRING, _tmp0_, NULL);
	gupnp_service_action_return_success (action);
}

static void
rygel_content_directory_query_feature_list (RygelContentDirectory* self,
                                            GUPnPService* content_dir,
                                            const gchar* variable,
                                            GValue* value)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_STRING);
	_tmp0_ = self->feature_list;
	g_value_set_string (value, _tmp0_);
}

static gchar*
rygel_content_directory_create_container_update_ids (RygelContentDirectory* self)
{
	gchar* update_ids = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	update_ids = _tmp0_;
	{
		GeeArrayList* _container_list = NULL;
		GeeArrayList* _tmp1_;
		gint _container_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _container_index = 0;
		_tmp1_ = self->priv->updated_containers;
		_container_list = _tmp1_;
		_tmp2_ = _container_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_container_size = _tmp4_;
		_container_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			RygelMediaContainer* container = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp12_;
			RygelMediaContainer* _tmp13_;
			const gchar* _tmp14_;
			const gchar* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			RygelMediaContainer* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			gchar* _tmp23_;
			_container_index = _container_index + 1;
			_tmp5_ = _container_index;
			_tmp6_ = _container_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _container_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _container_index);
			container = (RygelMediaContainer*) _tmp8_;
			_tmp9_ = update_ids;
			if (g_strcmp0 (_tmp9_, "") != 0) {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				_tmp10_ = update_ids;
				_tmp11_ = g_strconcat (_tmp10_, ",", NULL);
				_g_free0 (update_ids);
				update_ids = _tmp11_;
			}
			_tmp12_ = update_ids;
			_tmp13_ = container;
			_tmp14_ = rygel_media_object_get_id ((RygelMediaObject*) _tmp13_);
			_tmp15_ = _tmp14_;
			_tmp16_ = g_strconcat (_tmp15_, ",", NULL);
			_tmp17_ = _tmp16_;
			_tmp18_ = container;
			_tmp19_ = g_strdup_printf ("%u", _tmp18_->update_id);
			_tmp20_ = _tmp19_;
			_tmp21_ = g_strconcat (_tmp17_, _tmp20_, NULL);
			_tmp22_ = _tmp21_;
			_tmp23_ = g_strconcat (_tmp12_, _tmp22_, NULL);
			_g_free0 (update_ids);
			update_ids = _tmp23_;
			_g_free0 (_tmp22_);
			_g_free0 (_tmp20_);
			_g_free0 (_tmp17_);
			_g_object_unref0 (container);
		}
	}
	result = update_ids;
	return result;
}

static gboolean
rygel_content_directory_handle_system_update (RygelContentDirectory* self)
{
	RygelMediaServerPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp0_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPResourceFactory* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	RygelMediaServerPlugin* _tmp5_;
	RygelMediaServerPlugin* _tmp6_;
	guint32 _tmp7_;
	gboolean _tmp8_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_tmp4_) ? ((RygelMediaServerPlugin*) _tmp4_) : NULL);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp2_);
	plugin = _tmp6_;
	_tmp7_ = self->system_update_id;
	self->system_update_id = _tmp7_ + 1;
	if (self->system_update_id == ((guint32) 0)) {
		RygelMediaServerPlugin* _tmp9_;
		RygelPluginCapabilities _tmp10_;
		RygelPluginCapabilities _tmp11_;
		_tmp9_ = plugin;
		_tmp10_ = rygel_plugin_get_capabilities ((RygelPlugin*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp8_ = (_tmp11_ & RYGEL_PLUGIN_CAPABILITIES_TRACK_CHANGES) == RYGEL_PLUGIN_CAPABILITIES_TRACK_CHANGES;
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		rygel_content_directory_service_reset (self, NULL, NULL);
		result = TRUE;
		_g_object_unref0 (plugin);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (plugin);
	return result;
}

static void
rygel_content_directory_handle_last_change (RygelContentDirectory* self,
                                            RygelMediaContainer* updated_container,
                                            RygelMediaObject* object,
                                            RygelObjectEventType event_type,
                                            gboolean sub_tree_update)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (updated_container != NULL);
	g_return_if_fail (object != NULL);
	if (RYGEL_IS_TRACKABLE_CONTAINER (updated_container)) {
		rygel_content_directory_add_last_change_entry (self, object, event_type, sub_tree_update);
	}
}

static gboolean
rygel_content_directory_set_update_ids (RygelContentDirectory* self,
                                        RygelMediaContainer* updated_container,
                                        RygelMediaObject* object,
                                        RygelObjectEventType event_type)
{
	gboolean container_changed = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	RygelMediaContainer* container = NULL;
	RygelMediaContainer* _tmp3_;
	RygelMediaContainer* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (updated_container != NULL, FALSE);
	g_return_val_if_fail (object != NULL, FALSE);
	container_changed = FALSE;
	if (event_type == RYGEL_OBJECT_EVENT_TYPE_ADDED) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = event_type == RYGEL_OBJECT_EVENT_TYPE_DELETED;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		gboolean _tmp2_ = FALSE;
		if (event_type == RYGEL_OBJECT_EVENT_TYPE_MODIFIED) {
			_tmp2_ = RYGEL_IS_MEDIA_ITEM (object);
		} else {
			_tmp2_ = FALSE;
		}
		_tmp0_ = _tmp2_;
	}
	if (_tmp0_) {
		updated_container->update_id = self->system_update_id;
		container_changed = TRUE;
	}
	rygel_media_object_set_object_update_id (object, (guint) self->system_update_id);
	_tmp3_ = _g_object_ref0 (RYGEL_IS_MEDIA_CONTAINER (object) ? ((RygelMediaContainer*) object) : NULL);
	container = _tmp3_;
	_tmp4_ = container;
	if (_tmp4_ != NULL) {
		RygelMediaContainer* _tmp5_;
		_tmp5_ = container;
		_tmp5_->update_id = self->system_update_id;
	}
	result = container_changed;
	_g_object_unref0 (container);
	return result;
}

static void
rygel_content_directory_handle_container_update_ids (RygelContentDirectory* self,
                                                     RygelMediaContainer* updated_container,
                                                     RygelMediaObject* object)
{
	gboolean updated = FALSE;
	gboolean is_container = FALSE;
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	updated = updated_container != NULL;
	is_container = RYGEL_IS_MEDIA_CONTAINER (object);
	if (!updated) {
		_tmp0_ = !is_container;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	if (self->priv->clear_updated_containers) {
		GeeArrayList* _tmp1_;
		_tmp1_ = self->priv->updated_containers;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp1_);
		self->priv->clear_updated_containers = FALSE;
	}
	if (updated) {
		GeeArrayList* _tmp2_;
		GeeArrayList* _tmp3_;
		_tmp2_ = self->priv->updated_containers;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp2_, updated_container);
		_tmp3_ = self->priv->updated_containers;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, updated_container);
	}
	if (is_container) {
		RygelMediaContainer* container = NULL;
		RygelMediaContainer* _tmp4_;
		GeeArrayList* _tmp5_;
		RygelMediaContainer* _tmp6_;
		GeeArrayList* _tmp7_;
		RygelMediaContainer* _tmp8_;
		_tmp4_ = _g_object_ref0 (RYGEL_IS_MEDIA_CONTAINER (object) ? ((RygelMediaContainer*) object) : NULL);
		container = _tmp4_;
		_tmp5_ = self->priv->updated_containers;
		_tmp6_ = container;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp5_, _tmp6_);
		_tmp7_ = self->priv->updated_containers;
		_tmp8_ = container;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp8_);
		_g_object_unref0 (container);
	}
}

/**
     * handler for container_updated signal on root_container. We don't
     * immediately send the notification for changes but schedule the
     * notification after 0.2 seconds. Also we don't clear the updated
     * container list immediately after notification but rather in this
     * function. Please refer to ContentDirectory version 2 specs for details
     * on why we do all this the way we do.
     *
     * @param root_container the root_container
     * @param updated_container the container that just got updated
     */
static void
rygel_content_directory_on_container_updated (RygelContentDirectory* self,
                                              RygelMediaContainer* root_container,
                                              RygelMediaContainer* updated_container,
                                              RygelMediaObject* object,
                                              RygelObjectEventType event_type,
                                              gboolean sub_tree_update)
{
	gboolean changed = FALSE;
	RygelMediaContainer* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (root_container != NULL);
	g_return_if_fail (updated_container != NULL);
	g_return_if_fail (object != NULL);
	if (rygel_content_directory_handle_system_update (self)) {
		return;
	}
	rygel_content_directory_handle_last_change (self, updated_container, object, event_type, sub_tree_update);
	changed = rygel_content_directory_set_update_ids (self, updated_container, object, event_type);
	if (changed) {
		_tmp0_ = updated_container;
	} else {
		_tmp0_ = NULL;
	}
	rygel_content_directory_handle_container_update_ids (self, _tmp0_, object);
	rygel_content_directory_ensure_timeout (self);
}

static void
rygel_content_directory_on_sub_tree_updates_finished (RygelContentDirectory* self,
                                                      RygelMediaContainer* root_container,
                                                      RygelMediaObject* sub_tree_root)
{
	RygelLastChangeStDone* entry = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	RygelLastChangeStDone* _tmp2_;
	RygelLastChange* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (root_container != NULL);
	g_return_if_fail (sub_tree_root != NULL);
	_tmp0_ = rygel_media_object_get_id (sub_tree_root);
	_tmp1_ = _tmp0_;
	_tmp2_ = rygel_last_change_st_done_new (_tmp1_, (guint) self->system_update_id);
	entry = _tmp2_;
	_tmp3_ = self->priv->last_change;
	rygel_last_change_add_event (_tmp3_, (RygelLastChangeEntry*) entry);
	rygel_content_directory_ensure_timeout (self);
	_g_object_unref0 (entry);
}

static gboolean
rygel_content_directory_update_notify (RygelContentDirectory* self)
{
	gchar* update_ids = NULL;
	gchar* _tmp0_;
	RygelLastChange* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	RygelLastChange* _tmp4_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = rygel_content_directory_create_container_update_ids (self);
	update_ids = _tmp0_;
	gupnp_service_notify ((GUPnPService*) self, "ContainerUpdateIDs", G_TYPE_STRING, update_ids, NULL);
	gupnp_service_notify ((GUPnPService*) self, "SystemUpdateID", G_TYPE_UINT, self->system_update_id, NULL);
	_tmp1_ = self->priv->last_change;
	_tmp2_ = rygel_last_change_get_log (_tmp1_);
	_tmp3_ = _tmp2_;
	gupnp_service_notify ((GUPnPService*) self, "LastChange", G_TYPE_STRING, _tmp3_, NULL);
	_g_free0 (_tmp3_);
	self->priv->clear_updated_containers = TRUE;
	self->priv->update_notify_id = (guint) 0;
	_tmp4_ = self->priv->last_change;
	rygel_last_change_clear_on_new_event (_tmp4_);
	result = FALSE;
	_g_free0 (update_ids);
	return result;
}

static gchar*
rygel_content_directory_create_transfer_ids (RygelContentDirectory* self)
{
	gchar* ids = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup ("");
	ids = _tmp0_;
	{
		GeeArrayList* _import_list = NULL;
		GeeArrayList* _tmp1_;
		gint _import_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _import_index = 0;
		_tmp1_ = self->priv->active_imports;
		_import_list = _tmp1_;
		_tmp2_ = _import_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_import_size = _tmp4_;
		_import_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			RygelImportResource* import = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp12_;
			RygelImportResource* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
			_import_index = _import_index + 1;
			_tmp5_ = _import_index;
			_tmp6_ = _import_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _import_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _import_index);
			import = (RygelImportResource*) _tmp8_;
			_tmp9_ = ids;
			if (g_strcmp0 (_tmp9_, "") != 0) {
				const gchar* _tmp10_;
				gchar* _tmp11_;
				_tmp10_ = ids;
				_tmp11_ = g_strconcat (_tmp10_, ",", NULL);
				_g_free0 (ids);
				ids = _tmp11_;
			}
			_tmp12_ = ids;
			_tmp13_ = import;
			_tmp14_ = g_strdup_printf ("%u", _tmp13_->transfer_id);
			_tmp15_ = _tmp14_;
			_tmp16_ = g_strconcat (_tmp12_, _tmp15_, NULL);
			_g_free0 (ids);
			ids = _tmp16_;
			_g_free0 (_tmp15_);
			_g_object_unref0 (import);
		}
	}
	result = ids;
	return result;
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		RygelContentDirectory* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->import);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static gboolean
__lambda11_ (Block5Data* _data5_)
{
	RygelContentDirectory* self;
	GeeArrayList* _tmp0_;
	gboolean result;
	self = _data5_->self;
	_tmp0_ = self->priv->finished_imports;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp0_, _data5_->import);
	result = FALSE;
	return result;
}

static gboolean
___lambda11__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda11_ (self);
	return result;
}

static void
rygel_content_directory_on_import_completed (RygelContentDirectory* self,
                                             RygelStateMachine* machine)
{
	Block5Data* _data5_;
	RygelImportResource* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (RYGEL_IS_IMPORT_RESOURCE (machine) ? ((RygelImportResource*) machine) : NULL);
	_data5_->import = _tmp0_;
	_tmp1_ = self->priv->finished_imports;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, _data5_->import);
	_tmp2_ = self->priv->active_imports;
	gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp2_, _data5_->import);
	_tmp3_ = rygel_content_directory_create_transfer_ids (self);
	_tmp4_ = _tmp3_;
	gupnp_service_notify ((GUPnPService*) self, "TransferIDs", G_TYPE_STRING, _tmp4_, NULL);
	_g_free0 (_tmp4_);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 30, ___lambda11__gsource_func, block5_data_ref (_data5_), block5_data_unref);
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

static RygelImportResource*
rygel_content_directory_find_import_for_action (RygelContentDirectory* self,
                                                GUPnPServiceAction* action,
                                                GError** error)
{
	RygelImportResource* ret = NULL;
	guint32 transfer_id = 0U;
	gchar* transfer_id_string = NULL;
	guint32 _tmp0_ = 0U;
	gchar* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	RygelImportResource* _tmp29_;
	GError* _inner_error0_ = NULL;
	RygelImportResource* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	ret = NULL;
	gupnp_service_action_get (action, "TransferID", G_TYPE_UINT, &_tmp0_, "TransferID", G_TYPE_STRING, &_tmp1_, NULL);
	transfer_id = _tmp0_;
	_g_free0 (transfer_id_string);
	transfer_id_string = _tmp1_;
	if (transfer_id == ((guint32) 0)) {
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_;
		_tmp4_ = transfer_id_string;
		if (_tmp4_ == NULL) {
			_tmp3_ = TRUE;
		} else {
			const gchar* _tmp5_;
			_tmp5_ = transfer_id_string;
			_tmp3_ = g_strcmp0 (_tmp5_, "0") != 0;
		}
		_tmp2_ = _tmp3_;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		GError* _tmp6_;
		_tmp6_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS, _ ("Invalid argument"));
		_inner_error0_ = _tmp6_;
		if (_inner_error0_->domain == RYGEL_CONTENT_DIRECTORY_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (transfer_id_string);
			_g_object_unref0 (ret);
			return NULL;
		} else {
			_g_free0 (transfer_id_string);
			_g_object_unref0 (ret);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		GeeArrayList* _import_list = NULL;
		GeeArrayList* _tmp7_;
		gint _import_size = 0;
		GeeArrayList* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gint _import_index = 0;
		_tmp7_ = self->priv->active_imports;
		_import_list = _tmp7_;
		_tmp8_ = _import_list;
		_tmp9_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp8_);
		_tmp10_ = _tmp9_;
		_import_size = _tmp10_;
		_import_index = -1;
		while (TRUE) {
			gint _tmp11_;
			gint _tmp12_;
			RygelImportResource* import = NULL;
			GeeArrayList* _tmp13_;
			gpointer _tmp14_;
			RygelImportResource* _tmp15_;
			_import_index = _import_index + 1;
			_tmp11_ = _import_index;
			_tmp12_ = _import_size;
			if (!(_tmp11_ < _tmp12_)) {
				break;
			}
			_tmp13_ = _import_list;
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp13_, _import_index);
			import = (RygelImportResource*) _tmp14_;
			_tmp15_ = import;
			if (_tmp15_->transfer_id == transfer_id) {
				RygelImportResource* _tmp16_;
				RygelImportResource* _tmp17_;
				_tmp16_ = import;
				_tmp17_ = _g_object_ref0 (_tmp16_);
				_g_object_unref0 (ret);
				ret = _tmp17_;
				_g_object_unref0 (import);
				break;
			}
			_g_object_unref0 (import);
		}
	}
	{
		GeeArrayList* _import_list = NULL;
		GeeArrayList* _tmp18_;
		gint _import_size = 0;
		GeeArrayList* _tmp19_;
		gint _tmp20_;
		gint _tmp21_;
		gint _import_index = 0;
		_tmp18_ = self->priv->finished_imports;
		_import_list = _tmp18_;
		_tmp19_ = _import_list;
		_tmp20_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp19_);
		_tmp21_ = _tmp20_;
		_import_size = _tmp21_;
		_import_index = -1;
		while (TRUE) {
			gint _tmp22_;
			gint _tmp23_;
			RygelImportResource* import = NULL;
			GeeArrayList* _tmp24_;
			gpointer _tmp25_;
			RygelImportResource* _tmp26_;
			_import_index = _import_index + 1;
			_tmp22_ = _import_index;
			_tmp23_ = _import_size;
			if (!(_tmp22_ < _tmp23_)) {
				break;
			}
			_tmp24_ = _import_list;
			_tmp25_ = gee_abstract_list_get ((GeeAbstractList*) _tmp24_, _import_index);
			import = (RygelImportResource*) _tmp25_;
			_tmp26_ = import;
			if (_tmp26_->transfer_id == transfer_id) {
				RygelImportResource* _tmp27_;
				RygelImportResource* _tmp28_;
				_tmp27_ = import;
				_tmp28_ = _g_object_ref0 (_tmp27_);
				_g_object_unref0 (ret);
				ret = _tmp28_;
				_g_object_unref0 (import);
				break;
			}
			_g_object_unref0 (import);
		}
	}
	_tmp29_ = ret;
	if (_tmp29_ == NULL) {
		GError* _tmp30_;
		_tmp30_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_FILE_TRANSFER, _ ("No such file transfer"));
		_inner_error0_ = _tmp30_;
		if (_inner_error0_->domain == RYGEL_CONTENT_DIRECTORY_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (transfer_id_string);
			_g_object_unref0 (ret);
			return NULL;
		} else {
			_g_free0 (transfer_id_string);
			_g_object_unref0 (ret);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	result = ret;
	_g_free0 (transfer_id_string);
	return result;
}

static void
rygel_content_directory_query_last_change (RygelContentDirectory* self,
                                           GUPnPService* content_dir,
                                           const gchar* variable,
                                           GValue* value)
{
	RygelLastChange* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_STRING);
	_tmp0_ = self->priv->last_change;
	_tmp1_ = rygel_last_change_get_log (_tmp0_);
	_tmp2_ = _tmp1_;
	g_value_set_string (value, _tmp2_);
	_g_free0 (_tmp2_);
}

static gboolean
_rygel_content_directory_update_notify_gsource_func (gpointer self)
{
	gboolean result;
	result = rygel_content_directory_update_notify ((RygelContentDirectory*) self);
	return result;
}

static void
rygel_content_directory_ensure_timeout (RygelContentDirectory* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->update_notify_id == ((guint) 0)) {
		self->priv->update_notify_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _rygel_content_directory_update_notify_gsource_func, g_object_ref (self), g_object_unref);
	}
}

static void
rygel_content_directory_add_last_change_entry (RygelContentDirectory* self,
                                               RygelMediaObject* object,
                                               RygelObjectEventType event_type,
                                               gboolean sub_tree_update)
{
	RygelLastChangeEntry* entry = NULL;
	RygelLastChange* _tmp15_;
	RygelLastChangeEntry* _tmp16_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	switch (event_type) {
		case RYGEL_OBJECT_EVENT_TYPE_ADDED:
		{
			const gchar* _tmp0_;
			const gchar* _tmp1_;
			RygelMediaContainer* _tmp2_;
			RygelMediaContainer* _tmp3_;
			const gchar* _tmp4_;
			const gchar* _tmp5_;
			const gchar* _tmp6_;
			const gchar* _tmp7_;
			RygelLastChangeObjAdd* _tmp8_;
			_tmp0_ = rygel_media_object_get_id (object);
			_tmp1_ = _tmp0_;
			_tmp2_ = rygel_media_object_get_parent (object);
			_tmp3_ = _tmp2_;
			_tmp4_ = rygel_media_object_get_id ((RygelMediaObject*) _tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = rygel_media_object_get_upnp_class (object);
			_tmp7_ = _tmp6_;
			_tmp8_ = rygel_last_change_obj_add_new (_tmp1_, (guint) self->system_update_id, sub_tree_update, _tmp5_, _tmp7_);
			_g_object_unref0 (entry);
			entry = (RygelLastChangeEntry*) _tmp8_;
			break;
		}
		case RYGEL_OBJECT_EVENT_TYPE_MODIFIED:
		{
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			RygelLastChangeObjMod* _tmp11_;
			_tmp9_ = rygel_media_object_get_id (object);
			_tmp10_ = _tmp9_;
			_tmp11_ = rygel_last_change_obj_mod_new (_tmp10_, (guint) self->system_update_id, sub_tree_update);
			_g_object_unref0 (entry);
			entry = (RygelLastChangeEntry*) _tmp11_;
			break;
		}
		case RYGEL_OBJECT_EVENT_TYPE_DELETED:
		{
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			RygelLastChangeObjDel* _tmp14_;
			_tmp12_ = rygel_media_object_get_id (object);
			_tmp13_ = _tmp12_;
			_tmp14_ = rygel_last_change_obj_del_new (_tmp13_, (guint) self->system_update_id, sub_tree_update);
			_g_object_unref0 (entry);
			entry = (RygelLastChangeEntry*) _tmp14_;
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	_tmp15_ = self->priv->last_change;
	_tmp16_ = entry;
	rygel_last_change_add_event (_tmp15_, _tmp16_);
	_g_object_unref0 (entry);
}

static void
rygel_content_directory_get_service_reset_token_cb (RygelContentDirectory* self,
                                                    GUPnPService* content_dir,
                                                    GUPnPServiceAction* action)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = self->priv->service_reset_token;
	gupnp_service_action_set (action, "ResetToken", G_TYPE_STRING, _tmp0_, NULL);
	gupnp_service_action_return_success (action);
}

static void
rygel_content_directory_query_service_reset_token (RygelContentDirectory* self,
                                                   GUPnPService* content_dir,
                                                   const gchar* variable,
                                                   GValue* value)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (variable != NULL);
	g_return_if_fail (value != NULL);
	g_value_init (value, G_TYPE_STRING);
	_tmp0_ = self->priv->service_reset_token;
	g_value_set_string (value, _tmp0_);
}

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

static void
rygel_content_directory_service_reset (RygelContentDirectory* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	RygelContentDirectoryServiceResetData* _data_;
	RygelContentDirectory* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (RygelContentDirectoryServiceResetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_content_directory_service_reset_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_content_directory_service_reset_co (_data_);
}

static void
rygel_content_directory_service_reset_finish (RygelContentDirectory* self,
                                              GAsyncResult* _res_)
{
	RygelContentDirectoryServiceResetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
rygel_content_directory_service_reset_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	RygelContentDirectoryServiceResetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_content_directory_service_reset_co (_data_);
}

static gboolean
rygel_content_directory_service_reset_co (RygelContentDirectoryServiceResetData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_debug ("rygel-content-directory.vala:707: SystemUpdateID overflow, initiating " \
"service reset procedure");
	g_object_get ((GUPnPService*) _data_->self, "root-device", &_data_->_tmp0_, NULL);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_data_->_tmp4_) ? ((RygelMediaServerPlugin*) _data_->_tmp4_) : NULL);
	_data_->_tmp6_ = _data_->_tmp5_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->plugin = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->plugin;
	rygel_plugin_set_active ((RygelPlugin*) _data_->_tmp7_, FALSE);
	_data_->_tmp8_ = g_uuid_string_random ();
	_g_free0 (_data_->self->priv->service_reset_token);
	_data_->self->priv->service_reset_token = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->self->root_container;
	if (RYGEL_IS_TRACKABLE_CONTAINER (_data_->_tmp9_)) {
		_data_->_tmp10_ = _data_->self->root_container;
		_data_->_tmp11_ = _g_object_ref0 (RYGEL_IS_TRACKABLE_CONTAINER (_data_->_tmp10_) ? ((RygelTrackableContainer*) _data_->_tmp10_) : NULL);
		_data_->trackable = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->trackable;
		_data_->_tmp13_ = _data_->self->priv->service_reset_token;
		rygel_trackable_container_set_service_reset_token (_data_->_tmp12_, _data_->_tmp13_);
		_g_object_unref0 (_data_->trackable);
	}
	_data_->_tmp14_ = rygel_relational_expression_new ();
	_data_->expression = _data_->_tmp14_;
	_data_->_tmp15_ = _data_->expression;
	_data_->_tmp16_ = g_strdup ("upnp:objectUpdateID");
	_g_free0 (((RygelSearchExpression*) _data_->_tmp15_)->operand1);
	((RygelSearchExpression*) _data_->_tmp15_)->operand1 = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->expression;
	_data_->_tmp18_ = g_strdup ("true");
	_g_free0 (((RygelSearchExpression*) _data_->_tmp17_)->operand2);
	((RygelSearchExpression*) _data_->_tmp17_)->operand2 = _data_->_tmp18_;
	_data_->_tmp19_ = _data_->expression;
	((RygelSearchExpression*) _data_->_tmp19_)->op = (gpointer) ((gintptr) GUPNP_SEARCH_CRITERIA_OP_EXISTS);
	{
		_data_->_tmp20_ = _data_->self->root_container;
		_data_->_tmp21_ = _g_object_ref0 (RYGEL_IS_SEARCHABLE_CONTAINER (_data_->_tmp20_) ? ((RygelSearchableContainer*) _data_->_tmp20_) : NULL);
		_data_->root = _data_->_tmp21_;
		_data_->_tmp22_ = _data_->root;
		if (_data_->_tmp22_ == NULL) {
			_g_object_unref0 (_data_->root);
			_rygel_search_expression_unref0 (_data_->expression);
			_g_object_unref0 (_data_->plugin);
			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;
		}
		_data_->matches = (guint32) 0;
		_data_->_tmp23_ = _data_->root;
		_data_->_tmp24_ = _data_->expression;
		_data_->_tmp25_ = 0U;
		_data_->_state_ = 1;
		rygel_searchable_container_search (_data_->_tmp23_, (RygelSearchExpression*) _data_->_tmp24_, (guint) 0, (guint) 0, "", NULL, rygel_content_directory_service_reset_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp26_ = rygel_searchable_container_search_finish (_data_->_tmp23_, _data_->_res_, &_data_->_tmp25_, &_data_->_inner_error0_);
		_data_->matches = (guint32) _data_->_tmp25_;
		_data_->objects = _data_->_tmp26_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->root);
			goto __catch0_g_error;
		}
		_data_->_tmp27_ = _data_->objects;
		_data_->_tmp28_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp27_);
		_data_->_tmp29_ = _data_->_tmp28_;
		if (_data_->_tmp29_ > 0) {
			_data_->count = (guint32) 1;
			{
				_data_->_tmp30_ = _data_->objects;
				_data_->_object_list = _data_->_tmp30_;
				_data_->_tmp31_ = _data_->_object_list;
				_data_->_tmp32_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp31_);
				_data_->_tmp33_ = _data_->_tmp32_;
				_data_->_object_size = _data_->_tmp33_;
				_data_->_object_index = -1;
				while (TRUE) {
					_data_->_object_index = _data_->_object_index + 1;
					_data_->_tmp34_ = _data_->_object_index;
					_data_->_tmp35_ = _data_->_object_size;
					if (!(_data_->_tmp34_ < _data_->_tmp35_)) {
						break;
					}
					_data_->_tmp36_ = _data_->_object_list;
					_data_->_tmp37_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp36_, _data_->_object_index);
					_data_->object = (RygelMediaObject*) _data_->_tmp37_;
					_data_->_tmp38_ = _data_->object;
					_data_->_tmp39_ = _data_->count;
					_data_->count = _data_->_tmp39_ + 1;
					rygel_media_object_set_object_update_id (_data_->_tmp38_, (guint) _data_->_tmp39_);
					_data_->_tmp40_ = _data_->object;
					if (RYGEL_IS_TRACKABLE_CONTAINER (_data_->_tmp40_)) {
						_data_->_tmp41_ = _data_->object;
						_data_->_tmp42_ = _g_object_ref0 (RYGEL_IS_MEDIA_CONTAINER (_data_->_tmp41_) ? ((RygelMediaContainer*) _data_->_tmp41_) : NULL);
						_data_->container = _data_->_tmp42_;
						_data_->_tmp43_ = _data_->container;
						_data_->_tmp44_ = _data_->container;
						_data_->_tmp45_ = rygel_media_object_get_object_update_id ((RygelMediaObject*) _data_->_tmp44_);
						_data_->_tmp46_ = _data_->_tmp45_;
						_data_->_tmp43_->update_id = (guint32) _data_->_tmp46_;
						_data_->_tmp47_ = _data_->container;
						_data_->_tmp47_->total_deleted_child_count = (gint64) 0;
						_g_object_unref0 (_data_->container);
					}
					_g_object_unref0 (_data_->object);
				}
			}
			_data_->self->system_update_id = _data_->count - 1;
			g_debug ("rygel-content-directory.vala:750: New SystemUpdateID is %u", (guint) _data_->self->system_update_id);
		}
		g_debug ("rygel-content-directory.vala:753: Service reset procedure done, device" \
" coming up again");
		_data_->_tmp48_ = _data_->plugin;
		rygel_plugin_set_active ((RygelPlugin*) _data_->_tmp48_, TRUE);
		_data_->_tmp49_ = _data_->self->priv->service_reset_token;
		g_debug ("rygel-content-directory.vala:755: New service reset token is %s", _data_->_tmp49_);
		_g_object_unref0 (_data_->objects);
		_g_object_unref0 (_data_->root);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		g_warning ("rygel-content-directory.vala:756: Failed to search for objects...");
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_rygel_search_expression_unref0 (_data_->expression);
		_g_object_unref0 (_data_->plugin);
		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;
	}
	_rygel_search_expression_unref0 (_data_->expression);
	_g_object_unref0 (_data_->plugin);
	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 gpointer
_rygel_dlna_profile_ref0 (gpointer self)
{
	return self ? rygel_dlna_profile_ref (self) : NULL;
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
rygel_content_directory_get_dlna_upload_profiles_cb (RygelContentDirectory* self,
                                                     GUPnPService* content_dir,
                                                     GUPnPServiceAction* action)
{
	gchar* upload_profiles = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_;
	RygelMediaServerPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp2_;
	GUPnPRootDevice* _tmp3_;
	GUPnPRootDevice* _tmp4_;
	GUPnPResourceFactory* _tmp5_;
	GUPnPResourceFactory* _tmp6_;
	RygelMediaServerPlugin* _tmp7_;
	RygelMediaServerPlugin* _tmp8_;
	GList* profiles = NULL;
	RygelMediaServerPlugin* _tmp9_;
	GList* _tmp10_;
	GList* _tmp11_;
	gchar** requested_profiles = NULL;
	const gchar* _tmp12_;
	gchar** _tmp13_;
	gchar** _tmp14_;
	gint requested_profiles_length1;
	gint _requested_profiles_size_;
	GString* builder = NULL;
	GString* _tmp15_;
	GList* _tmp16_;
	GString* _tmp35_;
	GString* _tmp38_;
	const gchar* _tmp39_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content_dir != NULL);
	g_return_if_fail (action != NULL);
	upload_profiles = NULL;
	gupnp_service_action_get (action, "UploadProfiles", G_TYPE_STRING, &_tmp0_, NULL);
	_g_free0 (upload_profiles);
	upload_profiles = _tmp0_;
	_tmp1_ = upload_profiles;
	if (_tmp1_ == NULL) {
		gupnp_service_action_return_error (action, (guint) 402, _ ("Invalid argument"));
		_g_free0 (upload_profiles);
		return;
	}
	g_object_get ((GUPnPService*) self, "root-device", &_tmp2_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _g_object_ref0 (RYGEL_IS_MEDIA_SERVER_PLUGIN (_tmp6_) ? ((RygelMediaServerPlugin*) _tmp6_) : NULL);
	_tmp8_ = _tmp7_;
	_g_object_unref0 (_tmp4_);
	plugin = _tmp8_;
	_tmp9_ = plugin;
	_tmp10_ = rygel_media_server_plugin_get_upload_profiles (_tmp9_);
	_tmp11_ = _tmp10_;
	profiles = _tmp11_;
	_tmp12_ = upload_profiles;
	_tmp14_ = _tmp13_ = g_strsplit (_tmp12_, ",", 0);
	requested_profiles = _tmp14_;
	requested_profiles_length1 = _vala_array_length (_tmp13_);
	_requested_profiles_size_ = requested_profiles_length1;
	_tmp15_ = g_string_new ("");
	builder = _tmp15_;
	_tmp16_ = profiles;
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp16_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			RygelDLNAProfile* _tmp17_;
			RygelDLNAProfile* profile = NULL;
			_tmp17_ = _rygel_dlna_profile_ref0 ((RygelDLNAProfile*) profile_it->data);
			profile = _tmp17_;
			{
				gboolean _tmp18_ = FALSE;
				gboolean _tmp19_ = FALSE;
				RygelDLNAProfile* _tmp20_;
				const gchar* _tmp21_;
				gboolean _tmp26_ = FALSE;
				gchar** _tmp27_;
				gint _tmp27__length1;
				_tmp20_ = profile;
				_tmp21_ = _tmp20_->name;
				if (g_str_has_suffix (_tmp21_, "_ICO")) {
					_tmp19_ = TRUE;
				} else {
					RygelDLNAProfile* _tmp22_;
					const gchar* _tmp23_;
					_tmp22_ = profile;
					_tmp23_ = _tmp22_->name;
					_tmp19_ = g_str_has_suffix (_tmp23_, "_TN");
				}
				if (_tmp19_) {
					_tmp18_ = TRUE;
				} else {
					RygelDLNAProfile* _tmp24_;
					const gchar* _tmp25_;
					_tmp24_ = profile;
					_tmp25_ = _tmp24_->name;
					_tmp18_ = g_strcmp0 (_tmp25_, "DIDL_S") == 0;
				}
				if (_tmp18_) {
					_rygel_dlna_profile_unref0 (profile);
					continue;
				}
				_tmp27_ = requested_profiles;
				_tmp27__length1 = requested_profiles_length1;
				if (_tmp27__length1 == 0) {
					_tmp26_ = TRUE;
				} else {
					RygelDLNAProfile* _tmp28_;
					const gchar* _tmp29_;
					gchar** _tmp30_;
					gint _tmp30__length1;
					_tmp28_ = profile;
					_tmp29_ = _tmp28_->name;
					_tmp30_ = requested_profiles;
					_tmp30__length1 = requested_profiles_length1;
					_tmp26_ = _vala_string_array_contains (_tmp30_, _tmp30__length1, _tmp29_);
				}
				if (_tmp26_) {
					GString* _tmp31_;
					RygelDLNAProfile* _tmp32_;
					const gchar* _tmp33_;
					GString* _tmp34_;
					_tmp31_ = builder;
					_tmp32_ = profile;
					_tmp33_ = _tmp32_->name;
					g_string_append (_tmp31_, _tmp33_);
					_tmp34_ = builder;
					g_string_append (_tmp34_, ",");
				}
				_rygel_dlna_profile_unref0 (profile);
			}
		}
	}
	_tmp35_ = builder;
	if (_tmp35_->len > ((gssize) 0)) {
		GString* _tmp36_;
		GString* _tmp37_;
		_tmp36_ = builder;
		_tmp37_ = builder;
		g_string_truncate (_tmp36_, (gsize) (_tmp37_->len - 1));
	}
	_tmp38_ = builder;
	_tmp39_ = _tmp38_->str;
	gupnp_service_action_set (action, "SupportedUploadProfiles", G_TYPE_STRING, _tmp39_, NULL);
	gupnp_service_action_return_success (action);
	_g_string_free0 (builder);
	requested_profiles = (_vala_array_free (requested_profiles, requested_profiles_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (plugin);
	_g_free0 (upload_profiles);
}

RygelContentDirectory*
rygel_content_directory_construct (GType object_type)
{
	RygelContentDirectory * self = NULL;
	self = (RygelContentDirectory*) g_object_new (object_type, NULL);
	return self;
}

RygelContentDirectory*
rygel_content_directory_new (void)
{
	return rygel_content_directory_construct (RYGEL_TYPE_CONTENT_DIRECTORY);
}

static void
rygel_content_directory_class_init (RygelContentDirectoryClass * klass,
                                    gpointer klass_data)
{
	rygel_content_directory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelContentDirectory_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_content_directory_real_constructed;
	G_OBJECT_CLASS (klass)->finalize = rygel_content_directory_finalize;
}

static void
rygel_content_directory_instance_init (RygelContentDirectory * self,
                                       gpointer klass)
{
	self->priv = rygel_content_directory_get_instance_private (self);
}

static void
rygel_content_directory_finalize (GObject * obj)
{
	RygelContentDirectory * self;
	GCancellable* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectory);
	_tmp0_ = self->cancellable;
	g_cancellable_cancel (_tmp0_);
	_g_free0 (self->feature_list);
	_g_object_unref0 (self->http_server);
	_g_object_unref0 (self->root_container);
	_g_object_unref0 (self->priv->updated_containers);
	_g_object_unref0 (self->priv->active_imports);
	_g_object_unref0 (self->priv->finished_imports);
	_g_object_unref0 (self->cancellable);
	_g_object_unref0 (self->priv->last_change);
	_g_free0 (self->priv->service_reset_token);
	G_OBJECT_CLASS (rygel_content_directory_parent_class)->finalize (obj);
}

/**
 * Basic implementation of UPnP ContentDirectory service version 2. Most often
 * plugins will provide a child of this class. The inheriting classes should
 * override create_root_container method.
 */
 G_GNUC_NO_INLINE static GType
rygel_content_directory_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelContentDirectoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_content_directory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelContentDirectory), 0, (GInstanceInitFunc) rygel_content_directory_instance_init, NULL };
	GType rygel_content_directory_type_id;
	rygel_content_directory_type_id = g_type_register_static (gupnp_service_get_type (), "RygelContentDirectory", &g_define_type_info, 0);
	RygelContentDirectory_private_offset = g_type_add_instance_private (rygel_content_directory_type_id, sizeof (RygelContentDirectoryPrivate));
	return rygel_content_directory_type_id;
}

GType
rygel_content_directory_get_type (void)
{
	static volatile gsize rygel_content_directory_type_id__once = 0;
	if (g_once_init_enter (&rygel_content_directory_type_id__once)) {
		GType rygel_content_directory_type_id;
		rygel_content_directory_type_id = rygel_content_directory_get_type_once ();
		g_once_init_leave (&rygel_content_directory_type_id__once, rygel_content_directory_type_id);
	}
	return rygel_content_directory_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

