/* rygel-dbus-interface.c generated by valac 0.25.1.16-16e7a, the Vala compiler
 * generated from rygel-dbus-interface.vala, do not modify */

/*
 * Copyright (C) 2008,2010 Nokia Corporation.
 * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *
 * 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 <gio/gio.h>
#include <stdlib.h>
#include <string.h>


#define RYGEL_TYPE_DBUS_INTERFACE (rygel_dbus_interface_get_type ())
#define RYGEL_DBUS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_DBUS_INTERFACE, RygelDBusInterface))
#define RYGEL_IS_DBUS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_DBUS_INTERFACE))
#define RYGEL_DBUS_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TYPE_DBUS_INTERFACE, RygelDBusInterfaceIface))

typedef struct _RygelDBusInterface RygelDBusInterface;
typedef struct _RygelDBusInterfaceIface RygelDBusInterfaceIface;

#define RYGEL_TYPE_DBUS_INTERFACE_PROXY (rygel_dbus_interface_proxy_get_type ())
typedef GDBusProxy RygelDBusInterfaceProxy;
typedef GDBusProxyClass RygelDBusInterfaceProxyClass;

struct _RygelDBusInterfaceIface {
	GTypeInterface parent_iface;
	void (*shutdown) (RygelDBusInterface* self, GError** error);
};



GType rygel_dbus_interface_proxy_get_type (void) G_GNUC_CONST;
guint rygel_dbus_interface_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType rygel_dbus_interface_get_type (void) G_GNUC_CONST;
void rygel_dbus_interface_shutdown (RygelDBusInterface* self, GError** error);
#define RYGEL_DBUS_INTERFACE_SERVICE_NAME "org.gnome.Rygel1"
#define RYGEL_DBUS_INTERFACE_OBJECT_PATH "/org/gnome/Rygel1"
static void rygel_dbus_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
static void rygel_dbus_interface_proxy_shutdown (RygelDBusInterface* self, GError** error);
static void rygel_dbus_interface_proxy_rygel_dbus_interface_interface_init (RygelDBusInterfaceIface* iface);
static void _dbus_rygel_dbus_interface_shutdown (RygelDBusInterface* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void rygel_dbus_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
static GVariant* rygel_dbus_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
static gboolean rygel_dbus_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
static void _rygel_dbus_interface_unregister_object (gpointer user_data);

static const GDBusArgInfo * const _rygel_dbus_interface_dbus_arg_info_shutdown_in[] = {NULL};
static const GDBusArgInfo * const _rygel_dbus_interface_dbus_arg_info_shutdown_out[] = {NULL};
static const GDBusMethodInfo _rygel_dbus_interface_dbus_method_info_shutdown = {-1, "Shutdown", (GDBusArgInfo **) (&_rygel_dbus_interface_dbus_arg_info_shutdown_in), (GDBusArgInfo **) (&_rygel_dbus_interface_dbus_arg_info_shutdown_out)};
static const GDBusMethodInfo * const _rygel_dbus_interface_dbus_method_info[] = {&_rygel_dbus_interface_dbus_method_info_shutdown, NULL};
static const GDBusSignalInfo * const _rygel_dbus_interface_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _rygel_dbus_interface_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _rygel_dbus_interface_dbus_interface_info = {-1, "org.gnome.Rygel1", (GDBusMethodInfo **) (&_rygel_dbus_interface_dbus_method_info), (GDBusSignalInfo **) (&_rygel_dbus_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_rygel_dbus_interface_dbus_property_info)};
static const GDBusInterfaceVTable _rygel_dbus_interface_dbus_interface_vtable = {rygel_dbus_interface_dbus_interface_method_call, rygel_dbus_interface_dbus_interface_get_property, rygel_dbus_interface_dbus_interface_set_property};

void rygel_dbus_interface_shutdown (RygelDBusInterface* self, GError** error) {
	g_return_if_fail (self != NULL);
	RYGEL_DBUS_INTERFACE_GET_INTERFACE (self)->shutdown (self, error);
}


static void rygel_dbus_interface_base_init (RygelDBusInterfaceIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


GType rygel_dbus_interface_get_type (void) {
	static volatile gsize rygel_dbus_interface_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_dbus_interface_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelDBusInterfaceIface), (GBaseInitFunc) rygel_dbus_interface_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType rygel_dbus_interface_type_id;
		rygel_dbus_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "RygelDBusInterface", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (rygel_dbus_interface_type_id, G_TYPE_OBJECT);
		g_type_set_qdata (rygel_dbus_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) rygel_dbus_interface_proxy_get_type);
		g_type_set_qdata (rygel_dbus_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.Rygel1");
		g_type_set_qdata (rygel_dbus_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) rygel_dbus_interface_register_object);
		g_once_init_leave (&rygel_dbus_interface_type_id__volatile, rygel_dbus_interface_type_id);
	}
	return rygel_dbus_interface_type_id__volatile;
}


G_DEFINE_TYPE_EXTENDED (RygelDBusInterfaceProxy, rygel_dbus_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (RYGEL_TYPE_DBUS_INTERFACE, rygel_dbus_interface_proxy_rygel_dbus_interface_interface_init) )
static void rygel_dbus_interface_proxy_class_init (RygelDBusInterfaceProxyClass* klass) {
	G_DBUS_PROXY_CLASS (klass)->g_signal = rygel_dbus_interface_proxy_g_signal;
}


static void rygel_dbus_interface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
}


static void rygel_dbus_interface_proxy_init (RygelDBusInterfaceProxy* self) {
}


static void rygel_dbus_interface_proxy_shutdown (RygelDBusInterface* self, GError** error) {
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.Rygel1", "Shutdown");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	_reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}


static void rygel_dbus_interface_proxy_rygel_dbus_interface_interface_init (RygelDBusInterfaceIface* iface) {
	iface->shutdown = rygel_dbus_interface_proxy_shutdown;
}


static void _dbus_rygel_dbus_interface_shutdown (RygelDBusInterface* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	rygel_dbus_interface_shutdown (self, &error);
	if (error) {
		g_dbus_method_invocation_return_gerror (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void rygel_dbus_interface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "Shutdown") == 0) {
		_dbus_rygel_dbus_interface_shutdown (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}


static GVariant* rygel_dbus_interface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}


static gboolean rygel_dbus_interface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}


guint rygel_dbus_interface_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_rygel_dbus_interface_dbus_interface_info), &_rygel_dbus_interface_dbus_interface_vtable, data, _rygel_dbus_interface_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void _rygel_dbus_interface_unregister_object (gpointer user_data) {
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}



