/* rygel-mediathek-root-container.c generated by valac 0.25.1.16-16e7a, the Vala compiler
 * generated from rygel-mediathek-root-container.vala, do not modify */

/*
 * Copyright (C) 2009-2011 Jens Georg
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <rygel-server.h>
#include <libsoup/soup.h>
#include <gio/gio.h>
#include <gee.h>
#include <rygel-core.h>


#define RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER (rygel_mediathek_root_container_get_type ())
#define RYGEL_MEDIATHEK_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER, RygelMediathekRootContainer))
#define RYGEL_MEDIATHEK_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER, RygelMediathekRootContainerClass))
#define RYGEL_MEDIATHEK_IS_ROOT_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER))
#define RYGEL_MEDIATHEK_IS_ROOT_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER))
#define RYGEL_MEDIATHEK_ROOT_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER, RygelMediathekRootContainerClass))

typedef struct _RygelMediathekRootContainer RygelMediathekRootContainer;
typedef struct _RygelMediathekRootContainerClass RygelMediathekRootContainerClass;
typedef struct _RygelMediathekRootContainerPrivate RygelMediathekRootContainerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER (rygel_mediathek_rss_container_get_type ())
#define RYGEL_MEDIATHEK_RSS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER, RygelMediathekRssContainer))
#define RYGEL_MEDIATHEK_RSS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER, RygelMediathekRssContainerClass))
#define RYGEL_MEDIATHEK_IS_RSS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER))
#define RYGEL_MEDIATHEK_IS_RSS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER))
#define RYGEL_MEDIATHEK_RSS_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER, RygelMediathekRssContainerClass))

typedef struct _RygelMediathekRssContainer RygelMediathekRssContainer;
typedef struct _RygelMediathekRssContainerClass RygelMediathekRssContainerClass;
typedef struct _RygelMediathekRootContainerInitData RygelMediathekRootContainerInitData;
typedef struct _RygelMediathekRootContainerAddChildData RygelMediathekRootContainerAddChildData;

struct _RygelMediathekRootContainer {
	RygelSimpleContainer parent_instance;
	RygelMediathekRootContainerPrivate * priv;
};

struct _RygelMediathekRootContainerClass {
	RygelSimpleContainerClass parent_class;
};

struct _RygelMediathekRootContainerPrivate {
	SoupSession* session;
};

struct _RygelMediathekRootContainerInitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelMediathekRootContainer* self;
	GeeArrayList* feeds;
	gint update_interval;
	gint _tmp0_;
	RygelMetaConfig* config;
	RygelMetaConfig* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _tmp3_;
	GeeArrayList* _tmp4_;
	GError* _error_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	GeeArrayList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	GError* _vala1__error_;
	gint _tmp12_;
	GeeArrayList* _id_list;
	GeeArrayList* _tmp13_;
	GeeArrayList* _tmp14_;
	gint _id_size;
	GeeArrayList* _tmp15_;
	gint _tmp16_;
	gint _tmp17_;
	gint _id_index;
	gint _tmp18_;
	gint _tmp19_;
	gint _tmp20_;
	gint id;
	GeeArrayList* _tmp21_;
	gint _tmp22_;
	gpointer _tmp23_;
	gint _tmp24_;
	RygelMediathekRssContainer* _tmp25_;
	RygelMediathekRssContainer* _tmp26_;
	gint _tmp27_;
	GError * _inner_error_;
};

struct _RygelMediathekRootContainerAddChildData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelMediathekRootContainer* self;
	RygelMediaObject* object;
	RygelMediaObject* _tmp0_;
};


static gpointer rygel_mediathek_root_container_parent_class = NULL;
static RygelMediathekRootContainer* rygel_mediathek_root_container_instance;
static RygelMediathekRootContainer* rygel_mediathek_root_container_instance = NULL;
static gint rygel_mediathek_root_container_DEFAULT_UPDATE_INTERVAL;
static gint rygel_mediathek_root_container_DEFAULT_UPDATE_INTERVAL = 1800;
static RygelTrackableContainerIface* rygel_mediathek_root_container_rygel_trackable_container_parent_iface = NULL;

GType rygel_mediathek_root_container_get_type (void) G_GNUC_CONST;
#define RYGEL_MEDIATHEK_ROOT_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER, RygelMediathekRootContainerPrivate))
enum  {
	RYGEL_MEDIATHEK_ROOT_CONTAINER_DUMMY_PROPERTY
};
RygelMediathekRootContainer* rygel_mediathek_root_container_get_instance (void);
static RygelMediathekRootContainer* rygel_mediathek_root_container_new (void);
static RygelMediathekRootContainer* rygel_mediathek_root_container_construct (GType object_type);
static void rygel_mediathek_root_container_init (RygelMediathekRootContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void rygel_mediathek_root_container_init_finish (RygelMediathekRootContainer* self, GAsyncResult* _res_);
SoupSession* rygel_mediathek_root_container_get_default_session (void);
static void rygel_mediathek_root_container_init_data_free (gpointer _data);
static gboolean rygel_mediathek_root_container_init_co (RygelMediathekRootContainerInitData* _data_);
RygelMediathekRssContainer* rygel_mediathek_rss_container_new (RygelMediaContainer* parent, guint id);
RygelMediathekRssContainer* rygel_mediathek_rss_container_construct (GType object_type, RygelMediaContainer* parent, guint id);
GType rygel_mediathek_rss_container_get_type (void) G_GNUC_CONST;
static void rygel_mediathek_root_container_init_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static gboolean __lambda6_ (RygelMediathekRootContainer* self);
void rygel_mediathek_rss_container_update (RygelMediathekRssContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_mediathek_rss_container_update_finish (RygelMediathekRssContainer* self, GAsyncResult* _res_);
static gboolean ___lambda6__gsource_func (gpointer self);
static void rygel_mediathek_root_container_real_add_child_data_free (gpointer _data);
static void rygel_mediathek_root_container_real_add_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_mediathek_root_container_real_add_child_co (RygelMediathekRootContainerAddChildData* _data_);
static void rygel_mediathek_root_container_finalize (GObject* obj);


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


RygelMediathekRootContainer* rygel_mediathek_root_container_get_instance (void) {
	RygelMediathekRootContainer* result = NULL;
	RygelMediathekRootContainer* _tmp0_ = NULL;
	RygelMediathekRootContainer* _tmp3_ = NULL;
	RygelMediathekRootContainer* _tmp4_ = NULL;
	_tmp0_ = rygel_mediathek_root_container_instance;
	if (_tmp0_ == NULL) {
		RygelMediathekRootContainer* _tmp1_ = NULL;
		RygelMediathekRootContainer* _tmp2_ = NULL;
		_tmp1_ = rygel_mediathek_root_container_new ();
		_g_object_unref0 (rygel_mediathek_root_container_instance);
		rygel_mediathek_root_container_instance = _tmp1_;
		_tmp2_ = rygel_mediathek_root_container_instance;
		rygel_mediathek_root_container_init (_tmp2_, NULL, NULL);
	}
	_tmp3_ = rygel_mediathek_root_container_instance;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	result = _tmp4_;
	return result;
}


SoupSession* rygel_mediathek_root_container_get_default_session (void) {
	SoupSession* result = NULL;
	RygelMediathekRootContainer* _tmp0_ = NULL;
	RygelMediathekRootContainer* _tmp1_ = NULL;
	SoupSession* _tmp2_ = NULL;
	SoupSession* _tmp3_ = NULL;
	SoupSession* _tmp4_ = NULL;
	_tmp0_ = rygel_mediathek_root_container_get_instance ();
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->priv->session;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_object_unref0 (_tmp1_);
	result = _tmp4_;
	return result;
}


static RygelMediathekRootContainer* rygel_mediathek_root_container_construct (GType object_type) {
	RygelMediathekRootContainer * self = NULL;
	SoupSession* _tmp0_ = NULL;
	self = (RygelMediathekRootContainer*) rygel_simple_container_construct_root (object_type, "ZDF Mediathek");
	_tmp0_ = soup_session_new ();
	_g_object_unref0 (self->priv->session);
	self->priv->session = _tmp0_;
	return self;
}


static RygelMediathekRootContainer* rygel_mediathek_root_container_new (void) {
	return rygel_mediathek_root_container_construct (RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER);
}


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


static void rygel_mediathek_root_container_init (RygelMediathekRootContainer* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelMediathekRootContainerInitData* _data_;
	RygelMediathekRootContainer* _tmp0_ = NULL;
	_data_ = g_slice_new0 (RygelMediathekRootContainerInitData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_mediathek_root_container_init);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_mediathek_root_container_init_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_mediathek_root_container_init_co (_data_);
}


static void rygel_mediathek_root_container_init_finish (RygelMediathekRootContainer* self, GAsyncResult* _res_) {
	RygelMediathekRootContainerInitData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void rygel_mediathek_root_container_init_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelMediathekRootContainerInitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_mediathek_root_container_init_co (_data_);
}


static gboolean __lambda6_ (RygelMediathekRootContainer* self) {
	gboolean result = FALSE;
	{
		RygelMediaObjects* _child_list = NULL;
		RygelMediaObjects* _tmp0_ = NULL;
		RygelMediaObjects* _tmp1_ = NULL;
		gint _child_size = 0;
		RygelMediaObjects* _tmp2_ = NULL;
		gint _tmp3_ = 0;
		gint _tmp4_ = 0;
		gint _child_index = 0;
		_tmp0_ = ((RygelSimpleContainer*) self)->children;
		_tmp1_ = _g_object_ref0 (_tmp0_);
		_child_list = _tmp1_;
		_tmp2_ = _child_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_child_size = _tmp4_;
		_child_index = -1;
		while (TRUE) {
			gint _tmp5_ = 0;
			gint _tmp6_ = 0;
			gint _tmp7_ = 0;
			RygelMediaObject* child = NULL;
			RygelMediaObjects* _tmp8_ = NULL;
			gint _tmp9_ = 0;
			gpointer _tmp10_ = NULL;
			RygelMediathekRssContainer* container = NULL;
			RygelMediaObject* _tmp11_ = NULL;
			RygelMediathekRssContainer* _tmp12_ = NULL;
			RygelMediathekRssContainer* _tmp13_ = NULL;
			_tmp5_ = _child_index;
			_child_index = _tmp5_ + 1;
			_tmp6_ = _child_index;
			_tmp7_ = _child_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _child_list;
			_tmp9_ = _child_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			child = (RygelMediaObject*) _tmp10_;
			_tmp11_ = child;
			_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, RYGEL_MEDIATHEK_TYPE_RSS_CONTAINER) ? ((RygelMediathekRssContainer*) _tmp11_) : NULL);
			container = _tmp12_;
			_tmp13_ = container;
			rygel_mediathek_rss_container_update (_tmp13_, NULL, NULL);
			_g_object_unref0 (container);
			_g_object_unref0 (child);
		}
		_g_object_unref0 (_child_list);
	}
	result = TRUE;
	return result;
}


static gboolean ___lambda6__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda6_ ((RygelMediathekRootContainer*) self);
	return result;
}


static gboolean rygel_mediathek_root_container_init_co (RygelMediathekRootContainerInitData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->feeds = NULL;
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = rygel_mediathek_root_container_DEFAULT_UPDATE_INTERVAL;
	_data_->update_interval = _data_->_tmp0_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = rygel_meta_config_get_default ();
	_data_->config = _data_->_tmp1_;
	{
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = rygel_configuration_get_int_list ((RygelConfiguration*) _data_->config, "ZDFMediathek", "rss", &_data_->_inner_error_);
		_data_->_tmp2_ = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch3_g_error;
		}
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->_tmp2_;
		_data_->_tmp2_ = NULL;
		_g_object_unref0 (_data_->feeds);
		_data_->feeds = _data_->_tmp4_;
		_g_object_unref0 (_data_->_tmp2_);
	}
	goto __finally3;
	__catch3_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (_data_->feeds);
		_data_->feeds = _data_->_tmp5_;
		_g_error_free0 (_data_->_error_);
	}
	__finally3:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->config);
		_g_object_unref0 (_data_->feeds);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _data_->feeds;
	_data_->_tmp7_ = 0;
	_data_->_tmp7_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp6_);
	_data_->_tmp8_ = 0;
	_data_->_tmp8_ = _data_->_tmp7_;
	if (_data_->_tmp8_ == 0) {
		g_message ("rygel-mediathek-root-container.vala:62: Could not get RSS from configu" \
"ration, using defaults");
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = _data_->feeds;
		gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp9_, (gpointer) ((gintptr) 508));
	}
	{
		_data_->_tmp11_ = 0;
		_data_->_tmp11_ = rygel_configuration_get_int ((RygelConfiguration*) _data_->config, "ZDFMediathek", "update-interval", 600, G_MAXINT, &_data_->_inner_error_);
		_data_->_tmp10_ = _data_->_tmp11_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch4_g_error;
		}
		_data_->update_interval = _data_->_tmp10_;
	}
	goto __finally4;
	__catch4_g_error:
	{
		_data_->_vala1__error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp12_ = 0;
		_data_->_tmp12_ = rygel_mediathek_root_container_DEFAULT_UPDATE_INTERVAL;
		_data_->update_interval = _data_->_tmp12_;
		_g_error_free0 (_data_->_vala1__error_);
	}
	__finally4:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->config);
		_g_object_unref0 (_data_->feeds);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	{
		_data_->_tmp13_ = NULL;
		_data_->_tmp13_ = _data_->feeds;
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _g_object_ref0 (_data_->_tmp13_);
		_data_->_id_list = _data_->_tmp14_;
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->_id_list;
		_data_->_tmp16_ = 0;
		_data_->_tmp16_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp15_);
		_data_->_tmp17_ = 0;
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_id_size = _data_->_tmp17_;
		_data_->_id_index = -1;
		while (TRUE) {
			_data_->_tmp18_ = 0;
			_data_->_tmp18_ = _data_->_id_index;
			_data_->_id_index = _data_->_tmp18_ + 1;
			_data_->_tmp19_ = 0;
			_data_->_tmp19_ = _data_->_id_index;
			_data_->_tmp20_ = 0;
			_data_->_tmp20_ = _data_->_id_size;
			if (!(_data_->_tmp19_ < _data_->_tmp20_)) {
				break;
			}
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->_id_list;
			_data_->_tmp22_ = 0;
			_data_->_tmp22_ = _data_->_id_index;
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp21_, _data_->_tmp22_);
			_data_->id = (gint) ((gintptr) _data_->_tmp23_);
			_data_->_tmp24_ = 0;
			_data_->_tmp24_ = _data_->id;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = rygel_mediathek_rss_container_new ((RygelMediaContainer*) _data_->self, (guint) _data_->_tmp24_);
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_state_ = 1;
			rygel_trackable_container_add_child_tracked ((RygelTrackableContainer*) _data_->self, (RygelMediaObject*) _data_->_tmp26_, rygel_mediathek_root_container_init_ready, _data_);
			return FALSE;
			_state_1:
			rygel_trackable_container_add_child_tracked_finish ((RygelTrackableContainer*) _data_->self, _data_->_res_);
			_g_object_unref0 (_data_->_tmp26_);
		}
		_g_object_unref0 (_data_->_id_list);
	}
	_data_->_tmp27_ = 0;
	_data_->_tmp27_ = _data_->update_interval;
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) _data_->_tmp27_, ___lambda6__gsource_func, g_object_ref (_data_->self), g_object_unref);
	_g_object_unref0 (_data_->config);
	_g_object_unref0 (_data_->feeds);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void rygel_mediathek_root_container_real_add_child_data_free (gpointer _data) {
	RygelMediathekRootContainerAddChildData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediathekRootContainerAddChildData, _data_);
}


static void rygel_mediathek_root_container_real_add_child (RygelTrackableContainer* base, RygelMediaObject* object, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelMediathekRootContainer * self;
	RygelMediathekRootContainerAddChildData* _data_;
	RygelMediathekRootContainer* _tmp0_ = NULL;
	RygelMediaObject* _tmp1_ = NULL;
	RygelMediaObject* _tmp2_ = NULL;
	self = (RygelMediathekRootContainer*) base;
	_data_ = g_slice_new0 (RygelMediathekRootContainerAddChildData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_mediathek_root_container_real_add_child);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_mediathek_root_container_real_add_child_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = object;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp2_;
	rygel_mediathek_root_container_real_add_child_co (_data_);
}


static void rygel_mediathek_root_container_real_add_child_finish (RygelTrackableContainer* base, GAsyncResult* _res_) {
	RygelMediathekRootContainerAddChildData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean rygel_mediathek_root_container_real_add_child_co (RygelMediathekRootContainerAddChildData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->object;
	rygel_simple_container_add_child_container ((RygelSimpleContainer*) _data_->self, G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, RYGEL_TYPE_MEDIA_CONTAINER) ? ((RygelMediaContainer*) _data_->_tmp0_) : NULL);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void rygel_mediathek_root_container_class_init (RygelMediathekRootContainerClass * klass) {
	rygel_mediathek_root_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelMediathekRootContainerPrivate));
	G_OBJECT_CLASS (klass)->finalize = rygel_mediathek_root_container_finalize;
}


static void rygel_mediathek_root_container_rygel_trackable_container_interface_init (RygelTrackableContainerIface * iface) {
	rygel_mediathek_root_container_rygel_trackable_container_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_child = (void (*)(RygelTrackableContainer*, RygelMediaObject*)) rygel_mediathek_root_container_real_add_child;
	iface->add_child_finish = rygel_mediathek_root_container_real_add_child_finish;
	iface->remove_child = (void (*)(RygelTrackableContainer*, RygelMediaObject*)) rygel_simple_container_remove_child;
}


static void rygel_mediathek_root_container_instance_init (RygelMediathekRootContainer * self) {
	self->priv = RYGEL_MEDIATHEK_ROOT_CONTAINER_GET_PRIVATE (self);
}


static void rygel_mediathek_root_container_finalize (GObject* obj) {
	RygelMediathekRootContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIATHEK_TYPE_ROOT_CONTAINER, RygelMediathekRootContainer);
	_g_object_unref0 (self->priv->session);
	G_OBJECT_CLASS (rygel_mediathek_root_container_parent_class)->finalize (obj);
}


GType rygel_mediathek_root_container_get_type (void) {
	static volatile gsize rygel_mediathek_root_container_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_mediathek_root_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediathekRootContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_mediathek_root_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediathekRootContainer), 0, (GInstanceInitFunc) rygel_mediathek_root_container_instance_init, NULL };
		static const GInterfaceInfo rygel_trackable_container_info = { (GInterfaceInitFunc) rygel_mediathek_root_container_rygel_trackable_container_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_mediathek_root_container_type_id;
		rygel_mediathek_root_container_type_id = g_type_register_static (RYGEL_TYPE_SIMPLE_CONTAINER, "RygelMediathekRootContainer", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_mediathek_root_container_type_id, RYGEL_TYPE_TRACKABLE_CONTAINER, &rygel_trackable_container_info);
		g_once_init_leave (&rygel_mediathek_root_container_type_id__volatile, rygel_mediathek_root_container_type_id);
	}
	return rygel_mediathek_root_container_type_id__volatile;
}



