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

/*
 * Copyright (c) 2011-2018 elementary LLC. (http://launchpad.net/wingpanel)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU 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 "session.h"
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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

enum  {
	SESSION_END_SESSION_DIALOG_SERVER_0_PROPERTY,
	SESSION_END_SESSION_DIALOG_SERVER_NUM_PROPERTIES
};
static GParamSpec* session_end_session_dialog_server_properties[SESSION_END_SESSION_DIALOG_SERVER_NUM_PROPERTIES];
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	SESSION_END_SESSION_DIALOG_SERVER_SHOW_DIALOG_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_LOGOUT_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_REBOOT_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_SHUTDOWN_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_CANCELED_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_CLOSED_SIGNAL,
	SESSION_END_SESSION_DIALOG_SERVER_NUM_SIGNALS
};
static guint session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_NUM_SIGNALS] = {0};

static gpointer session_end_session_dialog_server_parent_class = NULL;
static SessionEndSessionDialogServer* session_end_session_dialog_server_instance;
static SessionEndSessionDialogServer* session_end_session_dialog_server_instance = NULL;

static void __lambda14_ (GDBusConnection* connection);
static void ___lambda14__gbus_acquired_callback (GDBusConnection* connection,
                                          const gchar* name,
                                          gpointer self);
static void __lambda15_ (void);
static void ___lambda15__gbus_name_acquired_callback (GDBusConnection* connection,
                                               const gchar* name,
                                               gpointer self);
static void __lambda16_ (void);
static void ___lambda16__gbus_name_lost_callback (GDBusConnection* connection,
                                           const gchar* name,
                                           gpointer self);
static SessionEndSessionDialogServer* session_end_session_dialog_server_new (void);
static SessionEndSessionDialogServer* session_end_session_dialog_server_construct (GType object_type);
static void session_end_session_dialog_server_finalize (GObject * obj);
static GType session_end_session_dialog_server_get_type_once (void);
static void _dbus_session_end_session_dialog_server_open (SessionEndSessionDialogServer* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void session_end_session_dialog_server_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* session_end_session_dialog_server_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 session_end_session_dialog_server_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 _dbus_session_end_session_dialog_server_confirmed_logout (GObject* _sender,
                                                               gpointer* _data);
static void _dbus_session_end_session_dialog_server_confirmed_reboot (GObject* _sender,
                                                               gpointer* _data);
static void _dbus_session_end_session_dialog_server_confirmed_shutdown (GObject* _sender,
                                                                 gpointer* _data);
static void _dbus_session_end_session_dialog_server_canceled (GObject* _sender,
                                                       gpointer* _data);
static void _dbus_session_end_session_dialog_server_closed (GObject* _sender,
                                                     gpointer* _data);
static void _session_end_session_dialog_server_unregister_object (gpointer user_data);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GDBusArgInfo _session_end_session_dialog_server_dbus_arg_info_open_type = {-1, "type", "u", NULL};
static const GDBusArgInfo _session_end_session_dialog_server_dbus_arg_info_open_timestamp = {-1, "timestamp", "u", NULL};
static const GDBusArgInfo _session_end_session_dialog_server_dbus_arg_info_open_open_length = {-1, "open_length", "u", NULL};
static const GDBusArgInfo _session_end_session_dialog_server_dbus_arg_info_open_inhibiters = {-1, "inhibiters", "ao", NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_open_in[] = {&_session_end_session_dialog_server_dbus_arg_info_open_type, &_session_end_session_dialog_server_dbus_arg_info_open_timestamp, &_session_end_session_dialog_server_dbus_arg_info_open_open_length, &_session_end_session_dialog_server_dbus_arg_info_open_inhibiters, NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_open_out[] = {NULL};
static const GDBusMethodInfo _session_end_session_dialog_server_dbus_method_info_open = {-1, "Open", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_open_in), (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_open_out), NULL};
static const GDBusMethodInfo * const _session_end_session_dialog_server_dbus_method_info[] = {&_session_end_session_dialog_server_dbus_method_info_open, NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_confirmed_logout[] = {NULL};
static const GDBusSignalInfo _session_end_session_dialog_server_dbus_signal_info_confirmed_logout = {-1, "ConfirmedLogout", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_confirmed_logout), NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_confirmed_reboot[] = {NULL};
static const GDBusSignalInfo _session_end_session_dialog_server_dbus_signal_info_confirmed_reboot = {-1, "ConfirmedReboot", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_confirmed_reboot), NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_confirmed_shutdown[] = {NULL};
static const GDBusSignalInfo _session_end_session_dialog_server_dbus_signal_info_confirmed_shutdown = {-1, "ConfirmedShutdown", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_confirmed_shutdown), NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_canceled[] = {NULL};
static const GDBusSignalInfo _session_end_session_dialog_server_dbus_signal_info_canceled = {-1, "Canceled", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_canceled), NULL};
static const GDBusArgInfo * const _session_end_session_dialog_server_dbus_arg_info_closed[] = {NULL};
static const GDBusSignalInfo _session_end_session_dialog_server_dbus_signal_info_closed = {-1, "Closed", (GDBusArgInfo **) (&_session_end_session_dialog_server_dbus_arg_info_closed), NULL};
static const GDBusSignalInfo * const _session_end_session_dialog_server_dbus_signal_info[] = {&_session_end_session_dialog_server_dbus_signal_info_confirmed_logout, &_session_end_session_dialog_server_dbus_signal_info_confirmed_reboot, &_session_end_session_dialog_server_dbus_signal_info_confirmed_shutdown, &_session_end_session_dialog_server_dbus_signal_info_canceled, &_session_end_session_dialog_server_dbus_signal_info_closed, NULL};
static const GDBusPropertyInfo * const _session_end_session_dialog_server_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _session_end_session_dialog_server_dbus_interface_info = {-1, "io.elementary.wingpanel.session.EndSessionDialog", (GDBusMethodInfo **) (&_session_end_session_dialog_server_dbus_method_info), (GDBusSignalInfo **) (&_session_end_session_dialog_server_dbus_signal_info), (GDBusPropertyInfo **) (&_session_end_session_dialog_server_dbus_property_info), NULL};
static const GDBusInterfaceVTable _session_end_session_dialog_server_dbus_interface_vtable = {session_end_session_dialog_server_dbus_interface_method_call, session_end_session_dialog_server_dbus_interface_get_property, session_end_session_dialog_server_dbus_interface_set_property};

static void
__lambda14_ (GDBusConnection* connection)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (connection != NULL);
	{
		SessionEndSessionDialogServer* _tmp0_;
		_tmp0_ = session_end_session_dialog_server_get_default ();
		session_end_session_dialog_server_register_object (_tmp0_, connection, "/io/elementary/wingpanel/session/EndSessionDialog", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_warning ("EndSessionDialogServer.vala:31: %s", _tmp2_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static void
___lambda14__gbus_acquired_callback (GDBusConnection* connection,
                                     const gchar* name,
                                     gpointer self)
{
	__lambda14_ (connection);
}

static void
__lambda15_ (void)
{
}

static void
___lambda15__gbus_name_acquired_callback (GDBusConnection* connection,
                                          const gchar* name,
                                          gpointer self)
{
	__lambda15_ ();
}

static void
__lambda16_ (void)
{
	g_warning ("EndSessionDialogServer.vala:35: Could not acquire name");
}

static void
___lambda16__gbus_name_lost_callback (GDBusConnection* connection,
                                      const gchar* name,
                                      gpointer self)
{
	__lambda16_ ();
}

void
session_end_session_dialog_server_init (void)
{
	g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "io.elementary.wingpanel.session.EndSessionDialog", G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) ((___lambda14__gbus_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda14__gbus_acquired_callback, NULL, (GClosureNotify) NULL)), (GClosure*) ((___lambda15__gbus_name_acquired_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda15__gbus_name_acquired_callback, NULL, (GClosureNotify) NULL)), (GClosure*) ((___lambda16__gbus_name_lost_callback == NULL) ? NULL : g_cclosure_new ((GCallback) ___lambda16__gbus_name_lost_callback, NULL, (GClosureNotify) NULL)));
}

SessionEndSessionDialogServer*
session_end_session_dialog_server_get_default (void)
{
	SessionEndSessionDialogServer* _tmp0_;
	SessionEndSessionDialogServer* _tmp2_;
	SessionEndSessionDialogServer* result;
	_tmp0_ = session_end_session_dialog_server_instance;
	if (_tmp0_ == NULL) {
		SessionEndSessionDialogServer* _tmp1_;
		_tmp1_ = session_end_session_dialog_server_new ();
		_g_object_unref0 (session_end_session_dialog_server_instance);
		session_end_session_dialog_server_instance = _tmp1_;
	}
	_tmp2_ = session_end_session_dialog_server_instance;
	result = _tmp2_;
	return result;
}

static SessionEndSessionDialogServer*
session_end_session_dialog_server_construct (GType object_type)
{
	SessionEndSessionDialogServer * self = NULL;
	self = (SessionEndSessionDialogServer*) g_object_new (object_type, NULL);
	return self;
}

static SessionEndSessionDialogServer*
session_end_session_dialog_server_new (void)
{
	return session_end_session_dialog_server_construct (SESSION_TYPE_END_SESSION_DIALOG_SERVER);
}

void
session_end_session_dialog_server_open (SessionEndSessionDialogServer* self,
                                        guint type,
                                        guint timestamp,
                                        guint open_length,
                                        char** inhibiters,
                                        gint inhibiters_length1,
                                        GError** error)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (type > ((guint) ((gint) SESSION_WIDGETS_END_SESSION_DIALOG_TYPE_RESTART))) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Hibernate, suspend and hybrid sleep are not supported actions yet");
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	g_signal_emit (self, session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_SHOW_DIALOG_SIGNAL], 0, type);
}

static void
session_end_session_dialog_server_class_init (SessionEndSessionDialogServerClass * klass,
                                              gpointer klass_data)
{
	session_end_session_dialog_server_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = session_end_session_dialog_server_finalize;
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_SHOW_DIALOG_SIGNAL] = g_signal_new ("show-dialog", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_LOGOUT_SIGNAL] = g_signal_new ("confirmed-logout", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_REBOOT_SIGNAL] = g_signal_new ("confirmed-reboot", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_CONFIRMED_SHUTDOWN_SIGNAL] = g_signal_new ("confirmed-shutdown", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_CANCELED_SIGNAL] = g_signal_new ("canceled", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	session_end_session_dialog_server_signals[SESSION_END_SESSION_DIALOG_SERVER_CLOSED_SIGNAL] = g_signal_new ("closed", SESSION_TYPE_END_SESSION_DIALOG_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
session_end_session_dialog_server_instance_init (SessionEndSessionDialogServer * self,
                                                 gpointer klass)
{
}

static void
session_end_session_dialog_server_finalize (GObject * obj)
{
	SessionEndSessionDialogServer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SESSION_TYPE_END_SESSION_DIALOG_SERVER, SessionEndSessionDialogServer);
	G_OBJECT_CLASS (session_end_session_dialog_server_parent_class)->finalize (obj);
}

static GType
session_end_session_dialog_server_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SessionEndSessionDialogServerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) session_end_session_dialog_server_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SessionEndSessionDialogServer), 0, (GInstanceInitFunc) session_end_session_dialog_server_instance_init, NULL };
	GType session_end_session_dialog_server_type_id;
	session_end_session_dialog_server_type_id = g_type_register_static (G_TYPE_OBJECT, "SessionEndSessionDialogServer", &g_define_type_info, 0);
	g_type_set_qdata (session_end_session_dialog_server_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) session_end_session_dialog_server_register_object);
	return session_end_session_dialog_server_type_id;
}

GType
session_end_session_dialog_server_get_type (void)
{
	static volatile gsize session_end_session_dialog_server_type_id__once = 0;
	if (g_once_init_enter (&session_end_session_dialog_server_type_id__once)) {
		GType session_end_session_dialog_server_type_id;
		session_end_session_dialog_server_type_id = session_end_session_dialog_server_get_type_once ();
		g_once_init_leave (&session_end_session_dialog_server_type_id__once, session_end_session_dialog_server_type_id);
	}
	return session_end_session_dialog_server_type_id__once;
}

static void
_dbus_session_end_session_dialog_server_open (SessionEndSessionDialogServer* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint type = 0U;
	GVariant* _tmp21_;
	guint timestamp = 0U;
	GVariant* _tmp22_;
	guint open_length = 0U;
	GVariant* _tmp23_;
	char** inhibiters = NULL;
	gint inhibiters_length1 = 0;
	GVariant* _tmp24_;
	char** _tmp25_;
	gint _tmp25__length;
	gint _tmp25__size;
	gint _tmp25__length1;
	GVariantIter _tmp26_;
	GVariant* _tmp27_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp21_ = g_variant_iter_next_value (&_arguments_iter);
	type = g_variant_get_uint32 (_tmp21_);
	g_variant_unref (_tmp21_);
	_tmp22_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp22_);
	g_variant_unref (_tmp22_);
	_tmp23_ = g_variant_iter_next_value (&_arguments_iter);
	open_length = g_variant_get_uint32 (_tmp23_);
	g_variant_unref (_tmp23_);
	_tmp24_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp25_ = g_new (char*, 5);
	_tmp25__length = 0;
	_tmp25__size = 4;
	_tmp25__length1 = 0;
	g_variant_iter_init (&_tmp26_, _tmp24_);
	for (; (_tmp27_ = g_variant_iter_next_value (&_tmp26_)) != NULL; _tmp25__length1++) {
		if (_tmp25__size == _tmp25__length) {
			_tmp25__size = 2 * _tmp25__size;
			_tmp25_ = g_renew (char*, _tmp25_, _tmp25__size + 1);
		}
		_tmp25_[_tmp25__length++] = g_variant_dup_string (_tmp27_, NULL);
		g_variant_unref (_tmp27_);
	}
	inhibiters_length1 = _tmp25__length1;
	_tmp25_[_tmp25__length] = NULL;
	inhibiters = _tmp25_;
	g_variant_unref (_tmp24_);
	session_end_session_dialog_server_open (self, type, timestamp, open_length, inhibiters, inhibiters_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	inhibiters = (_vala_array_free (inhibiters, inhibiters_length1, (GDestroyNotify) g_free), NULL);
	;
}

static void
session_end_session_dialog_server_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, "Open") == 0) {
		_dbus_session_end_session_dialog_server_open (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
session_end_session_dialog_server_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)
{
	return NULL;
}

static gboolean
session_end_session_dialog_server_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)
{
	return FALSE;
}

static void
_dbus_session_end_session_dialog_server_confirmed_logout (GObject* _sender,
                                                          gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.wingpanel.session.EndSessionDialog", "ConfirmedLogout", _arguments, NULL);
}

static void
_dbus_session_end_session_dialog_server_confirmed_reboot (GObject* _sender,
                                                          gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.wingpanel.session.EndSessionDialog", "ConfirmedReboot", _arguments, NULL);
}

static void
_dbus_session_end_session_dialog_server_confirmed_shutdown (GObject* _sender,
                                                            gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.wingpanel.session.EndSessionDialog", "ConfirmedShutdown", _arguments, NULL);
}

static void
_dbus_session_end_session_dialog_server_canceled (GObject* _sender,
                                                  gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.wingpanel.session.EndSessionDialog", "Canceled", _arguments, NULL);
}

static void
_dbus_session_end_session_dialog_server_closed (GObject* _sender,
                                                gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.wingpanel.session.EndSessionDialog", "Closed", _arguments, NULL);
}

guint
session_end_session_dialog_server_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 *) (&_session_end_session_dialog_server_dbus_interface_info), &_session_end_session_dialog_server_dbus_interface_vtable, data, _session_end_session_dialog_server_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "confirmed-logout", (GCallback) _dbus_session_end_session_dialog_server_confirmed_logout, data);
	g_signal_connect (object, "confirmed-reboot", (GCallback) _dbus_session_end_session_dialog_server_confirmed_reboot, data);
	g_signal_connect (object, "confirmed-shutdown", (GCallback) _dbus_session_end_session_dialog_server_confirmed_shutdown, data);
	g_signal_connect (object, "canceled", (GCallback) _dbus_session_end_session_dialog_server_canceled, data);
	g_signal_connect (object, "closed", (GCallback) _dbus_session_end_session_dialog_server_closed, data);
	return result;
}

static void
_session_end_session_dialog_server_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_session_end_session_dialog_server_confirmed_logout, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_session_end_session_dialog_server_confirmed_reboot, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_session_end_session_dialog_server_confirmed_shutdown, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_session_end_session_dialog_server_canceled, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_session_end_session_dialog_server_closed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

