/* dbus_bug792277.c generated by valac, the Vala compiler
 * generated from dbus_bug792277.vala, do not modify */

#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_IFOO (ifoo_get_type ())
#define IFOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IFOO, IFoo))
#define IS_IFOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IFOO))
#define IFOO_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_IFOO, IFooIface))

typedef struct _IFoo IFoo;
typedef struct _IFooIface IFooIface;

#define TYPE_IFOO_PROXY (ifoo_proxy_get_type ())
typedef GDBusProxy IFooProxy;
typedef GDBusProxyClass IFooProxyClass;

#define TYPE_FOO (foo_get_type ())
#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))

typedef struct _Foo Foo;
typedef struct _FooClass FooClass;
typedef struct _FooPrivate FooPrivate;
enum  {
	FOO_0_PROPERTY,
	FOO_NUM_PROPERTIES
};
static GParamSpec* foo_properties[FOO_NUM_PROPERTIES];

struct _IFooIface {
	GTypeInterface parent_iface;
	void (*method0) (IFoo* self, GError** error);
	void (*method1) (IFoo* self, GError** error);
	void (*method2) (IFoo* self);
};

struct _Foo {
	GObject parent_instance;
	FooPrivate * priv;
};

struct _FooClass {
	GObjectClass parent_class;
};

static gpointer foo_parent_class = NULL;

VALA_EXTERN GType ifoo_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint ifoo_register_object (void* object,
                            GDBusConnection* connection,
                            const gchar* path,
                            GError** error);
VALA_EXTERN GType ifoo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (IFoo, g_object_unref)
VALA_EXTERN void ifoo_method0 (IFoo* self,
                   GError** error);
VALA_EXTERN void ifoo_method1 (IFoo* self,
                   GError** error);
VALA_EXTERN void ifoo_method2 (IFoo* self);
static GType ifoo_get_type_once (void);
static void ifoo_proxy_g_signal (GDBusProxy* proxy,
                          const gchar* sender_name,
                          const gchar* signal_name,
                          GVariant* parameters);
static void ifoo_proxy_method0 (IFoo* self,
                         GError** error);
static void ifoo_proxy_method1 (IFoo* self,
                         GError** error);
static void ifoo_proxy_method2 (IFoo* self);
static void ifoo_proxy_ifoo_interface_init (IFooIface* iface);
static void _dbus_ifoo_method0 (IFoo* self,
                         GVariant* _parameters_,
                         GDBusMethodInvocation* invocation);
static void _dbus_ifoo_method1 (IFoo* self,
                         GVariant* _parameters_,
                         GDBusMethodInvocation* invocation);
static void ifoo_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* ifoo_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 ifoo_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 _ifoo_unregister_object (gpointer user_data);
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, g_object_unref)
VALA_EXTERN guint foo_register_object (void* object,
                           GDBusConnection* connection,
                           const gchar* path,
                           GError** error);
VALA_EXTERN void foo_method0 (Foo* self,
                  GError** error);
VALA_EXTERN void foo_method1 (Foo* self,
                  GError** error);
VALA_EXTERN void foo_method2 (Foo* self);
VALA_EXTERN Foo* foo_new (void);
VALA_EXTERN Foo* foo_construct (GType object_type);
static GType foo_get_type_once (void);
static void _dbus_foo_method0 (Foo* self,
                        GVariant* _parameters_,
                        GDBusMethodInvocation* invocation);
static void _dbus_foo_method1 (Foo* self,
                        GVariant* _parameters_,
                        GDBusMethodInvocation* invocation);
static void foo_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* foo_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 foo_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 _foo_unregister_object (gpointer user_data);
static void _vala_main (void);

static const GDBusArgInfo * const _ifoo_dbus_arg_info_method0_in[] = {NULL};
static const GDBusArgInfo * const _ifoo_dbus_arg_info_method0_out[] = {NULL};
static const GDBusMethodInfo _ifoo_dbus_method_info_method0 = {-1, "Method0", (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method0_in), (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method0_out), NULL};
static const GDBusArgInfo * const _ifoo_dbus_arg_info_method1_in[] = {NULL};
static const GDBusArgInfo * const _ifoo_dbus_arg_info_method1_out[] = {NULL};
static const GDBusMethodInfo _ifoo_dbus_method_info_method1 = {-1, "Method1", (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method1_in), (GDBusArgInfo **) (&_ifoo_dbus_arg_info_method1_out), NULL};
static const GDBusMethodInfo * const _ifoo_dbus_method_info[] = {&_ifoo_dbus_method_info_method0, &_ifoo_dbus_method_info_method1, NULL};
static const GDBusSignalInfo * const _ifoo_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _ifoo_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _ifoo_dbus_interface_info = {-1, "org.example.IFoo", (GDBusMethodInfo **) (&_ifoo_dbus_method_info), (GDBusSignalInfo **) (&_ifoo_dbus_signal_info), (GDBusPropertyInfo **) (&_ifoo_dbus_property_info), NULL};
static const GDBusInterfaceVTable _ifoo_dbus_interface_vtable = {ifoo_dbus_interface_method_call, ifoo_dbus_interface_get_property, ifoo_dbus_interface_set_property};
static const GDBusArgInfo * const _foo_dbus_arg_info_method0_in[] = {NULL};
static const GDBusArgInfo * const _foo_dbus_arg_info_method0_out[] = {NULL};
static const GDBusMethodInfo _foo_dbus_method_info_method0 = {-1, "Method0", (GDBusArgInfo **) (&_foo_dbus_arg_info_method0_in), (GDBusArgInfo **) (&_foo_dbus_arg_info_method0_out), NULL};
static const GDBusArgInfo * const _foo_dbus_arg_info_method1_in[] = {NULL};
static const GDBusArgInfo * const _foo_dbus_arg_info_method1_out[] = {NULL};
static const GDBusMethodInfo _foo_dbus_method_info_method1 = {-1, "Method1", (GDBusArgInfo **) (&_foo_dbus_arg_info_method1_in), (GDBusArgInfo **) (&_foo_dbus_arg_info_method1_out), NULL};
static const GDBusMethodInfo * const _foo_dbus_method_info[] = {&_foo_dbus_method_info_method0, &_foo_dbus_method_info_method1, NULL};
static const GDBusSignalInfo * const _foo_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _foo_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _foo_dbus_interface_info = {-1, "org.example.Foo", (GDBusMethodInfo **) (&_foo_dbus_method_info), (GDBusSignalInfo **) (&_foo_dbus_signal_info), (GDBusPropertyInfo **) (&_foo_dbus_property_info), NULL};
static const GDBusInterfaceVTable _foo_dbus_interface_vtable = {foo_dbus_interface_method_call, foo_dbus_interface_get_property, foo_dbus_interface_set_property};

void
ifoo_method0 (IFoo* self,
              GError** error)
{
	IFooIface* _iface_;
	g_return_if_fail (IS_IFOO (self));
	_iface_ = IFOO_GET_INTERFACE (self);
	if (_iface_->method0) {
		_iface_->method0 (self, error);
	}
}

void
ifoo_method1 (IFoo* self,
              GError** error)
{
	IFooIface* _iface_;
	g_return_if_fail (IS_IFOO (self));
	_iface_ = IFOO_GET_INTERFACE (self);
	if (_iface_->method1) {
		_iface_->method1 (self, error);
	}
}

void
ifoo_method2 (IFoo* self)
{
	IFooIface* _iface_;
	g_return_if_fail (IS_IFOO (self));
	_iface_ = IFOO_GET_INTERFACE (self);
	if (_iface_->method2) {
		_iface_->method2 (self);
	}
}

static void
ifoo_default_init (IFooIface * iface,
                   gpointer iface_data)
{
}

static GType
ifoo_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (IFooIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ifoo_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType ifoo_type_id;
	ifoo_type_id = g_type_register_static (G_TYPE_INTERFACE, "IFoo", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (ifoo_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) ifoo_proxy_get_type);
	g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.example.IFoo");
	g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_ifoo_dbus_interface_info));
	g_type_set_qdata (ifoo_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) ifoo_register_object);
	return ifoo_type_id;
}

GType
ifoo_get_type (void)
{
	static volatile gsize ifoo_type_id__once = 0;
	if (g_once_init_enter (&ifoo_type_id__once)) {
		GType ifoo_type_id;
		ifoo_type_id = ifoo_get_type_once ();
		g_once_init_leave (&ifoo_type_id__once, ifoo_type_id);
	}
	return ifoo_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (IFooProxy, ifoo_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_IFOO, ifoo_proxy_ifoo_interface_init) )
static void
ifoo_proxy_class_init (IFooProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = ifoo_proxy_g_signal;
}

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

static void
ifoo_proxy_init (IFooProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_ifoo_dbus_interface_info));
}

static void
ifoo_proxy_method0 (IFoo* self,
                    GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.IFoo", "Method0");
	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
ifoo_proxy_method1 (IFoo* self,
                    GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_DBUS_ERROR;
	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.example.IFoo", "Method1");
	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
ifoo_proxy_method2 (IFoo* self)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.IFoo", "Method2");
	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, NULL);
	g_object_unref (_message);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, NULL)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
ifoo_proxy_ifoo_interface_init (IFooIface* iface)
{
	iface->method0 = ifoo_proxy_method0;
	iface->method1 = ifoo_proxy_method1;
	iface->method2 = ifoo_proxy_method2;
}

static void
_dbus_ifoo_method0 (IFoo* self,
                    GVariant* _parameters_,
                    GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	ifoo_method0 (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (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
_dbus_ifoo_method1 (IFoo* self,
                    GVariant* _parameters_,
                    GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	ifoo_method1 (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (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
ifoo_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, "Method0") == 0) {
		_dbus_ifoo_method0 (object, parameters, invocation);
	} else if (strcmp (method_name, "Method1") == 0) {
		_dbus_ifoo_method1 (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
ifoo_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
ifoo_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
ifoo_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 *) (&_ifoo_dbus_interface_info), &_ifoo_dbus_interface_vtable, data, _ifoo_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_ifoo_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);
}

void
foo_method0 (Foo* self,
             GError** error)
{
	g_return_if_fail (IS_FOO (self));
}

void
foo_method1 (Foo* self,
             GError** error)
{
	g_return_if_fail (IS_FOO (self));
}

void
foo_method2 (Foo* self)
{
	g_return_if_fail (IS_FOO (self));
}

Foo*
foo_construct (GType object_type)
{
	Foo * self = NULL;
	self = (Foo*) g_object_new (object_type, NULL);
	return self;
}

Foo*
foo_new (void)
{
	return foo_construct (TYPE_FOO);
}

static void
foo_class_init (FooClass * klass,
                gpointer klass_data)
{
	foo_parent_class = g_type_class_peek_parent (klass);
}

static void
foo_instance_init (Foo * self,
                   gpointer klass)
{
}

static GType
foo_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, NULL };
	GType foo_type_id;
	foo_type_id = g_type_register_static (G_TYPE_OBJECT, "Foo", &g_define_type_info, 0);
	g_type_set_qdata (foo_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) foo_register_object);
	return foo_type_id;
}

GType
foo_get_type (void)
{
	static volatile gsize foo_type_id__once = 0;
	if (g_once_init_enter (&foo_type_id__once)) {
		GType foo_type_id;
		foo_type_id = foo_get_type_once ();
		g_once_init_leave (&foo_type_id__once, foo_type_id);
	}
	return foo_type_id__once;
}

static void
_dbus_foo_method0 (Foo* self,
                   GVariant* _parameters_,
                   GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	foo_method0 (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (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
_dbus_foo_method1 (Foo* self,
                   GVariant* _parameters_,
                   GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	foo_method1 (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (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
foo_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, "Method0") == 0) {
		_dbus_foo_method0 (object, parameters, invocation);
	} else if (strcmp (method_name, "Method1") == 0) {
		_dbus_foo_method1 (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
foo_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
foo_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
foo_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 *) (&_foo_dbus_interface_info), &_foo_dbus_interface_vtable, data, _foo_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_foo_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);
}

static void
_vala_main (void)
{
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}

