/* rygel-source-connection-manager.c generated by valac 0.20.1.2-ca5c2, the Vala compiler
 * generated from rygel-source-connection-manager.vala, do not modify */

/*
 * Copyright (C) 2012 Intel Corporation.
 * Copyright (C) 2009-2011 Nokia Corporation.
 * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *         Jens Georg <jensg@openismus.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 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-core.h>
#include <gee.h>
#include <libgupnp-av/gupnp-av.h>
#include <stdlib.h>
#include <string.h>
#include <libgupnp/gupnp.h>
#include <gio/gio.h>


#define RYGEL_TYPE_SOURCE_CONNECTION_MANAGER (rygel_source_connection_manager_get_type ())
#define RYGEL_SOURCE_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManager))
#define RYGEL_SOURCE_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManagerClass))
#define RYGEL_IS_SOURCE_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER))
#define RYGEL_IS_SOURCE_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER))
#define RYGEL_SOURCE_CONNECTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManagerClass))

typedef struct _RygelSourceConnectionManager RygelSourceConnectionManager;
typedef struct _RygelSourceConnectionManagerClass RygelSourceConnectionManagerClass;
typedef struct _RygelSourceConnectionManagerPrivate RygelSourceConnectionManagerPrivate;
#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_TRANSCODE_MANAGER (rygel_transcode_manager_get_type ())
#define RYGEL_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManager))
#define RYGEL_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))
#define RYGEL_IS_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_IS_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_TRANSCODE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))

typedef struct _RygelTranscodeManager RygelTranscodeManager;
typedef struct _RygelTranscodeManagerClass RygelTranscodeManagerClass;

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

typedef struct _RygelHTTPServer RygelHTTPServer;
typedef struct _RygelHTTPServerClass RygelHTTPServerClass;

#define RYGEL_TYPE_MEDIA_ENGINE (rygel_media_engine_get_type ())
#define RYGEL_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_ENGINE, RygelMediaEngine))
#define RYGEL_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_ENGINE, RygelMediaEngineClass))
#define RYGEL_IS_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_ENGINE))
#define RYGEL_IS_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_ENGINE))
#define RYGEL_MEDIA_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_ENGINE, RygelMediaEngineClass))

typedef struct _RygelMediaEngine RygelMediaEngine;
typedef struct _RygelMediaEngineClass RygelMediaEngineClass;

#define RYGEL_TYPE_DLNA_PROFILE (rygel_dlna_profile_get_type ())
#define RYGEL_DLNA_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfile))
#define RYGEL_DLNA_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfileClass))
#define RYGEL_IS_DLNA_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_DLNA_PROFILE))
#define RYGEL_IS_DLNA_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_DLNA_PROFILE))
#define RYGEL_DLNA_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfileClass))

typedef struct _RygelDLNAProfile RygelDLNAProfile;
typedef struct _RygelDLNAProfileClass RygelDLNAProfileClass;
typedef struct _RygelDLNAProfilePrivate RygelDLNAProfilePrivate;
#define _rygel_dlna_profile_unref0(var) ((var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL)))

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

typedef struct _RygelContentDirectory RygelContentDirectory;
typedef struct _RygelContentDirectoryClass RygelContentDirectoryClass;
typedef struct _RygelContentDirectoryPrivate RygelContentDirectoryPrivate;

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

typedef struct _RygelMediaObject RygelMediaObject;
typedef struct _RygelMediaObjectClass RygelMediaObjectClass;

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

typedef struct _RygelMediaContainer RygelMediaContainer;
typedef struct _RygelMediaContainerClass RygelMediaContainerClass;

struct _RygelSourceConnectionManager {
	RygelConnectionManager parent_instance;
	RygelSourceConnectionManagerPrivate * priv;
};

struct _RygelSourceConnectionManagerClass {
	RygelConnectionManagerClass parent_class;
};

struct _RygelDLNAProfile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelDLNAProfilePrivate * priv;
	gchar* mime;
	gchar* name;
};

struct _RygelDLNAProfileClass {
	GTypeClass parent_class;
	void (*finalize) (RygelDLNAProfile *self);
};

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

struct _RygelContentDirectoryClass {
	GUPnPServiceClass parent_class;
};


static gpointer rygel_source_connection_manager_parent_class = NULL;

GType rygel_source_connection_manager_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_SOURCE_CONNECTION_MANAGER_DUMMY_PROPERTY
};
static void rygel_source_connection_manager_real_constructed (GObject* base);
static GeeArrayList* rygel_source_connection_manager_get_protocol_info (RygelSourceConnectionManager* self);
GType rygel_transcode_manager_get_type (void) G_GNUC_CONST;
GType rygel_http_server_get_type (void) G_GNUC_CONST;
static RygelHTTPServer* rygel_source_connection_manager_get_http_server (RygelSourceConnectionManager* self);
GeeArrayList* rygel_transcode_manager_get_protocol_info (RygelTranscodeManager* self);
GType rygel_media_engine_get_type (void) G_GNUC_CONST;
RygelMediaEngine* rygel_media_engine_get_default (void);
gpointer rygel_dlna_profile_ref (gpointer instance);
void rygel_dlna_profile_unref (gpointer instance);
GParamSpec* rygel_param_spec_dlna_profile (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_dlna_profile (GValue* value, gpointer v_object);
void rygel_value_take_dlna_profile (GValue* value, gpointer v_object);
gpointer rygel_value_get_dlna_profile (const GValue* value);
GType rygel_dlna_profile_get_type (void) G_GNUC_CONST;
GList* rygel_media_engine_get_dlna_profiles (RygelMediaEngine* self);
gchar* rygel_transcode_manager_get_protocol (RygelTranscodeManager* self);
GType rygel_content_directory_get_type (void) G_GNUC_CONST;
GType rygel_media_object_get_type (void) G_GNUC_CONST;
GType rygel_media_container_get_type (void) G_GNUC_CONST;
RygelSourceConnectionManager* rygel_source_connection_manager_new (void);
RygelSourceConnectionManager* rygel_source_connection_manager_construct (GType object_type);


static void rygel_source_connection_manager_real_constructed (GObject* base) {
	RygelSourceConnectionManager * self;
	gchar* _tmp0_;
	self = (RygelSourceConnectionManager*) base;
	G_OBJECT_CLASS (rygel_source_connection_manager_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_TYPE_CONNECTION_MANAGER, RygelConnectionManager));
	((RygelConnectionManager*) self)->rcs_id = -1;
	((RygelConnectionManager*) self)->av_transport_id = -1;
	_tmp0_ = g_strdup ("Output");
	_g_free0 (((RygelConnectionManager*) self)->direction);
	((RygelConnectionManager*) self)->direction = _tmp0_;
	{
		GeeArrayList* _tmp1_ = NULL;
		GeeArrayList* _protocol_info_list;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _protocol_info_size;
		gint _protocol_info_index;
		_tmp1_ = rygel_source_connection_manager_get_protocol_info (self);
		_protocol_info_list = _tmp1_;
		_tmp2_ = _protocol_info_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_protocol_info_size = _tmp4_;
		_protocol_info_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			GUPnPProtocolInfo* protocol_info;
			const gchar* _tmp11_;
			const gchar* _tmp14_;
			GUPnPProtocolInfo* _tmp15_;
			gchar* _tmp16_ = NULL;
			gchar* _tmp17_;
			gchar* _tmp18_;
			_tmp5_ = _protocol_info_index;
			_protocol_info_index = _tmp5_ + 1;
			_tmp6_ = _protocol_info_index;
			_tmp7_ = _protocol_info_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _protocol_info_list;
			_tmp9_ = _protocol_info_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			protocol_info = (GUPnPProtocolInfo*) _tmp10_;
			_tmp11_ = ((RygelConnectionManager*) self)->source_protocol_info;
			if (g_strcmp0 (_tmp11_, "") != 0) {
				const gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp12_ = ((RygelConnectionManager*) self)->source_protocol_info;
				_tmp13_ = g_strconcat (_tmp12_, ",", NULL);
				_g_free0 (((RygelConnectionManager*) self)->source_protocol_info);
				((RygelConnectionManager*) self)->source_protocol_info = _tmp13_;
			}
			_tmp14_ = ((RygelConnectionManager*) self)->source_protocol_info;
			_tmp15_ = protocol_info;
			_tmp16_ = gupnp_protocol_info_to_string (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = g_strconcat (_tmp14_, _tmp17_, NULL);
			_g_free0 (((RygelConnectionManager*) self)->source_protocol_info);
			((RygelConnectionManager*) self)->source_protocol_info = _tmp18_;
			_g_free0 (_tmp17_);
			_g_object_unref0 (protocol_info);
		}
		_g_object_unref0 (_protocol_info_list);
	}
}


static gpointer _rygel_dlna_profile_ref0 (gpointer self) {
	return self ? rygel_dlna_profile_ref (self) : NULL;
}


static GeeArrayList* rygel_source_connection_manager_get_protocol_info (RygelSourceConnectionManager* self) {
	GeeArrayList* result = NULL;
	RygelHTTPServer* _tmp0_ = NULL;
	RygelHTTPServer* server;
	RygelHTTPServer* _tmp1_;
	GeeArrayList* _tmp2_ = NULL;
	GeeArrayList* protocol_infos;
	RygelMediaEngine* _tmp3_ = NULL;
	RygelMediaEngine* _tmp4_;
	GList* _tmp5_ = NULL;
	GList* _tmp6_;
	GList* profiles;
	RygelHTTPServer* _tmp7_;
	gchar* _tmp8_ = NULL;
	gchar* protocol;
	GList* _tmp9_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = rygel_source_connection_manager_get_http_server (self);
	server = _tmp0_;
	_tmp1_ = server;
	_tmp2_ = rygel_transcode_manager_get_protocol_info ((RygelTranscodeManager*) _tmp1_);
	protocol_infos = _tmp2_;
	_tmp3_ = rygel_media_engine_get_default ();
	_tmp4_ = _tmp3_;
	_tmp5_ = rygel_media_engine_get_dlna_profiles (_tmp4_);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp4_);
	profiles = _tmp6_;
	_tmp7_ = server;
	_tmp8_ = rygel_transcode_manager_get_protocol ((RygelTranscodeManager*) _tmp7_);
	protocol = _tmp8_;
	_tmp9_ = profiles;
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp9_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			RygelDLNAProfile* _tmp10_;
			RygelDLNAProfile* profile = NULL;
			_tmp10_ = _rygel_dlna_profile_ref0 ((RygelDLNAProfile*) profile_it->data);
			profile = _tmp10_;
			{
				GUPnPProtocolInfo* _tmp11_;
				GUPnPProtocolInfo* protocol_info;
				GUPnPProtocolInfo* _tmp12_;
				const gchar* _tmp13_;
				GUPnPProtocolInfo* _tmp14_;
				RygelDLNAProfile* _tmp15_;
				const gchar* _tmp16_;
				GUPnPProtocolInfo* _tmp17_;
				RygelDLNAProfile* _tmp18_;
				const gchar* _tmp19_;
				GeeArrayList* _tmp20_;
				GUPnPProtocolInfo* _tmp21_;
				gboolean _tmp22_ = FALSE;
				_tmp11_ = gupnp_protocol_info_new ();
				protocol_info = _tmp11_;
				_tmp12_ = protocol_info;
				_tmp13_ = protocol;
				gupnp_protocol_info_set_protocol (_tmp12_, _tmp13_);
				_tmp14_ = protocol_info;
				_tmp15_ = profile;
				_tmp16_ = _tmp15_->mime;
				gupnp_protocol_info_set_mime_type (_tmp14_, _tmp16_);
				_tmp17_ = protocol_info;
				_tmp18_ = profile;
				_tmp19_ = _tmp18_->name;
				gupnp_protocol_info_set_dlna_profile (_tmp17_, _tmp19_);
				_tmp20_ = protocol_infos;
				_tmp21_ = protocol_info;
				_tmp22_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp20_, _tmp21_);
				if (!_tmp22_) {
					GeeArrayList* _tmp23_;
					GUPnPProtocolInfo* _tmp24_;
					_tmp23_ = protocol_infos;
					_tmp24_ = protocol_info;
					gee_abstract_list_insert ((GeeAbstractList*) _tmp23_, 0, _tmp24_);
				}
				_g_object_unref0 (protocol_info);
				_rygel_dlna_profile_unref0 (profile);
			}
		}
	}
	result = protocol_infos;
	_g_free0 (protocol);
	_g_object_unref0 (server);
	return result;
}


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


static RygelHTTPServer* rygel_source_connection_manager_get_http_server (RygelSourceConnectionManager* self) {
	RygelHTTPServer* result = NULL;
	RygelHTTPServer* server;
	GUPnPRootDevice* _tmp0_ = NULL;
	GUPnPRootDevice* _tmp1_;
	RygelRootDevice* root_device;
	g_return_val_if_fail (self != NULL, NULL);
	server = NULL;
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	root_device = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, RYGEL_TYPE_ROOT_DEVICE, RygelRootDevice);
	{
		RygelRootDevice* _tmp2_;
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		GeeArrayList* _tmp5_;
		GeeArrayList* _service_list;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _service_size;
		gint _service_index;
		_tmp2_ = root_device;
		_tmp3_ = rygel_root_device_get_services (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _g_object_ref0 (_tmp4_);
		_service_list = _tmp5_;
		_tmp6_ = _service_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_service_size = _tmp8_;
		_service_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			gint _tmp11_;
			GeeArrayList* _tmp12_;
			gint _tmp13_;
			gpointer _tmp14_ = NULL;
			GUPnPServiceInfo* service;
			GUPnPServiceInfo* _tmp15_;
			GType _tmp16_ = 0UL;
			gboolean _tmp17_ = FALSE;
			_tmp9_ = _service_index;
			_service_index = _tmp9_ + 1;
			_tmp10_ = _service_index;
			_tmp11_ = _service_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _service_list;
			_tmp13_ = _service_index;
			_tmp14_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, _tmp13_);
			service = (GUPnPServiceInfo*) _tmp14_;
			_tmp15_ = service;
			_tmp16_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp15_);
			_tmp17_ = g_type_is_a (_tmp16_, RYGEL_TYPE_CONTENT_DIRECTORY);
			if (_tmp17_) {
				GUPnPServiceInfo* _tmp18_;
				RygelContentDirectory* _tmp19_;
				RygelContentDirectory* content_directory;
				RygelContentDirectory* _tmp20_;
				RygelHTTPServer* _tmp21_;
				RygelHTTPServer* _tmp22_;
				_tmp18_ = service;
				_tmp19_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectory));
				content_directory = _tmp19_;
				_tmp20_ = content_directory;
				_tmp21_ = _tmp20_->http_server;
				_tmp22_ = _g_object_ref0 (_tmp21_);
				_g_object_unref0 (server);
				server = _tmp22_;
				_g_object_unref0 (content_directory);
			}
			_g_object_unref0 (service);
		}
		_g_object_unref0 (_service_list);
	}
	result = server;
	_g_object_unref0 (root_device);
	return result;
}


RygelSourceConnectionManager* rygel_source_connection_manager_construct (GType object_type) {
	RygelSourceConnectionManager * self = NULL;
	self = (RygelSourceConnectionManager*) rygel_connection_manager_construct (object_type);
	return self;
}


RygelSourceConnectionManager* rygel_source_connection_manager_new (void) {
	return rygel_source_connection_manager_construct (RYGEL_TYPE_SOURCE_CONNECTION_MANAGER);
}


static void rygel_source_connection_manager_class_init (RygelSourceConnectionManagerClass * klass) {
	rygel_source_connection_manager_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructed = rygel_source_connection_manager_real_constructed;
}


static void rygel_source_connection_manager_instance_init (RygelSourceConnectionManager * self) {
}


/**
 * UPnP ConnectionManager service for serving end-points (MediaServer).
 */
GType rygel_source_connection_manager_get_type (void) {
	static volatile gsize rygel_source_connection_manager_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_source_connection_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelSourceConnectionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_source_connection_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelSourceConnectionManager), 0, (GInstanceInitFunc) rygel_source_connection_manager_instance_init, NULL };
		GType rygel_source_connection_manager_type_id;
		rygel_source_connection_manager_type_id = g_type_register_static (RYGEL_TYPE_CONNECTION_MANAGER, "RygelSourceConnectionManager", &g_define_type_info, 0);
		g_once_init_leave (&rygel_source_connection_manager_type_id__volatile, rygel_source_connection_manager_type_id);
	}
	return rygel_source_connection_manager_type_id__volatile;
}



