/* rygel-external-plugin.c generated by valac 0.25.3.10-37e0, the Vala compiler
 * generated from rygel-external-plugin.vala, do not modify */

/*
 * Copyright (C) 2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2009 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.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-server.h>
#include <stdlib.h>
#include <string.h>
#include <rygel-core.h>
#include <gio/gio.h>


#define RYGEL_EXTERNAL_TYPE_PLUGIN (rygel_external_plugin_get_type ())
#define RYGEL_EXTERNAL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_EXTERNAL_TYPE_PLUGIN, RygelExternalPlugin))
#define RYGEL_EXTERNAL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_EXTERNAL_TYPE_PLUGIN, RygelExternalPluginClass))
#define RYGEL_EXTERNAL_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_EXTERNAL_TYPE_PLUGIN))
#define RYGEL_EXTERNAL_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_EXTERNAL_TYPE_PLUGIN))
#define RYGEL_EXTERNAL_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_EXTERNAL_TYPE_PLUGIN, RygelExternalPluginClass))

typedef struct _RygelExternalPlugin RygelExternalPlugin;
typedef struct _RygelExternalPluginClass RygelExternalPluginClass;
typedef struct _RygelExternalPluginPrivate RygelExternalPluginPrivate;

#define RYGEL_EXTERNAL_TYPE_CONTAINER (rygel_external_container_get_type ())
#define RYGEL_EXTERNAL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_EXTERNAL_TYPE_CONTAINER, RygelExternalContainer))
#define RYGEL_EXTERNAL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_EXTERNAL_TYPE_CONTAINER, RygelExternalContainerClass))
#define RYGEL_EXTERNAL_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_EXTERNAL_TYPE_CONTAINER))
#define RYGEL_EXTERNAL_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_EXTERNAL_TYPE_CONTAINER))
#define RYGEL_EXTERNAL_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_EXTERNAL_TYPE_CONTAINER, RygelExternalContainerClass))

typedef struct _RygelExternalContainer RygelExternalContainer;
typedef struct _RygelExternalContainerClass RygelExternalContainerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _RygelExternalPlugin {
	RygelMediaServerPlugin parent_instance;
	RygelExternalPluginPrivate * priv;
};

struct _RygelExternalPluginClass {
	RygelMediaServerPluginClass parent_class;
};


static gpointer rygel_external_plugin_parent_class = NULL;

GType rygel_external_plugin_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_EXTERNAL_PLUGIN_DUMMY_PROPERTY
};
#define RYGEL_EXTERNAL_PLUGIN_MODULE_NAME "External"
RygelExternalPlugin* rygel_external_plugin_new (const gchar* service_name, const gchar* title, guint child_count, gboolean searchable, const gchar* root_object, RygelIconInfo* icon, GError** error);
RygelExternalPlugin* rygel_external_plugin_construct (GType object_type, const gchar* service_name, const gchar* title, guint child_count, gboolean searchable, const gchar* root_object, RygelIconInfo* icon, GError** error);
GType rygel_external_container_get_type (void) G_GNUC_CONST;
RygelExternalContainer* rygel_external_container_new (const gchar* id, const gchar* title, guint child_count, gboolean searchable, const gchar* service_name, const gchar* path, RygelExternalContainer* parent, GError** error);
RygelExternalContainer* rygel_external_container_construct (GType object_type, const gchar* id, const gchar* title, guint child_count, gboolean searchable, const gchar* service_name, const gchar* path, RygelExternalContainer* parent, GError** error);


RygelExternalPlugin* rygel_external_plugin_construct (GType object_type, const gchar* service_name, const gchar* title, guint child_count, gboolean searchable, const gchar* root_object, RygelIconInfo* icon, GError** error) {
	RygelExternalPlugin * self = NULL;
	RygelExternalContainer* root_container = NULL;
	const gchar* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	RygelExternalContainer* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	RygelIconInfo* _tmp10_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (service_name != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (root_object != NULL, NULL);
	_tmp0_ = title;
	_tmp1_ = child_count;
	_tmp2_ = searchable;
	_tmp3_ = service_name;
	_tmp4_ = root_object;
	_tmp5_ = rygel_external_container_new ("0", _tmp0_, _tmp1_, _tmp2_, _tmp3_, _tmp4_, NULL, &_inner_error_);
	root_container = _tmp5_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if (_inner_error_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	_tmp6_ = service_name;
	_tmp7_ = title;
	_tmp8_ = g_strconcat ("Rygel External ", _tmp7_, NULL);
	_tmp9_ = _tmp8_;
	self = (RygelExternalPlugin*) rygel_media_server_plugin_construct (object_type, (RygelMediaContainer*) root_container, _tmp6_, _tmp9_, RYGEL_PLUGIN_CAPABILITIES_NONE);
	_g_free0 (_tmp9_);
	_tmp10_ = icon;
	if (_tmp10_ != NULL) {
		RygelIconInfo* _tmp11_ = NULL;
		_tmp11_ = icon;
		rygel_plugin_add_icon ((RygelPlugin*) self, _tmp11_);
	}
	_g_object_unref0 (root_container);
	return self;
}


RygelExternalPlugin* rygel_external_plugin_new (const gchar* service_name, const gchar* title, guint child_count, gboolean searchable, const gchar* root_object, RygelIconInfo* icon, GError** error) {
	return rygel_external_plugin_construct (RYGEL_EXTERNAL_TYPE_PLUGIN, service_name, title, child_count, searchable, root_object, icon, error);
}


static void rygel_external_plugin_class_init (RygelExternalPluginClass * klass) {
	rygel_external_plugin_parent_class = g_type_class_peek_parent (klass);
}


static void rygel_external_plugin_instance_init (RygelExternalPlugin * self) {
}


GType rygel_external_plugin_get_type (void) {
	static volatile gsize rygel_external_plugin_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_external_plugin_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelExternalPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_external_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelExternalPlugin), 0, (GInstanceInitFunc) rygel_external_plugin_instance_init, NULL };
		GType rygel_external_plugin_type_id;
		rygel_external_plugin_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_SERVER_PLUGIN, "RygelExternalPlugin", &g_define_type_info, 0);
		g_once_init_leave (&rygel_external_plugin_type_id__volatile, rygel_external_plugin_type_id);
	}
	return rygel_external_plugin_type_id__volatile;
}



