/* rygel-external-plugin.c generated by valac 0.56.1, 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 "rygel-external.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "rygel-core.h"
#include <gio/gio.h>
#include "rygel-server.h"

enum  {
	RYGEL_EXTERNAL_PLUGIN_0_PROPERTY,
	RYGEL_EXTERNAL_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* rygel_external_plugin_properties[RYGEL_EXTERNAL_PLUGIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

static gpointer rygel_external_plugin_parent_class = NULL;

static GType rygel_external_plugin_get_type_once (void);

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_error0_ = 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_error0_);
	root_container = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			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;
		}
	}
	_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,
                                  gpointer klass_data)
{
	rygel_external_plugin_parent_class = g_type_class_peek_parent (klass);
}

static void
rygel_external_plugin_instance_init (RygelExternalPlugin * self,
                                     gpointer klass)
{
}

static GType
rygel_external_plugin_get_type_once (void)
{
	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);
	return rygel_external_plugin_type_id;
}

GType
rygel_external_plugin_get_type (void)
{
	static volatile gsize rygel_external_plugin_type_id__once = 0;
	if (g_once_init_enter (&rygel_external_plugin_type_id__once)) {
		GType rygel_external_plugin_type_id;
		rygel_external_plugin_type_id = rygel_external_plugin_get_type_once ();
		g_once_init_leave (&rygel_external_plugin_type_id__once, rygel_external_plugin_type_id);
	}
	return rygel_external_plugin_type_id__once;
}

