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

/**/
/*  Copyright (C) 2018 Adam Bieńkowski*/
/**/
/*  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 3 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, see <http://www.gnu.org/licenses/>.*/
/**/
/* Reference code by the Solus Project:*/
/* https://github.com/solus-project/budgie-desktop/blob/master/src/wm/shim.vala*/

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

#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 GALA_TYPE_WINGPANEL_END_SESSION_DIALOG (gala_wingpanel_end_session_dialog_get_type ())
#define GALA_WINGPANEL_END_SESSION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, GalaWingpanelEndSessionDialog))
#define GALA_IS_WINGPANEL_END_SESSION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_WINGPANEL_END_SESSION_DIALOG))
#define GALA_WINGPANEL_END_SESSION_DIALOG_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, GalaWingpanelEndSessionDialogIface))

typedef struct _GalaWingpanelEndSessionDialog GalaWingpanelEndSessionDialog;
typedef struct _GalaWingpanelEndSessionDialogIface GalaWingpanelEndSessionDialogIface;

#define GALA_TYPE_WINGPANEL_END_SESSION_DIALOG_PROXY (gala_wingpanel_end_session_dialog_proxy_get_type ())
enum  {
	GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_LOGOUT_SIGNAL,
	GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_REBOOT_SIGNAL,
	GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_SHUTDOWN_SIGNAL,
	GALA_WINGPANEL_END_SESSION_DIALOG_CANCELED_SIGNAL,
	GALA_WINGPANEL_END_SESSION_DIALOG_CLOSED_SIGNAL,
	GALA_WINGPANEL_END_SESSION_DIALOG_NUM_SIGNALS
};
static guint gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_NUM_SIGNALS] = {0};
typedef GDBusProxy GalaWingpanelEndSessionDialogProxy;
typedef GDBusProxyClass GalaWingpanelEndSessionDialogProxyClass;

#define GALA_TYPE_SESSION_MANAGER (gala_session_manager_get_type ())
#define GALA_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_SESSION_MANAGER, GalaSessionManager))
#define GALA_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_SESSION_MANAGER, GalaSessionManagerClass))
#define GALA_IS_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_SESSION_MANAGER))
#define GALA_IS_SESSION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_SESSION_MANAGER))
#define GALA_SESSION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_SESSION_MANAGER, GalaSessionManagerClass))

typedef struct _GalaSessionManager GalaSessionManager;
typedef struct _GalaSessionManagerClass GalaSessionManagerClass;
typedef struct _GalaSessionManagerPrivate GalaSessionManagerPrivate;
enum  {
	GALA_SESSION_MANAGER_0_PROPERTY,
	GALA_SESSION_MANAGER_NUM_PROPERTIES
};
static GParamSpec* gala_session_manager_properties[GALA_SESSION_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	GALA_SESSION_MANAGER_CONFIRMED_LOGOUT_SIGNAL,
	GALA_SESSION_MANAGER_CONFIRMED_REBOOT_SIGNAL,
	GALA_SESSION_MANAGER_CONFIRMED_SHUTDOWN_SIGNAL,
	GALA_SESSION_MANAGER_CANCELED_SIGNAL,
	GALA_SESSION_MANAGER_CLOSED_SIGNAL,
	GALA_SESSION_MANAGER_NUM_SIGNALS
};
static guint gala_session_manager_signals[GALA_SESSION_MANAGER_NUM_SIGNALS] = {0};

struct _GalaWingpanelEndSessionDialogIface {
	GTypeInterface parent_iface;
	void (*open) (GalaWingpanelEndSessionDialog* self, guint type, guint timestamp, guint open_length, char** inhibiters, gint inhibiters_length1, GError** error);
};

struct _GalaSessionManager {
	GObject parent_instance;
	GalaSessionManagerPrivate * priv;
};

struct _GalaSessionManagerClass {
	GObjectClass parent_class;
};

struct _GalaSessionManagerPrivate {
	GalaWingpanelEndSessionDialog* proxy;
};

static gint GalaSessionManager_private_offset;
static gpointer gala_session_manager_parent_class = NULL;
static GalaSessionManager* gala_session_manager_instance;
static GalaSessionManager* gala_session_manager_instance = NULL;

VALA_EXTERN GType gala_wingpanel_end_session_dialog_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint gala_wingpanel_end_session_dialog_register_object (void* object,
                                                         GDBusConnection* connection,
                                                         const gchar* path,
                                                         GError** error);
VALA_EXTERN GType gala_wingpanel_end_session_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaWingpanelEndSessionDialog, g_object_unref)
VALA_EXTERN void gala_wingpanel_end_session_dialog_open (GalaWingpanelEndSessionDialog* self,
                                             guint type,
                                             guint timestamp,
                                             guint open_length,
                                             char** inhibiters,
                                             gint inhibiters_length1,
                                             GError** error);
static GType gala_wingpanel_end_session_dialog_get_type_once (void);
static void gala_wingpanel_end_session_dialog_proxy_g_signal (GDBusProxy* proxy,
                                                       const gchar* sender_name,
                                                       const gchar* signal_name,
                                                       GVariant* parameters);
static void _dbus_handle_gala_wingpanel_end_session_dialog_confirmed_logout (GalaWingpanelEndSessionDialog* self,
                                                                      GVariant* parameters);
static void _dbus_handle_gala_wingpanel_end_session_dialog_confirmed_reboot (GalaWingpanelEndSessionDialog* self,
                                                                      GVariant* parameters);
static void _dbus_handle_gala_wingpanel_end_session_dialog_confirmed_shutdown (GalaWingpanelEndSessionDialog* self,
                                                                        GVariant* parameters);
static void _dbus_handle_gala_wingpanel_end_session_dialog_canceled (GalaWingpanelEndSessionDialog* self,
                                                              GVariant* parameters);
static void _dbus_handle_gala_wingpanel_end_session_dialog_closed (GalaWingpanelEndSessionDialog* self,
                                                            GVariant* parameters);
static void gala_wingpanel_end_session_dialog_proxy_open (GalaWingpanelEndSessionDialog* self,
                                                   guint type,
                                                   guint timestamp,
                                                   guint open_length,
                                                   char** inhibiters,
                                                   gint inhibiters_length1,
                                                   GError** error);
static void gala_wingpanel_end_session_dialog_proxy_gala_wingpanel_end_session_dialog_interface_init (GalaWingpanelEndSessionDialogIface* iface);
static void _dbus_gala_wingpanel_end_session_dialog_open (GalaWingpanelEndSessionDialog* self,
                                                   GVariant* _parameters_,
                                                   GDBusMethodInvocation* invocation);
static void gala_wingpanel_end_session_dialog_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* gala_wingpanel_end_session_dialog_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 gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_confirmed_logout (GObject* _sender,
                                                               gpointer* _data);
static void _dbus_gala_wingpanel_end_session_dialog_confirmed_reboot (GObject* _sender,
                                                               gpointer* _data);
static void _dbus_gala_wingpanel_end_session_dialog_confirmed_shutdown (GObject* _sender,
                                                                 gpointer* _data);
static void _dbus_gala_wingpanel_end_session_dialog_canceled (GObject* _sender,
                                                       gpointer* _data);
static void _dbus_gala_wingpanel_end_session_dialog_closed (GObject* _sender,
                                                     gpointer* _data);
static void _gala_wingpanel_end_session_dialog_unregister_object (gpointer user_data);
VALA_EXTERN GType gala_session_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaSessionManager, g_object_unref)
VALA_EXTERN guint gala_session_manager_register_object (void* object,
                                            GDBusConnection* connection,
                                            const gchar* path,
                                            GError** error);
VALA_EXTERN GalaSessionManager* gala_session_manager_init (void);
static GalaSessionManager* gala_session_manager_new (void);
static GalaSessionManager* gala_session_manager_construct (GType object_type);
static void gala_session_manager_proxy_appeared (GalaSessionManager* self);
static void _gala_session_manager_proxy_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                       const gchar* name,
                                                                       const gchar* name_owner,
                                                                       gpointer self);
static void gala_session_manager_proxy_vanished (GalaSessionManager* self);
static void _gala_session_manager_proxy_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                       const gchar* name,
                                                                       gpointer self);
static void gala_session_manager_get_proxy_cb (GalaSessionManager* self,
                                        GObject* o,
                                        GAsyncResult* res);
static void __lambda179_ (GalaSessionManager* self);
static void ___lambda179__gala_wingpanel_end_session_dialog_confirmed_logout (GalaWingpanelEndSessionDialog* _sender,
                                                                       gpointer self);
static void __lambda180_ (GalaSessionManager* self);
static void ___lambda180__gala_wingpanel_end_session_dialog_confirmed_reboot (GalaWingpanelEndSessionDialog* _sender,
                                                                       gpointer self);
static void __lambda181_ (GalaSessionManager* self);
static void ___lambda181__gala_wingpanel_end_session_dialog_confirmed_shutdown (GalaWingpanelEndSessionDialog* _sender,
                                                                         gpointer self);
static void __lambda182_ (GalaSessionManager* self);
static void ___lambda182__gala_wingpanel_end_session_dialog_canceled (GalaWingpanelEndSessionDialog* _sender,
                                                               gpointer self);
static void __lambda183_ (GalaSessionManager* self);
static void ___lambda183__gala_wingpanel_end_session_dialog_closed (GalaWingpanelEndSessionDialog* _sender,
                                                             gpointer self);
static void _gala_session_manager_get_proxy_cb_gasync_ready_callback (GObject* source_object,
                                                               GAsyncResult* res,
                                                               gpointer self);
VALA_EXTERN void gala_session_manager_open (GalaSessionManager* self,
                                guint type,
                                guint timestamp,
                                guint open_length,
                                char** inhibiters,
                                gint inhibiters_length1,
                                GError** error);
static void gala_session_manager_finalize (GObject * obj);
static GType gala_session_manager_get_type_once (void);
static void _dbus_gala_session_manager_open (GalaSessionManager* self,
                                      GVariant* _parameters_,
                                      GDBusMethodInvocation* invocation);
static void gala_session_manager_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* gala_session_manager_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 gala_session_manager_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_gala_session_manager_confirmed_logout (GObject* _sender,
                                                  gpointer* _data);
static void _dbus_gala_session_manager_confirmed_reboot (GObject* _sender,
                                                  gpointer* _data);
static void _dbus_gala_session_manager_confirmed_shutdown (GObject* _sender,
                                                    gpointer* _data);
static void _dbus_gala_session_manager_canceled (GObject* _sender,
                                          gpointer* _data);
static void _dbus_gala_session_manager_closed (GObject* _sender,
                                        gpointer* _data);
static void _gala_session_manager_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 inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo _gala_wingpanel_end_session_dialog_dbus_arg_info_open_type = {-1, "type", "u", NULL};
static const GDBusArgInfo _gala_wingpanel_end_session_dialog_dbus_arg_info_open_timestamp = {-1, "timestamp", "u", NULL};
static const GDBusArgInfo _gala_wingpanel_end_session_dialog_dbus_arg_info_open_open_length = {-1, "open_length", "u", NULL};
static const GDBusArgInfo _gala_wingpanel_end_session_dialog_dbus_arg_info_open_inhibiters = {-1, "inhibiters", "ao", NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_open_in[] = {&_gala_wingpanel_end_session_dialog_dbus_arg_info_open_type, &_gala_wingpanel_end_session_dialog_dbus_arg_info_open_timestamp, &_gala_wingpanel_end_session_dialog_dbus_arg_info_open_open_length, &_gala_wingpanel_end_session_dialog_dbus_arg_info_open_inhibiters, NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_open_out[] = {NULL};
static const GDBusMethodInfo _gala_wingpanel_end_session_dialog_dbus_method_info_open = {-1, "Open", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_open_in), (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_open_out), NULL};
static const GDBusMethodInfo * const _gala_wingpanel_end_session_dialog_dbus_method_info[] = {&_gala_wingpanel_end_session_dialog_dbus_method_info_open, NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_logout[] = {NULL};
static const GDBusSignalInfo _gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_logout = {-1, "ConfirmedLogout", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_logout), NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_reboot[] = {NULL};
static const GDBusSignalInfo _gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_reboot = {-1, "ConfirmedReboot", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_reboot), NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_shutdown[] = {NULL};
static const GDBusSignalInfo _gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_shutdown = {-1, "ConfirmedShutdown", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_confirmed_shutdown), NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_canceled[] = {NULL};
static const GDBusSignalInfo _gala_wingpanel_end_session_dialog_dbus_signal_info_canceled = {-1, "Canceled", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_canceled), NULL};
static const GDBusArgInfo * const _gala_wingpanel_end_session_dialog_dbus_arg_info_closed[] = {NULL};
static const GDBusSignalInfo _gala_wingpanel_end_session_dialog_dbus_signal_info_closed = {-1, "Closed", (GDBusArgInfo **) (&_gala_wingpanel_end_session_dialog_dbus_arg_info_closed), NULL};
static const GDBusSignalInfo * const _gala_wingpanel_end_session_dialog_dbus_signal_info[] = {&_gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_logout, &_gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_reboot, &_gala_wingpanel_end_session_dialog_dbus_signal_info_confirmed_shutdown, &_gala_wingpanel_end_session_dialog_dbus_signal_info_canceled, &_gala_wingpanel_end_session_dialog_dbus_signal_info_closed, NULL};
static const GDBusPropertyInfo * const _gala_wingpanel_end_session_dialog_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _gala_wingpanel_end_session_dialog_dbus_interface_info = {-1, "io.elementary.wingpanel.session.EndSessionDialog", (GDBusMethodInfo **) (&_gala_wingpanel_end_session_dialog_dbus_method_info), (GDBusSignalInfo **) (&_gala_wingpanel_end_session_dialog_dbus_signal_info), (GDBusPropertyInfo **) (&_gala_wingpanel_end_session_dialog_dbus_property_info), NULL};
static const GDBusInterfaceVTable _gala_wingpanel_end_session_dialog_dbus_interface_vtable = {gala_wingpanel_end_session_dialog_dbus_interface_method_call, gala_wingpanel_end_session_dialog_dbus_interface_get_property, gala_wingpanel_end_session_dialog_dbus_interface_set_property};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_open_type = {-1, "type", "u", NULL};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_open_timestamp = {-1, "timestamp", "u", NULL};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_open_open_length = {-1, "open_length", "u", NULL};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_open_inhibiters = {-1, "inhibiters", "ao", NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_open_in[] = {&_gala_session_manager_dbus_arg_info_open_type, &_gala_session_manager_dbus_arg_info_open_timestamp, &_gala_session_manager_dbus_arg_info_open_open_length, &_gala_session_manager_dbus_arg_info_open_inhibiters, NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_open_out[] = {NULL};
static const GDBusMethodInfo _gala_session_manager_dbus_method_info_open = {-1, "Open", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_open_in), (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_open_out), NULL};
static const GDBusMethodInfo * const _gala_session_manager_dbus_method_info[] = {&_gala_session_manager_dbus_method_info_open, NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_confirmed_logout[] = {NULL};
static const GDBusSignalInfo _gala_session_manager_dbus_signal_info_confirmed_logout = {-1, "ConfirmedLogout", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_confirmed_logout), NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_confirmed_reboot[] = {NULL};
static const GDBusSignalInfo _gala_session_manager_dbus_signal_info_confirmed_reboot = {-1, "ConfirmedReboot", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_confirmed_reboot), NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_confirmed_shutdown[] = {NULL};
static const GDBusSignalInfo _gala_session_manager_dbus_signal_info_confirmed_shutdown = {-1, "ConfirmedShutdown", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_confirmed_shutdown), NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_canceled[] = {NULL};
static const GDBusSignalInfo _gala_session_manager_dbus_signal_info_canceled = {-1, "Canceled", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_canceled), NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_closed[] = {NULL};
static const GDBusSignalInfo _gala_session_manager_dbus_signal_info_closed = {-1, "Closed", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_closed), NULL};
static const GDBusSignalInfo * const _gala_session_manager_dbus_signal_info[] = {&_gala_session_manager_dbus_signal_info_confirmed_logout, &_gala_session_manager_dbus_signal_info_confirmed_reboot, &_gala_session_manager_dbus_signal_info_confirmed_shutdown, &_gala_session_manager_dbus_signal_info_canceled, &_gala_session_manager_dbus_signal_info_closed, NULL};
static const GDBusPropertyInfo * const _gala_session_manager_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _gala_session_manager_dbus_interface_info = {-1, "org.gnome.SessionManager.EndSessionDialog", (GDBusMethodInfo **) (&_gala_session_manager_dbus_method_info), (GDBusSignalInfo **) (&_gala_session_manager_dbus_signal_info), (GDBusPropertyInfo **) (&_gala_session_manager_dbus_property_info), NULL};
static const GDBusInterfaceVTable _gala_session_manager_dbus_interface_vtable = {gala_session_manager_dbus_interface_method_call, gala_session_manager_dbus_interface_get_property, gala_session_manager_dbus_interface_set_property};

void
gala_wingpanel_end_session_dialog_open (GalaWingpanelEndSessionDialog* self,
                                        guint type,
                                        guint timestamp,
                                        guint open_length,
                                        char** inhibiters,
                                        gint inhibiters_length1,
                                        GError** error)
{
	GalaWingpanelEndSessionDialogIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GALA_WINGPANEL_END_SESSION_DIALOG_GET_INTERFACE (self);
	if (_iface_->open) {
		_iface_->open (self, type, timestamp, open_length, inhibiters, inhibiters_length1, error);
	}
}

static void
gala_wingpanel_end_session_dialog_default_init (GalaWingpanelEndSessionDialogIface * iface,
                                                gpointer iface_data)
{
	gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_LOGOUT_SIGNAL] = g_signal_new ("confirmed-logout", GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_REBOOT_SIGNAL] = g_signal_new ("confirmed-reboot", GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_CONFIRMED_SHUTDOWN_SIGNAL] = g_signal_new ("confirmed-shutdown", GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_CANCELED_SIGNAL] = g_signal_new ("canceled", GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_wingpanel_end_session_dialog_signals[GALA_WINGPANEL_END_SESSION_DIALOG_CLOSED_SIGNAL] = g_signal_new ("closed", GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static GType
gala_wingpanel_end_session_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaWingpanelEndSessionDialogIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_wingpanel_end_session_dialog_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gala_wingpanel_end_session_dialog_type_id;
	gala_wingpanel_end_session_dialog_type_id = g_type_register_static (G_TYPE_INTERFACE, "GalaWingpanelEndSessionDialog", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gala_wingpanel_end_session_dialog_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (gala_wingpanel_end_session_dialog_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) gala_wingpanel_end_session_dialog_proxy_get_type);
	g_type_set_qdata (gala_wingpanel_end_session_dialog_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "io.elementary.wingpanel.session.EndSessionDialog");
	g_type_set_qdata (gala_wingpanel_end_session_dialog_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_gala_wingpanel_end_session_dialog_dbus_interface_info));
	g_type_set_qdata (gala_wingpanel_end_session_dialog_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gala_wingpanel_end_session_dialog_register_object);
	return gala_wingpanel_end_session_dialog_type_id;
}

GType
gala_wingpanel_end_session_dialog_get_type (void)
{
	static volatile gsize gala_wingpanel_end_session_dialog_type_id__once = 0;
	if (g_once_init_enter (&gala_wingpanel_end_session_dialog_type_id__once)) {
		GType gala_wingpanel_end_session_dialog_type_id;
		gala_wingpanel_end_session_dialog_type_id = gala_wingpanel_end_session_dialog_get_type_once ();
		g_once_init_leave (&gala_wingpanel_end_session_dialog_type_id__once, gala_wingpanel_end_session_dialog_type_id);
	}
	return gala_wingpanel_end_session_dialog_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (GalaWingpanelEndSessionDialogProxy, gala_wingpanel_end_session_dialog_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (GALA_TYPE_WINGPANEL_END_SESSION_DIALOG, gala_wingpanel_end_session_dialog_proxy_gala_wingpanel_end_session_dialog_interface_init) )
static void
gala_wingpanel_end_session_dialog_proxy_class_init (GalaWingpanelEndSessionDialogProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = gala_wingpanel_end_session_dialog_proxy_g_signal;
}

static void
_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_logout (GalaWingpanelEndSessionDialog* self,
                                                                 GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "confirmed-logout");
}

static void
_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_reboot (GalaWingpanelEndSessionDialog* self,
                                                                 GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "confirmed-reboot");
}

static void
_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_shutdown (GalaWingpanelEndSessionDialog* self,
                                                                   GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "confirmed-shutdown");
}

static void
_dbus_handle_gala_wingpanel_end_session_dialog_canceled (GalaWingpanelEndSessionDialog* self,
                                                         GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "canceled");
}

static void
_dbus_handle_gala_wingpanel_end_session_dialog_closed (GalaWingpanelEndSessionDialog* self,
                                                       GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "closed");
}

static void
gala_wingpanel_end_session_dialog_proxy_g_signal (GDBusProxy* proxy,
                                                  const gchar* sender_name,
                                                  const gchar* signal_name,
                                                  GVariant* parameters)
{
	if (strcmp (signal_name, "ConfirmedLogout") == 0) {
		_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_logout ((GalaWingpanelEndSessionDialog*) proxy, parameters);
	} else if (strcmp (signal_name, "ConfirmedReboot") == 0) {
		_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_reboot ((GalaWingpanelEndSessionDialog*) proxy, parameters);
	} else if (strcmp (signal_name, "ConfirmedShutdown") == 0) {
		_dbus_handle_gala_wingpanel_end_session_dialog_confirmed_shutdown ((GalaWingpanelEndSessionDialog*) proxy, parameters);
	} else if (strcmp (signal_name, "Canceled") == 0) {
		_dbus_handle_gala_wingpanel_end_session_dialog_canceled ((GalaWingpanelEndSessionDialog*) proxy, parameters);
	} else if (strcmp (signal_name, "Closed") == 0) {
		_dbus_handle_gala_wingpanel_end_session_dialog_closed ((GalaWingpanelEndSessionDialog*) proxy, parameters);
	}
}

static void
gala_wingpanel_end_session_dialog_proxy_init (GalaWingpanelEndSessionDialogProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_gala_wingpanel_end_session_dialog_dbus_interface_info));
}

static void
gala_wingpanel_end_session_dialog_proxy_open (GalaWingpanelEndSessionDialog* self,
                                              guint type,
                                              guint timestamp,
                                              guint open_length,
                                              char** inhibiters,
                                              gint inhibiters_length1,
                                              GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	char** _tmp125_;
	GVariantBuilder _tmp126_;
	gint _tmp127_;
	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), "io.elementary.wingpanel.session.EndSessionDialog", "Open");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (type));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (timestamp));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (open_length));
	_tmp125_ = inhibiters;
	g_variant_builder_init (&_tmp126_, G_VARIANT_TYPE ("ao"));
	for (_tmp127_ = 0; _tmp127_ < inhibiters_length1; _tmp127_++) {
		g_variant_builder_add_value (&_tmp126_, g_variant_new_object_path (*_tmp125_));
		_tmp125_++;
	}
	g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp126_));
	_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
gala_wingpanel_end_session_dialog_proxy_gala_wingpanel_end_session_dialog_interface_init (GalaWingpanelEndSessionDialogIface* iface)
{
	iface->open = gala_wingpanel_end_session_dialog_proxy_open;
}

static void
_dbus_gala_wingpanel_end_session_dialog_open (GalaWingpanelEndSessionDialog* self,
                                              GVariant* _parameters_,
                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint type = 0U;
	GVariant* _tmp128_;
	guint timestamp = 0U;
	GVariant* _tmp129_;
	guint open_length = 0U;
	GVariant* _tmp130_;
	char** inhibiters = NULL;
	gint inhibiters_length1 = 0;
	GVariant* _tmp131_;
	char** _tmp132_;
	gint _tmp132__length;
	gint _tmp132__size;
	gint _tmp132__length1;
	GVariantIter _tmp133_;
	GVariant* _tmp134_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp128_ = g_variant_iter_next_value (&_arguments_iter);
	type = g_variant_get_uint32 (_tmp128_);
	g_variant_unref (_tmp128_);
	_tmp129_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp129_);
	g_variant_unref (_tmp129_);
	_tmp130_ = g_variant_iter_next_value (&_arguments_iter);
	open_length = g_variant_get_uint32 (_tmp130_);
	g_variant_unref (_tmp130_);
	_tmp131_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp132_ = g_new (char*, 5);
	_tmp132__length = 0;
	_tmp132__size = 4;
	_tmp132__length1 = 0;
	g_variant_iter_init (&_tmp133_, _tmp131_);
	for (; (_tmp134_ = g_variant_iter_next_value (&_tmp133_)) != NULL; _tmp132__length1++) {
		if (_tmp132__size == _tmp132__length) {
			_tmp132__size = 2 * _tmp132__size;
			_tmp132_ = g_renew (char*, _tmp132_, _tmp132__size + 1);
		}
		_tmp132_[_tmp132__length++] = g_variant_dup_string (_tmp134_, NULL);
		g_variant_unref (_tmp134_);
	}
	inhibiters_length1 = _tmp132__length1;
	_tmp132_[_tmp132__length] = NULL;
	inhibiters = _tmp132_;
	g_variant_unref (_tmp131_);
	gala_wingpanel_end_session_dialog_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
gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_open (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
gala_wingpanel_end_session_dialog_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
gala_wingpanel_end_session_dialog_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;
}

static void
_dbus_gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_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_gala_wingpanel_end_session_dialog_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
gala_wingpanel_end_session_dialog_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 *) (&_gala_wingpanel_end_session_dialog_dbus_interface_info), &_gala_wingpanel_end_session_dialog_dbus_interface_vtable, data, _gala_wingpanel_end_session_dialog_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "confirmed-logout", (GCallback) _dbus_gala_wingpanel_end_session_dialog_confirmed_logout, data);
	g_signal_connect (object, "confirmed-reboot", (GCallback) _dbus_gala_wingpanel_end_session_dialog_confirmed_reboot, data);
	g_signal_connect (object, "confirmed-shutdown", (GCallback) _dbus_gala_wingpanel_end_session_dialog_confirmed_shutdown, data);
	g_signal_connect (object, "canceled", (GCallback) _dbus_gala_wingpanel_end_session_dialog_canceled, data);
	g_signal_connect (object, "closed", (GCallback) _dbus_gala_wingpanel_end_session_dialog_closed, data);
	return result;
}

static void
_gala_wingpanel_end_session_dialog_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_wingpanel_end_session_dialog_confirmed_logout, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_wingpanel_end_session_dialog_confirmed_reboot, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_wingpanel_end_session_dialog_confirmed_shutdown, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_wingpanel_end_session_dialog_canceled, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_wingpanel_end_session_dialog_closed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static inline gpointer
gala_session_manager_get_instance_private (GalaSessionManager* self)
{
	return G_STRUCT_MEMBER_P (self, GalaSessionManager_private_offset);
}

GalaSessionManager*
gala_session_manager_init (void)
{
	GalaSessionManager* _tmp0_;
	GalaSessionManager* _tmp2_;
	GalaSessionManager* result;
	_tmp0_ = gala_session_manager_instance;
	if (_tmp0_ == NULL) {
		GalaSessionManager* _tmp1_;
		_tmp1_ = gala_session_manager_new ();
		_g_object_unref0 (gala_session_manager_instance);
		gala_session_manager_instance = _tmp1_;
	}
	_tmp2_ = gala_session_manager_instance;
	result = _tmp2_;
	return result;
}

static void
_gala_session_manager_proxy_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                  const gchar* name,
                                                                  const gchar* name_owner,
                                                                  gpointer self)
{
	gala_session_manager_proxy_appeared ((GalaSessionManager*) self);
}

static void
_gala_session_manager_proxy_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                  const gchar* name,
                                                                  gpointer self)
{
	gala_session_manager_proxy_vanished ((GalaSessionManager*) self);
}

static GalaSessionManager*
gala_session_manager_construct (GType object_type)
{
	GalaSessionManager * self = NULL;
	self = (GalaSessionManager*) g_object_new (object_type, NULL);
	g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, "io.elementary.wingpanel.session.EndSessionDialog", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_gala_session_manager_proxy_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _gala_session_manager_proxy_appeared_gbus_name_appeared_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((_gala_session_manager_proxy_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _gala_session_manager_proxy_vanished_gbus_name_vanished_callback, g_object_ref (self), (GClosureNotify) g_object_unref)));
	return self;
}

static GalaSessionManager*
gala_session_manager_new (void)
{
	return gala_session_manager_construct (GALA_TYPE_SESSION_MANAGER);
}

static void
__lambda179_ (GalaSessionManager* self)
{
	g_signal_emit (self, gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_LOGOUT_SIGNAL], 0);
}

static void
___lambda179__gala_wingpanel_end_session_dialog_confirmed_logout (GalaWingpanelEndSessionDialog* _sender,
                                                                  gpointer self)
{
	__lambda179_ ((GalaSessionManager*) self);
}

static void
__lambda180_ (GalaSessionManager* self)
{
	g_signal_emit (self, gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_REBOOT_SIGNAL], 0);
}

static void
___lambda180__gala_wingpanel_end_session_dialog_confirmed_reboot (GalaWingpanelEndSessionDialog* _sender,
                                                                  gpointer self)
{
	__lambda180_ ((GalaSessionManager*) self);
}

static void
__lambda181_ (GalaSessionManager* self)
{
	g_signal_emit (self, gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_SHUTDOWN_SIGNAL], 0);
}

static void
___lambda181__gala_wingpanel_end_session_dialog_confirmed_shutdown (GalaWingpanelEndSessionDialog* _sender,
                                                                    gpointer self)
{
	__lambda181_ ((GalaSessionManager*) self);
}

static void
__lambda182_ (GalaSessionManager* self)
{
	g_signal_emit (self, gala_session_manager_signals[GALA_SESSION_MANAGER_CANCELED_SIGNAL], 0);
}

static void
___lambda182__gala_wingpanel_end_session_dialog_canceled (GalaWingpanelEndSessionDialog* _sender,
                                                          gpointer self)
{
	__lambda182_ ((GalaSessionManager*) self);
}

static void
__lambda183_ (GalaSessionManager* self)
{
	g_signal_emit (self, gala_session_manager_signals[GALA_SESSION_MANAGER_CLOSED_SIGNAL], 0);
}

static void
___lambda183__gala_wingpanel_end_session_dialog_closed (GalaWingpanelEndSessionDialog* _sender,
                                                        gpointer self)
{
	__lambda183_ ((GalaSessionManager*) self);
}

static void
gala_session_manager_get_proxy_cb (GalaSessionManager* self,
                                   GObject* o,
                                   GAsyncResult* res)
{
	GalaWingpanelEndSessionDialog* _tmp6_;
	GalaWingpanelEndSessionDialog* _tmp7_;
	GalaWingpanelEndSessionDialog* _tmp8_;
	GalaWingpanelEndSessionDialog* _tmp9_;
	GalaWingpanelEndSessionDialog* _tmp10_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GalaWingpanelEndSessionDialog* _tmp0_ = NULL;
		GalaWingpanelEndSessionDialog* _tmp1_;
		GalaWingpanelEndSessionDialog* _tmp2_;
		GalaWingpanelEndSessionDialog* _tmp3_;
		_tmp1_ = g_async_result_get_source_object (res);
		_tmp2_ = (GalaWingpanelEndSessionDialog*) g_async_initable_new_finish ((GAsyncInitable *) _tmp1_, res, &_inner_error0_);
		g_object_unref (_tmp1_);
		_tmp0_ = (GalaWingpanelEndSessionDialog*) _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = _tmp0_;
		_tmp0_ = NULL;
		_g_object_unref0 (self->priv->proxy);
		self->priv->proxy = _tmp3_;
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_warning ("SessionManager.vala:63: Could not connect to io.elementary.wingpanel.s" \
"ession.EndSessionDialog proxy: %s", _tmp5_);
		_g_error_free0 (e);
		return;
	}
	__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;
	}
	_tmp6_ = self->priv->proxy;
	g_signal_connect_object (_tmp6_, "confirmed-logout", (GCallback) ___lambda179__gala_wingpanel_end_session_dialog_confirmed_logout, self, 0);
	_tmp7_ = self->priv->proxy;
	g_signal_connect_object (_tmp7_, "confirmed-reboot", (GCallback) ___lambda180__gala_wingpanel_end_session_dialog_confirmed_reboot, self, 0);
	_tmp8_ = self->priv->proxy;
	g_signal_connect_object (_tmp8_, "confirmed-shutdown", (GCallback) ___lambda181__gala_wingpanel_end_session_dialog_confirmed_shutdown, self, 0);
	_tmp9_ = self->priv->proxy;
	g_signal_connect_object (_tmp9_, "canceled", (GCallback) ___lambda182__gala_wingpanel_end_session_dialog_canceled, self, 0);
	_tmp10_ = self->priv->proxy;
	g_signal_connect_object (_tmp10_, "closed", (GCallback) ___lambda183__gala_wingpanel_end_session_dialog_closed, self, 0);
}

static void
_gala_session_manager_get_proxy_cb_gasync_ready_callback (GObject* source_object,
                                                          GAsyncResult* res,
                                                          gpointer self)
{
	gala_session_manager_get_proxy_cb ((GalaSessionManager*) self, source_object, res);
	g_object_unref (self);
}

static void
gala_session_manager_proxy_appeared (GalaSessionManager* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_async_initable_new_async (GALA_TYPE_WINGPANEL_END_SESSION_DIALOG_PROXY, 0, NULL, _gala_session_manager_get_proxy_cb_gasync_ready_callback, g_object_ref (self), "g-flags", 0, "g-name", "io.elementary.wingpanel.session.EndSessionDialog", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/io/elementary/wingpanel/session/EndSessionDialog", "g-interface-name", "io.elementary.wingpanel.session.EndSessionDialog", NULL);
}

static void
gala_session_manager_proxy_vanished (GalaSessionManager* self)
{
	g_return_if_fail (self != NULL);
	_g_object_unref0 (self->priv->proxy);
	self->priv->proxy = NULL;
}

void
gala_session_manager_open (GalaSessionManager* self,
                           guint type,
                           guint timestamp,
                           guint open_length,
                           char** inhibiters,
                           gint inhibiters_length1,
                           GError** error)
{
	GalaWingpanelEndSessionDialog* _tmp0_;
	GalaWingpanelEndSessionDialog* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->proxy;
	if (_tmp0_ == NULL) {
		GError* _tmp1_;
		_tmp1_ = g_error_new_literal (G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "io.elementary.wingpanel.session.EndSessionDialog DBus interface is not" \
" registered.");
		_inner_error0_ = _tmp1_;
		if ((_inner_error0_->domain == G_DBUS_ERROR) || (_inner_error0_->domain == G_IO_ERROR)) {
			g_propagate_error (error, _inner_error0_);
			return;
		} 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;
		}
	}
	_tmp2_ = self->priv->proxy;
	gala_wingpanel_end_session_dialog_open (_tmp2_, type, timestamp, open_length, inhibiters, (gint) inhibiters_length1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if ((_inner_error0_->domain == G_DBUS_ERROR) || (_inner_error0_->domain == G_IO_ERROR)) {
			g_propagate_error (error, _inner_error0_);
			return;
		} 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;
		}
	}
}

static void
gala_session_manager_class_init (GalaSessionManagerClass * klass,
                                 gpointer klass_data)
{
	gala_session_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GalaSessionManager_private_offset);
	G_OBJECT_CLASS (klass)->finalize = gala_session_manager_finalize;
	gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_LOGOUT_SIGNAL] = g_signal_new ("confirmed-logout", GALA_TYPE_SESSION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_REBOOT_SIGNAL] = g_signal_new ("confirmed-reboot", GALA_TYPE_SESSION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_session_manager_signals[GALA_SESSION_MANAGER_CONFIRMED_SHUTDOWN_SIGNAL] = g_signal_new ("confirmed-shutdown", GALA_TYPE_SESSION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_session_manager_signals[GALA_SESSION_MANAGER_CANCELED_SIGNAL] = g_signal_new ("canceled", GALA_TYPE_SESSION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_session_manager_signals[GALA_SESSION_MANAGER_CLOSED_SIGNAL] = g_signal_new ("closed", GALA_TYPE_SESSION_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
gala_session_manager_instance_init (GalaSessionManager * self,
                                    gpointer klass)
{
	self->priv = gala_session_manager_get_instance_private (self);
	self->priv->proxy = NULL;
}

static void
gala_session_manager_finalize (GObject * obj)
{
	GalaSessionManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_SESSION_MANAGER, GalaSessionManager);
	_g_object_unref0 (self->priv->proxy);
	G_OBJECT_CLASS (gala_session_manager_parent_class)->finalize (obj);
}

static GType
gala_session_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaSessionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_session_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaSessionManager), 0, (GInstanceInitFunc) gala_session_manager_instance_init, NULL };
	GType gala_session_manager_type_id;
	gala_session_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "GalaSessionManager", &g_define_type_info, 0);
	g_type_set_qdata (gala_session_manager_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gala_session_manager_register_object);
	GalaSessionManager_private_offset = g_type_add_instance_private (gala_session_manager_type_id, sizeof (GalaSessionManagerPrivate));
	return gala_session_manager_type_id;
}

GType
gala_session_manager_get_type (void)
{
	static volatile gsize gala_session_manager_type_id__once = 0;
	if (g_once_init_enter (&gala_session_manager_type_id__once)) {
		GType gala_session_manager_type_id;
		gala_session_manager_type_id = gala_session_manager_get_type_once ();
		g_once_init_leave (&gala_session_manager_type_id__once, gala_session_manager_type_id);
	}
	return gala_session_manager_type_id__once;
}

static void
_dbus_gala_session_manager_open (GalaSessionManager* self,
                                 GVariant* _parameters_,
                                 GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint type = 0U;
	GVariant* _tmp135_;
	guint timestamp = 0U;
	GVariant* _tmp136_;
	guint open_length = 0U;
	GVariant* _tmp137_;
	char** inhibiters = NULL;
	gint inhibiters_length1 = 0;
	GVariant* _tmp138_;
	char** _tmp139_;
	gint _tmp139__length;
	gint _tmp139__size;
	gint _tmp139__length1;
	GVariantIter _tmp140_;
	GVariant* _tmp141_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp135_ = g_variant_iter_next_value (&_arguments_iter);
	type = g_variant_get_uint32 (_tmp135_);
	g_variant_unref (_tmp135_);
	_tmp136_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp136_);
	g_variant_unref (_tmp136_);
	_tmp137_ = g_variant_iter_next_value (&_arguments_iter);
	open_length = g_variant_get_uint32 (_tmp137_);
	g_variant_unref (_tmp137_);
	_tmp138_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp139_ = g_new (char*, 5);
	_tmp139__length = 0;
	_tmp139__size = 4;
	_tmp139__length1 = 0;
	g_variant_iter_init (&_tmp140_, _tmp138_);
	for (; (_tmp141_ = g_variant_iter_next_value (&_tmp140_)) != NULL; _tmp139__length1++) {
		if (_tmp139__size == _tmp139__length) {
			_tmp139__size = 2 * _tmp139__size;
			_tmp139_ = g_renew (char*, _tmp139_, _tmp139__size + 1);
		}
		_tmp139_[_tmp139__length++] = g_variant_dup_string (_tmp141_, NULL);
		g_variant_unref (_tmp141_);
	}
	inhibiters_length1 = _tmp139__length1;
	_tmp139_[_tmp139__length] = NULL;
	inhibiters = _tmp139_;
	g_variant_unref (_tmp138_);
	gala_session_manager_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
gala_session_manager_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_gala_session_manager_open (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
gala_session_manager_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
gala_session_manager_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;
}

static void
_dbus_gala_session_manager_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, "org.gnome.SessionManager.EndSessionDialog", "ConfirmedLogout", _arguments, NULL);
}

static void
_dbus_gala_session_manager_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, "org.gnome.SessionManager.EndSessionDialog", "ConfirmedReboot", _arguments, NULL);
}

static void
_dbus_gala_session_manager_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, "org.gnome.SessionManager.EndSessionDialog", "ConfirmedShutdown", _arguments, NULL);
}

static void
_dbus_gala_session_manager_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, "org.gnome.SessionManager.EndSessionDialog", "Canceled", _arguments, NULL);
}

static void
_dbus_gala_session_manager_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, "org.gnome.SessionManager.EndSessionDialog", "Closed", _arguments, NULL);
}

guint
gala_session_manager_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 *) (&_gala_session_manager_dbus_interface_info), &_gala_session_manager_dbus_interface_vtable, data, _gala_session_manager_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "confirmed-logout", (GCallback) _dbus_gala_session_manager_confirmed_logout, data);
	g_signal_connect (object, "confirmed-reboot", (GCallback) _dbus_gala_session_manager_confirmed_reboot, data);
	g_signal_connect (object, "confirmed-shutdown", (GCallback) _dbus_gala_session_manager_confirmed_shutdown, data);
	g_signal_connect (object, "canceled", (GCallback) _dbus_gala_session_manager_canceled, data);
	g_signal_connect (object, "closed", (GCallback) _dbus_gala_session_manager_closed, data);
	return result;
}

static void
_gala_session_manager_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_manager_confirmed_logout, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_manager_confirmed_reboot, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_manager_confirmed_shutdown, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_manager_canceled, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_manager_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);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

