/* rygel-external-plugin.c generated by valac 0.42.2, 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.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 <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;
enum  {
	RYGEL_EXTERNAL_PLUGIN_0_PROPERTY,
	RYGEL_EXTERNAL_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* rygel_external_plugin_properties[RYGEL_EXTERNAL_PLUGIN_NUM_PROPERTIES];

#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;
#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;
	RygelExternalContainer* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	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_ = rygel_external_container_new ("0", title, child_count, searchable, service_name, root_object, NULL, &_inner_error_);
	root_container = _tmp0_;
	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;
		}
	}
	_tmp1_ = g_strconcat ("Rygel External ", title, NULL);
	_tmp2_ = _tmp1_;
	self = (RygelExternalPlugin*) rygel_media_server_plugin_construct (object_type, (RygelMediaContainer*) root_container, service_name, _tmp2_, RYGEL_PLUGIN_CAPABILITIES_NONE);
	_g_free0 (_tmp2_);
	if (icon != NULL) {
		rygel_plugin_add_icon ((RygelPlugin*) self, icon);
	}
	_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;
}



