/* rygel-ruih-server.c generated by valac 0.30.0.35-2c9e8, the Vala compiler
 * generated from rygel-ruih-server.vala, do not modify */

/*
 * Copyright (C) 2013  Cable Television Laboratories, Inc.
 *
 * Author: Neha Shanbhag <N.Shanbhag@cablelabs.com>
 * Contact: http://www.cablelabs.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-core.h>
#include <stdlib.h>
#include <string.h>


#define RYGEL_TYPE_RUIH_SERVER_PLUGIN (rygel_ruih_server_plugin_get_type ())
#define RYGEL_RUIH_SERVER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_RUIH_SERVER_PLUGIN, RygelRuihServerPlugin))
#define RYGEL_RUIH_SERVER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_RUIH_SERVER_PLUGIN, RygelRuihServerPluginClass))
#define RYGEL_IS_RUIH_SERVER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_RUIH_SERVER_PLUGIN))
#define RYGEL_IS_RUIH_SERVER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_RUIH_SERVER_PLUGIN))
#define RYGEL_RUIH_SERVER_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_RUIH_SERVER_PLUGIN, RygelRuihServerPluginClass))

typedef struct _RygelRuihServerPlugin RygelRuihServerPlugin;
typedef struct _RygelRuihServerPluginClass RygelRuihServerPluginClass;
typedef struct _RygelRuihServerPluginPrivate RygelRuihServerPluginPrivate;

#define TYPE_PLUGIN (plugin_get_type ())
#define PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLUGIN, Plugin))
#define PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLUGIN, PluginClass))
#define IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLUGIN))
#define IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLUGIN))
#define PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLUGIN, PluginClass))

typedef struct _Plugin Plugin;
typedef struct _PluginClass PluginClass;
typedef struct _PluginPrivate PluginPrivate;

#define RYGEL_TYPE_RUIH_SERVER (rygel_ruih_server_get_type ())
#define RYGEL_RUIH_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_RUIH_SERVER, RygelRuihServer))
#define RYGEL_RUIH_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_RUIH_SERVER, RygelRuihServerClass))
#define RYGEL_IS_RUIH_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_RUIH_SERVER))
#define RYGEL_IS_RUIH_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_RUIH_SERVER))
#define RYGEL_RUIH_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_RUIH_SERVER, RygelRuihServerClass))

typedef struct _RygelRuihServer RygelRuihServer;
typedef struct _RygelRuihServerClass RygelRuihServerClass;
typedef struct _RygelRuihServerPrivate RygelRuihServerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _RygelRuihServerPlugin {
	RygelPlugin parent_instance;
	RygelRuihServerPluginPrivate * priv;
};

struct _RygelRuihServerPluginClass {
	RygelPluginClass parent_class;
};

struct _Plugin {
	RygelRuihServerPlugin parent_instance;
	PluginPrivate * priv;
};

struct _PluginClass {
	RygelRuihServerPluginClass parent_class;
};

struct _RygelRuihServer {
	RygelMediaDevice parent_instance;
	RygelRuihServerPrivate * priv;
};

struct _RygelRuihServerClass {
	RygelMediaDeviceClass parent_class;
};


static gpointer plugin_parent_class = NULL;
static gpointer rygel_ruih_server_parent_class = NULL;

GType rygel_ruih_server_plugin_get_type (void) G_GNUC_CONST;
GType plugin_get_type (void) G_GNUC_CONST;
enum  {
	PLUGIN_DUMMY_PROPERTY
};
Plugin* plugin_new (RygelPluginCapabilities capabilities);
Plugin* plugin_construct (GType object_type, RygelPluginCapabilities capabilities);
RygelRuihServerPlugin* rygel_ruih_server_plugin_new (const gchar* name, const gchar* title, const gchar* description, RygelPluginCapabilities capabilities);
RygelRuihServerPlugin* rygel_ruih_server_plugin_construct (GType object_type, const gchar* name, const gchar* title, const gchar* description, RygelPluginCapabilities capabilities);
GType rygel_ruih_server_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_RUIH_SERVER_DUMMY_PROPERTY
};
RygelRuihServer* rygel_ruih_server_new (const gchar* title, RygelPluginCapabilities capabilities);
RygelRuihServer* rygel_ruih_server_construct (GType object_type, const gchar* title, RygelPluginCapabilities capabilities);
static void rygel_ruih_server_real_constructed (GObject* base);


Plugin* plugin_construct (GType object_type, RygelPluginCapabilities capabilities) {
	Plugin * self = NULL;
	RygelPluginCapabilities _tmp0_ = 0;
	_tmp0_ = capabilities;
	self = (Plugin*) rygel_ruih_server_plugin_construct (object_type, "LibRygelRuih", "LibRygelRuih", NULL, _tmp0_);
	return self;
}


Plugin* plugin_new (RygelPluginCapabilities capabilities) {
	return plugin_construct (TYPE_PLUGIN, capabilities);
}


static void plugin_class_init (PluginClass * klass) {
	plugin_parent_class = g_type_class_peek_parent (klass);
}


static void plugin_instance_init (Plugin * self) {
}


GType plugin_get_type (void) {
	static volatile gsize plugin_type_id__volatile = 0;
	if (g_once_init_enter (&plugin_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Plugin), 0, (GInstanceInitFunc) plugin_instance_init, NULL };
		GType plugin_type_id;
		plugin_type_id = g_type_register_static (RYGEL_TYPE_RUIH_SERVER_PLUGIN, "Plugin", &g_define_type_info, 0);
		g_once_init_leave (&plugin_type_id__volatile, plugin_type_id);
	}
	return plugin_type_id__volatile;
}


/**
     * Create a RuihServer to serve the UIs.
     */
RygelRuihServer* rygel_ruih_server_construct (GType object_type, const gchar* title, RygelPluginCapabilities capabilities) {
	RygelRuihServer * self = NULL;
	const gchar* _tmp0_ = NULL;
	RygelPluginCapabilities _tmp1_ = 0;
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = title;
	_tmp1_ = capabilities;
	self = (RygelRuihServer*) g_object_new (object_type, "title", _tmp0_, "capabilities", _tmp1_, NULL);
	return self;
}


RygelRuihServer* rygel_ruih_server_new (const gchar* title, RygelPluginCapabilities capabilities) {
	return rygel_ruih_server_construct (RYGEL_TYPE_RUIH_SERVER, title, capabilities);
}


static void rygel_ruih_server_real_constructed (GObject* base) {
	RygelRuihServer * self;
	RygelPlugin* _tmp0_ = NULL;
	RygelPlugin* _tmp1_ = NULL;
	RygelPlugin* _tmp6_ = NULL;
	RygelPlugin* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	const gchar* _tmp9_ = NULL;
	self = (RygelRuihServer*) base;
	G_OBJECT_CLASS (rygel_ruih_server_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_TYPE_MEDIA_DEVICE, RygelMediaDevice));
	_tmp0_ = rygel_media_device_get_plugin ((RygelMediaDevice*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		RygelPluginCapabilities _tmp2_ = 0;
		RygelPluginCapabilities _tmp3_ = 0;
		Plugin* _tmp4_ = NULL;
		Plugin* _tmp5_ = NULL;
		_tmp2_ = rygel_media_device_get_capabilities ((RygelMediaDevice*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = plugin_new (_tmp3_);
		_tmp5_ = _tmp4_;
		rygel_media_device_set_plugin ((RygelMediaDevice*) self, (RygelPlugin*) _tmp5_);
		_g_object_unref0 (_tmp5_);
	}
	_tmp6_ = rygel_media_device_get_plugin ((RygelMediaDevice*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = rygel_media_device_get_title ((RygelMediaDevice*) self);
	_tmp9_ = _tmp8_;
	rygel_plugin_set_title (_tmp7_, _tmp9_);
}


static void rygel_ruih_server_class_init (RygelRuihServerClass * klass) {
	rygel_ruih_server_parent_class = g_type_class_peek_parent (klass);
	((GObjectClass *) klass)->constructed = rygel_ruih_server_real_constructed;
}


static void rygel_ruih_server_instance_init (RygelRuihServer * self) {
}


/**
 * This class may be used to implement in-process UPnP RUIH servers.
 *
 * Call rygel_media_device_add_interface () on the RygelRuihServer to allow it
 * to serve requests via that network interface.
 *
 */
GType rygel_ruih_server_get_type (void) {
	static volatile gsize rygel_ruih_server_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_ruih_server_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelRuihServerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_ruih_server_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelRuihServer), 0, (GInstanceInitFunc) rygel_ruih_server_instance_init, NULL };
		GType rygel_ruih_server_type_id;
		rygel_ruih_server_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_DEVICE, "RygelRuihServer", &g_define_type_info, 0);
		g_once_init_leave (&rygel_ruih_server_type_id__volatile, rygel_ruih_server_type_id);
	}
	return rygel_ruih_server_type_id__volatile;
}



