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

/**/
/*  Copyright (c) 2018 elementary LLC. (https://elementary.io)*/
/**/
/*  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/>.*/
/**/

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <granite.h>
#include <gtk/gtk.h>
#include <gobject/gvaluecollector.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
#include "config.h"
#include <stdio.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_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_IS_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_SESSION_MANAGER))
#define GALA_SESSION_MANAGER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GALA_TYPE_SESSION_MANAGER, GalaSessionManagerIface))

typedef struct _GalaSessionManager GalaSessionManager;
typedef struct _GalaSessionManagerIface GalaSessionManagerIface;

#define GALA_TYPE_SESSION_MANAGER_PROXY (gala_session_manager_proxy_get_type ())
typedef GDBusProxy GalaSessionManagerProxy;
typedef GDBusProxyClass GalaSessionManagerProxyClass;
typedef struct _GalaSessionManagerRegisterClientReadyData GalaSessionManagerRegisterClientReadyData;
#define _g_free0(var) (var = (g_free (var), NULL))

#define GALA_TYPE_SESSION_CLIENT (gala_session_client_get_type ())
#define GALA_SESSION_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_SESSION_CLIENT, GalaSessionClient))
#define GALA_IS_SESSION_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_SESSION_CLIENT))
#define GALA_SESSION_CLIENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GALA_TYPE_SESSION_CLIENT, GalaSessionClientIface))

typedef struct _GalaSessionClient GalaSessionClient;
typedef struct _GalaSessionClientIface GalaSessionClientIface;

#define GALA_TYPE_SESSION_CLIENT_PROXY (gala_session_client_proxy_get_type ())
enum  {
	GALA_SESSION_CLIENT_STOP_SIGNAL,
	GALA_SESSION_CLIENT_QUERY_END_SESSION_SIGNAL,
	GALA_SESSION_CLIENT_END_SESSION_SIGNAL,
	GALA_SESSION_CLIENT_CANCEL_END_SESSION_SIGNAL,
	GALA_SESSION_CLIENT_NUM_SIGNALS
};
static guint gala_session_client_signals[GALA_SESSION_CLIENT_NUM_SIGNALS] = {0};
typedef GDBusProxy GalaSessionClientProxy;
typedef GDBusProxyClass GalaSessionClientProxyClass;

#define GALA_TYPE_DAEMON (gala_daemon_get_type ())
#define GALA_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_DAEMON, GalaDaemon))
#define GALA_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_DAEMON, GalaDaemonClass))
#define GALA_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_DAEMON))
#define GALA_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_DAEMON))
#define GALA_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_DAEMON, GalaDaemonClass))

typedef struct _GalaDaemon GalaDaemon;
typedef struct _GalaDaemonClass GalaDaemonClass;
typedef struct _GalaDaemonPrivate GalaDaemonPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _gala_daemon_unref0(var) ((var == NULL) ? NULL : (var = (gala_daemon_unref (var), NULL)))

#define GALA_TYPE_MENU_DAEMON (gala_menu_daemon_get_type ())
#define GALA_MENU_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GALA_TYPE_MENU_DAEMON, GalaMenuDaemon))
#define GALA_MENU_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GALA_TYPE_MENU_DAEMON, GalaMenuDaemonClass))
#define GALA_IS_MENU_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GALA_TYPE_MENU_DAEMON))
#define GALA_IS_MENU_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GALA_TYPE_MENU_DAEMON))
#define GALA_MENU_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GALA_TYPE_MENU_DAEMON, GalaMenuDaemonClass))

typedef struct _GalaMenuDaemon GalaMenuDaemon;
typedef struct _GalaMenuDaemonClass GalaMenuDaemonClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GalaDaemonRegisterWithSessionData GalaDaemonRegisterWithSessionData;
typedef struct _GalaDaemonRegisterData GalaDaemonRegisterData;
typedef struct _GalaParamSpecDaemon GalaParamSpecDaemon;
#define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))

struct _GalaSessionManagerIface {
	GTypeInterface parent_iface;
	void (*register_client) (GalaSessionManager* self, const gchar* app_id, const gchar* client_start_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
	char* (*register_client_finish) (GalaSessionManager* self, GAsyncResult* _res_, GError** error);
};

struct _GalaSessionManagerRegisterClientReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar* app_id;
	gchar* client_start_id;
};

struct _GalaSessionClientIface {
	GTypeInterface parent_iface;
	void (*end_session_response) (GalaSessionClient* self, gboolean is_ok, const gchar* reason, GError** error);
};

struct _GalaDaemon {
	GTypeInstance parent_instance;
	volatile int ref_count;
	GalaDaemonPrivate * priv;
};

struct _GalaDaemonClass {
	GTypeClass parent_class;
	void (*finalize) (GalaDaemon *self);
};

struct _GalaDaemonPrivate {
	GalaSessionClient* sclient;
};

struct _Block1Data {
	int _ref_count_;
	GalaDaemon* self;
	GraniteSettings* granite_settings;
	GtkSettings* gtk_settings;
};

struct _GalaDaemonRegisterWithSessionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* app_id;
	GalaSessionClient* result;
	char* path;
	gchar* msg;
	gchar* start_id;
	GalaSessionManager* session;
	GalaSessionClient* session_client;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GalaSessionManager* _tmp4_;
	GalaSessionManager* _tmp5_;
	GalaSessionManager* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	char* _tmp9_;
	GalaSessionManager* _tmp10_;
	const gchar* _tmp11_;
	char* _tmp12_;
	char* _tmp13_;
	GError* _vala1_e;
	GError* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _tmp17_;
	const gchar* _tmp18_;
	GalaSessionClient* _tmp19_;
	const char* _tmp20_;
	GalaSessionClient* _tmp21_;
	GalaSessionClient* _tmp22_;
	GError* _vala2_e;
	GError* _tmp23_;
	const gchar* _tmp24_;
	GError* _inner_error0_;
};

struct _GalaDaemonRegisterData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GalaDaemon* self;
	gboolean result;
	GalaSessionClient* _tmp0_;
	GalaSessionClient* _tmp1_;
	GalaSessionClient* _tmp2_;
	GalaSessionClient* _tmp3_;
};

struct _GalaParamSpecDaemon {
	GParamSpec parent_instance;
};

static gint GalaDaemon_private_offset;
static gpointer gala_daemon_parent_class = NULL;

VALA_EXTERN GType gala_session_manager_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint gala_session_manager_register_object (void* object,
                                            GDBusConnection* connection,
                                            const gchar* path,
                                            GError** error);
VALA_EXTERN GType gala_session_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaSessionManager, g_object_unref)
VALA_EXTERN void gala_session_manager_register_client (GalaSessionManager* self,
                                           const gchar* app_id,
                                           const gchar* client_start_id,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN char* gala_session_manager_register_client_finish (GalaSessionManager* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static GType gala_session_manager_get_type_once (void);
static void gala_session_manager_proxy_g_signal (GDBusProxy* proxy,
                                          const gchar* sender_name,
                                          const gchar* signal_name,
                                          GVariant* parameters);
static void _vala_g_async_ready_callback (GObject *source_object,
                                   GAsyncResult *res,
                                   void *user_data);
static void gala_session_manager_proxy_register_client_async (GalaSessionManager* self,
                                                       const gchar* app_id,
                                                       const gchar* client_start_id,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static char* gala_session_manager_proxy_register_client_finish (GalaSessionManager* self,
                                                         GAsyncResult* _res_,
                                                         GError** error);
static void gala_session_manager_proxy_gala_session_manager_interface_init (GalaSessionManagerIface* iface);
static void _dbus_gala_session_manager_register_client (GalaSessionManager* self,
                                                 GVariant* _parameters_,
                                                 GDBusMethodInvocation* invocation);
static void _dbus_gala_session_manager_register_client_ready (GObject * source_object,
                                                       GAsyncResult * _res_,
                                                       gpointer _user_data_);
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 _gala_session_manager_unregister_object (gpointer user_data);
VALA_EXTERN GType gala_session_client_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint gala_session_client_register_object (void* object,
                                           GDBusConnection* connection,
                                           const gchar* path,
                                           GError** error);
VALA_EXTERN GType gala_session_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaSessionClient, g_object_unref)
VALA_EXTERN void gala_session_client_end_session_response (GalaSessionClient* self,
                                               gboolean is_ok,
                                               const gchar* reason,
                                               GError** error);
static GType gala_session_client_get_type_once (void);
static void gala_session_client_proxy_g_signal (GDBusProxy* proxy,
                                         const gchar* sender_name,
                                         const gchar* signal_name,
                                         GVariant* parameters);
static void _dbus_handle_gala_session_client_stop (GalaSessionClient* self,
                                            GVariant* parameters);
static void _dbus_handle_gala_session_client_query_end_session (GalaSessionClient* self,
                                                         GVariant* parameters);
static void _dbus_handle_gala_session_client_end_session (GalaSessionClient* self,
                                                   GVariant* parameters);
static void _dbus_handle_gala_session_client_cancel_end_session (GalaSessionClient* self,
                                                          GVariant* parameters);
static void gala_session_client_proxy_end_session_response (GalaSessionClient* self,
                                                     gboolean is_ok,
                                                     const gchar* reason,
                                                     GError** error);
static void gala_session_client_proxy_gala_session_client_interface_init (GalaSessionClientIface* iface);
static void _dbus_gala_session_client_end_session_response (GalaSessionClient* self,
                                                     GVariant* _parameters_,
                                                     GDBusMethodInvocation* invocation);
static void gala_session_client_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_client_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_client_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_client_stop (GObject* _sender,
                                     gpointer* _data);
static void _dbus_gala_session_client_query_end_session (GObject* _sender,
                                                  guint flags,
                                                  gpointer* _data);
static void _dbus_gala_session_client_end_session (GObject* _sender,
                                            guint flags,
                                            gpointer* _data);
static void _dbus_gala_session_client_cancel_end_session (GObject* _sender,
                                                   gpointer* _data);
static void _gala_session_client_unregister_object (gpointer user_data);
VALA_EXTERN gpointer gala_daemon_ref (gpointer instance);
VALA_EXTERN void gala_daemon_unref (gpointer instance);
VALA_EXTERN GParamSpec* gala_param_spec_daemon (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void gala_value_set_daemon (GValue* value,
                            gpointer v_object);
VALA_EXTERN void gala_value_take_daemon (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer gala_value_get_daemon (const GValue* value);
VALA_EXTERN GType gala_daemon_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaDaemon, gala_daemon_unref)
VALA_EXTERN GalaDaemon* gala_daemon_new (void);
VALA_EXTERN GalaDaemon* gala_daemon_construct (GType object_type);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void gala_daemon_register (GalaDaemon* self,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_);
static gboolean gala_daemon_register_finish (GalaDaemon* self,
                                      GAsyncResult* _res_);
static void __lambda7_ (GalaDaemon* self,
                 GObject* o,
                 GAsyncResult* res);
static void ___lambda7__gasync_ready_callback (GObject* source_object,
                                        GAsyncResult* res,
                                        gpointer self);
static void __lambda8_ (Block1Data* _data1_);
static void ___lambda8__g_object_notify (GObject* _sender,
                                  GParamSpec* pspec,
                                  gpointer self);
VALA_EXTERN GType gala_menu_daemon_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GalaMenuDaemon, g_object_unref)
VALA_EXTERN guint gala_menu_daemon_register_object (void* object,
                                        GDBusConnection* connection,
                                        const gchar* path,
                                        GError** error);
VALA_EXTERN GalaMenuDaemon* gala_menu_daemon_new (void);
VALA_EXTERN GalaMenuDaemon* gala_menu_daemon_construct (GType object_type);
VALA_EXTERN void gala_menu_daemon_setup_dbus (GalaMenuDaemon* self);
VALA_EXTERN void gala_daemon_run (GalaDaemon* self);
static void gala_daemon_register_with_session_data_free (gpointer _data);
VALA_EXTERN void gala_daemon_register_with_session (const gchar* app_id,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN GalaSessionClient* gala_daemon_register_with_session_finish (GAsyncResult* _res_);
static gboolean gala_daemon_register_with_session_co (GalaDaemonRegisterWithSessionData* _data_);
static void gala_daemon_register_with_session_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void gala_daemon_register_data_free (gpointer _data);
static gboolean gala_daemon_register_co (GalaDaemonRegisterData* _data_);
static void gala_daemon_register_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_);
static void __lambda4_ (GalaDaemon* self);
static void gala_daemon_end_session (GalaDaemon* self,
                              gboolean quit);
static void ___lambda4__gala_session_client_query_end_session (GalaSessionClient* _sender,
                                                        guint flags,
                                                        gpointer self);
static void __lambda5_ (GalaDaemon* self);
static void ___lambda5__gala_session_client_end_session (GalaSessionClient* _sender,
                                                  guint flags,
                                                  gpointer self);
static void __lambda6_ (GalaDaemon* self);
static void ___lambda6__gala_session_client_stop (GalaSessionClient* _sender,
                                           gpointer self);
static void gala_daemon_finalize (GalaDaemon * obj);
static GType gala_daemon_get_type_once (void);
static gint gala_main (gchar** args,
                gint args_length1);

static const GDBusArgInfo _gala_session_manager_dbus_arg_info_register_client_app_id = {-1, "app_id", "s", NULL};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_register_client_client_start_id = {-1, "client_start_id", "s", NULL};
static const GDBusArgInfo _gala_session_manager_dbus_arg_info_register_client_result = {-1, "result", "o", NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_register_client_in[] = {&_gala_session_manager_dbus_arg_info_register_client_app_id, &_gala_session_manager_dbus_arg_info_register_client_client_start_id, NULL};
static const GDBusArgInfo * const _gala_session_manager_dbus_arg_info_register_client_out[] = {&_gala_session_manager_dbus_arg_info_register_client_result, NULL};
static const GDBusMethodInfo _gala_session_manager_dbus_method_info_register_client = {-1, "RegisterClient", (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_register_client_in), (GDBusArgInfo **) (&_gala_session_manager_dbus_arg_info_register_client_out), NULL};
static const GDBusMethodInfo * const _gala_session_manager_dbus_method_info[] = {&_gala_session_manager_dbus_method_info_register_client, NULL};
static const GDBusSignalInfo * const _gala_session_manager_dbus_signal_info[] = {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", (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};
static const GDBusArgInfo _gala_session_client_dbus_arg_info_end_session_response_is_ok = {-1, "is_ok", "b", NULL};
static const GDBusArgInfo _gala_session_client_dbus_arg_info_end_session_response_reason = {-1, "reason", "s", NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_end_session_response_in[] = {&_gala_session_client_dbus_arg_info_end_session_response_is_ok, &_gala_session_client_dbus_arg_info_end_session_response_reason, NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_end_session_response_out[] = {NULL};
static const GDBusMethodInfo _gala_session_client_dbus_method_info_end_session_response = {-1, "EndSessionResponse", (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_end_session_response_in), (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_end_session_response_out), NULL};
static const GDBusMethodInfo * const _gala_session_client_dbus_method_info[] = {&_gala_session_client_dbus_method_info_end_session_response, NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_stop[] = {NULL};
static const GDBusSignalInfo _gala_session_client_dbus_signal_info_stop = {-1, "Stop", (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_stop), NULL};
static const GDBusArgInfo _gala_session_client_dbus_arg_info_query_end_session_flags = {-1, "flags", "u", NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_query_end_session[] = {&_gala_session_client_dbus_arg_info_query_end_session_flags, NULL};
static const GDBusSignalInfo _gala_session_client_dbus_signal_info_query_end_session = {-1, "QueryEndSession", (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_query_end_session), NULL};
static const GDBusArgInfo _gala_session_client_dbus_arg_info_end_session_flags = {-1, "flags", "u", NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_end_session[] = {&_gala_session_client_dbus_arg_info_end_session_flags, NULL};
static const GDBusSignalInfo _gala_session_client_dbus_signal_info_end_session = {-1, "EndSession", (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_end_session), NULL};
static const GDBusArgInfo * const _gala_session_client_dbus_arg_info_cancel_end_session[] = {NULL};
static const GDBusSignalInfo _gala_session_client_dbus_signal_info_cancel_end_session = {-1, "CancelEndSession", (GDBusArgInfo **) (&_gala_session_client_dbus_arg_info_cancel_end_session), NULL};
static const GDBusSignalInfo * const _gala_session_client_dbus_signal_info[] = {&_gala_session_client_dbus_signal_info_stop, &_gala_session_client_dbus_signal_info_query_end_session, &_gala_session_client_dbus_signal_info_end_session, &_gala_session_client_dbus_signal_info_cancel_end_session, NULL};
static const GDBusPropertyInfo * const _gala_session_client_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _gala_session_client_dbus_interface_info = {-1, "org.gnome.SessionManager.ClientPrivate", (GDBusMethodInfo **) (&_gala_session_client_dbus_method_info), (GDBusSignalInfo **) (&_gala_session_client_dbus_signal_info), (GDBusPropertyInfo **) (&_gala_session_client_dbus_property_info), NULL};
static const GDBusInterfaceVTable _gala_session_client_dbus_interface_vtable = {gala_session_client_dbus_interface_method_call, gala_session_client_dbus_interface_get_property, gala_session_client_dbus_interface_set_property};

void
gala_session_manager_register_client (GalaSessionManager* self,
                                      const gchar* app_id,
                                      const gchar* client_start_id,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GalaSessionManagerIface* _iface_;
	_iface_ = GALA_SESSION_MANAGER_GET_INTERFACE (self);
	if (_iface_->register_client) {
		_iface_->register_client (self, app_id, client_start_id, _callback_, _user_data_);
	}
}

char*
gala_session_manager_register_client_finish (GalaSessionManager* self,
                                             GAsyncResult* _res_,
                                             GError** error)
{
	GalaSessionManagerIface* _iface_;
	_iface_ = GALA_SESSION_MANAGER_GET_INTERFACE (self);
	if (_iface_->register_client_finish) {
		return _iface_->register_client_finish (self, _res_, error);
	}
	return NULL;
}

static void
gala_session_manager_default_init (GalaSessionManagerIface * iface,
                                   gpointer iface_data)
{
}

static GType
gala_session_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaSessionManagerIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_session_manager_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gala_session_manager_type_id;
	gala_session_manager_type_id = g_type_register_static (G_TYPE_INTERFACE, "GalaSessionManager", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gala_session_manager_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (gala_session_manager_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) gala_session_manager_proxy_get_type);
	g_type_set_qdata (gala_session_manager_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.SessionManager");
	g_type_set_qdata (gala_session_manager_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_gala_session_manager_dbus_interface_info));
	g_type_set_qdata (gala_session_manager_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gala_session_manager_register_object);
	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;
}

G_DEFINE_TYPE_EXTENDED (GalaSessionManagerProxy, gala_session_manager_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (GALA_TYPE_SESSION_MANAGER, gala_session_manager_proxy_gala_session_manager_interface_init) )
static void
gala_session_manager_proxy_class_init (GalaSessionManagerProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = gala_session_manager_proxy_g_signal;
}

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

static void
gala_session_manager_proxy_init (GalaSessionManagerProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_gala_session_manager_dbus_interface_info));
}

static void
_vala_g_async_ready_callback (GObject *source_object,
                              GAsyncResult *res,
                              void *user_data)
{
	g_task_return_pointer (user_data, g_object_ref (res), g_object_unref);
	g_object_unref (user_data);
}

static void
gala_session_manager_proxy_register_client_async (GalaSessionManager* self,
                                                  const gchar* app_id,
                                                  const gchar* client_start_id,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.SessionManager", "RegisterClient");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (app_id));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (client_start_id));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static char*
gala_session_manager_proxy_register_client_finish (GalaSessionManager* self,
                                                   GAsyncResult* _res_,
                                                   GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	char* _result = NULL;
	GVariant* _tmp0_;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return NULL;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return NULL;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_tmp0_ = g_variant_iter_next_value (&_reply_iter);
	_result = g_variant_dup_string (_tmp0_, NULL);
	g_variant_unref (_tmp0_);
	g_object_unref (_reply_message);
	return _result;
}

static void
gala_session_manager_proxy_gala_session_manager_interface_init (GalaSessionManagerIface* iface)
{
	iface->register_client = gala_session_manager_proxy_register_client_async;
	iface->register_client_finish = gala_session_manager_proxy_register_client_finish;
}

static void
_dbus_gala_session_manager_register_client (GalaSessionManager* self,
                                            GVariant* _parameters_,
                                            GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	GalaSessionManagerRegisterClientReadyData* _ready_data;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (GalaSessionManagerRegisterClientReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->app_id = g_variant_dup_string (_tmp1_, NULL);
	g_variant_unref (_tmp1_);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->client_start_id = g_variant_dup_string (_tmp2_, NULL);
	g_variant_unref (_tmp2_);
	gala_session_manager_register_client (self, _ready_data->app_id, _ready_data->client_start_id, (GAsyncReadyCallback) _dbus_gala_session_manager_register_client_ready, _ready_data);
	_error:
	;
}

static void
_dbus_gala_session_manager_register_client_ready (GObject * source_object,
                                                  GAsyncResult * _res_,
                                                  gpointer _user_data_)
{
	GalaSessionManagerRegisterClientReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	char* result;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = gala_session_manager_register_client_finish ((GalaSessionManager*) source_object, _res_, &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);
	g_variant_builder_add_value (&_reply_builder, g_variant_new_object_path (result));
	_g_free0 (result);
	_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:
	_g_free0 (_ready_data->app_id);
	_g_free0 (_ready_data->client_start_id);
	g_slice_free (GalaSessionManagerRegisterClientReadyData, _ready_data);
}

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, "RegisterClient") == 0) {
		_dbus_gala_session_manager_register_client (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;
}

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;
	}
	return result;
}

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

void
gala_session_client_end_session_response (GalaSessionClient* self,
                                          gboolean is_ok,
                                          const gchar* reason,
                                          GError** error)
{
	GalaSessionClientIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GALA_SESSION_CLIENT_GET_INTERFACE (self);
	if (_iface_->end_session_response) {
		_iface_->end_session_response (self, is_ok, reason, error);
	}
}

static void
gala_session_client_default_init (GalaSessionClientIface * iface,
                                  gpointer iface_data)
{
	gala_session_client_signals[GALA_SESSION_CLIENT_STOP_SIGNAL] = g_signal_new ("stop", GALA_TYPE_SESSION_CLIENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gala_session_client_signals[GALA_SESSION_CLIENT_QUERY_END_SESSION_SIGNAL] = g_signal_new ("query-end-session", GALA_TYPE_SESSION_CLIENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
	gala_session_client_signals[GALA_SESSION_CLIENT_END_SESSION_SIGNAL] = g_signal_new ("end-session", GALA_TYPE_SESSION_CLIENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
	gala_session_client_signals[GALA_SESSION_CLIENT_CANCEL_END_SESSION_SIGNAL] = g_signal_new ("cancel-end-session", GALA_TYPE_SESSION_CLIENT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static GType
gala_session_client_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GalaSessionClientIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_session_client_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gala_session_client_type_id;
	gala_session_client_type_id = g_type_register_static (G_TYPE_INTERFACE, "GalaSessionClient", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gala_session_client_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (gala_session_client_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) gala_session_client_proxy_get_type);
	g_type_set_qdata (gala_session_client_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.SessionManager.ClientPrivate");
	g_type_set_qdata (gala_session_client_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_gala_session_client_dbus_interface_info));
	g_type_set_qdata (gala_session_client_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) gala_session_client_register_object);
	return gala_session_client_type_id;
}

GType
gala_session_client_get_type (void)
{
	static volatile gsize gala_session_client_type_id__once = 0;
	if (g_once_init_enter (&gala_session_client_type_id__once)) {
		GType gala_session_client_type_id;
		gala_session_client_type_id = gala_session_client_get_type_once ();
		g_once_init_leave (&gala_session_client_type_id__once, gala_session_client_type_id);
	}
	return gala_session_client_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (GalaSessionClientProxy, gala_session_client_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (GALA_TYPE_SESSION_CLIENT, gala_session_client_proxy_gala_session_client_interface_init) )
static void
gala_session_client_proxy_class_init (GalaSessionClientProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = gala_session_client_proxy_g_signal;
}

static void
_dbus_handle_gala_session_client_stop (GalaSessionClient* self,
                                       GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "stop");
}

static void
_dbus_handle_gala_session_client_query_end_session (GalaSessionClient* self,
                                                    GVariant* parameters)
{
	GVariantIter _arguments_iter;
	guint flags = 0U;
	GVariant* _tmp3_;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	flags = g_variant_get_uint32 (_tmp3_);
	g_variant_unref (_tmp3_);
	g_signal_emit_by_name (self, "query-end-session", flags);
}

static void
_dbus_handle_gala_session_client_end_session (GalaSessionClient* self,
                                              GVariant* parameters)
{
	GVariantIter _arguments_iter;
	guint flags = 0U;
	GVariant* _tmp4_;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp4_ = g_variant_iter_next_value (&_arguments_iter);
	flags = g_variant_get_uint32 (_tmp4_);
	g_variant_unref (_tmp4_);
	g_signal_emit_by_name (self, "end-session", flags);
}

static void
_dbus_handle_gala_session_client_cancel_end_session (GalaSessionClient* self,
                                                     GVariant* parameters)
{
	GVariantIter _arguments_iter;
	g_variant_iter_init (&_arguments_iter, parameters);
	g_signal_emit_by_name (self, "cancel-end-session");
}

static void
gala_session_client_proxy_g_signal (GDBusProxy* proxy,
                                    const gchar* sender_name,
                                    const gchar* signal_name,
                                    GVariant* parameters)
{
	if (strcmp (signal_name, "Stop") == 0) {
		_dbus_handle_gala_session_client_stop ((GalaSessionClient*) proxy, parameters);
	} else if (strcmp (signal_name, "QueryEndSession") == 0) {
		_dbus_handle_gala_session_client_query_end_session ((GalaSessionClient*) proxy, parameters);
	} else if (strcmp (signal_name, "EndSession") == 0) {
		_dbus_handle_gala_session_client_end_session ((GalaSessionClient*) proxy, parameters);
	} else if (strcmp (signal_name, "CancelEndSession") == 0) {
		_dbus_handle_gala_session_client_cancel_end_session ((GalaSessionClient*) proxy, parameters);
	}
}

static void
gala_session_client_proxy_init (GalaSessionClientProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_gala_session_client_dbus_interface_info));
}

static void
gala_session_client_proxy_end_session_response (GalaSessionClient* self,
                                                gboolean is_ok,
                                                const gchar* reason,
                                                GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.gnome.SessionManager.ClientPrivate", "EndSessionResponse");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (is_ok));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (reason));
	_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_session_client_proxy_gala_session_client_interface_init (GalaSessionClientIface* iface)
{
	iface->end_session_response = gala_session_client_proxy_end_session_response;
}

static void
_dbus_gala_session_client_end_session_response (GalaSessionClient* self,
                                                GVariant* _parameters_,
                                                GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gboolean is_ok = FALSE;
	GVariant* _tmp5_;
	gchar* reason = NULL;
	GVariant* _tmp6_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp5_ = g_variant_iter_next_value (&_arguments_iter);
	is_ok = g_variant_get_boolean (_tmp5_);
	g_variant_unref (_tmp5_);
	_tmp6_ = g_variant_iter_next_value (&_arguments_iter);
	reason = g_variant_dup_string (_tmp6_, NULL);
	g_variant_unref (_tmp6_);
	gala_session_client_end_session_response (self, is_ok, reason, &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:
	_g_free0 (reason);
	;
}

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

static GVariant*
gala_session_client_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_client_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_client_stop (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.ClientPrivate", "Stop", _arguments, NULL);
}

static void
_dbus_gala_session_client_query_end_session (GObject* _sender,
                                             guint flags,
                                             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);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (flags));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.gnome.SessionManager.ClientPrivate", "QueryEndSession", _arguments, NULL);
}

static void
_dbus_gala_session_client_end_session (GObject* _sender,
                                       guint flags,
                                       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);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (flags));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.gnome.SessionManager.ClientPrivate", "EndSession", _arguments, NULL);
}

static void
_dbus_gala_session_client_cancel_end_session (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.ClientPrivate", "CancelEndSession", _arguments, NULL);
}

guint
gala_session_client_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_client_dbus_interface_info), &_gala_session_client_dbus_interface_vtable, data, _gala_session_client_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "stop", (GCallback) _dbus_gala_session_client_stop, data);
	g_signal_connect (object, "query-end-session", (GCallback) _dbus_gala_session_client_query_end_session, data);
	g_signal_connect (object, "end-session", (GCallback) _dbus_gala_session_client_end_session, data);
	g_signal_connect (object, "cancel-end-session", (GCallback) _dbus_gala_session_client_cancel_end_session, data);
	return result;
}

static void
_gala_session_client_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_client_stop, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_client_query_end_session, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_client_end_session, data);
	g_signal_handlers_disconnect_by_func (data[0], _dbus_gala_session_client_cancel_end_session, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static inline gpointer
gala_daemon_get_instance_private (GalaDaemon* self)
{
	return G_STRUCT_MEMBER_P (self, GalaDaemon_private_offset);
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		GalaDaemon* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->gtk_settings);
		_g_object_unref0 (_data1_->granite_settings);
		_gala_daemon_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
__lambda7_ (GalaDaemon* self,
            GObject* o,
            GAsyncResult* res)
{
	gboolean success = FALSE;
	g_return_if_fail (res != NULL);
	success = gala_daemon_register_finish (self, res);
	if (!success) {
		g_message ("Main.vala:44: Failed to register with Session manager");
	}
}

static void
___lambda7__gasync_ready_callback (GObject* source_object,
                                   GAsyncResult* res,
                                   gpointer self)
{
	__lambda7_ ((GalaDaemon*) self, source_object, res);
	gala_daemon_unref (self);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
__lambda8_ (Block1Data* _data1_)
{
	GalaDaemon* self;
	GraniteSettingsColorScheme _tmp0_;
	GraniteSettingsColorScheme _tmp1_;
	self = _data1_->self;
	_tmp0_ = granite_settings_get_prefers_color_scheme (_data1_->granite_settings);
	_tmp1_ = _tmp0_;
	g_object_set (_data1_->gtk_settings, "gtk-application-prefer-dark-theme", _tmp1_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
}

static void
___lambda8__g_object_notify (GObject* _sender,
                             GParamSpec* pspec,
                             gpointer self)
{
	__lambda8_ (self);
}

GalaDaemon*
gala_daemon_construct (GType object_type)
{
	GalaDaemon* self = NULL;
	Block1Data* _data1_;
	GraniteSettings* _tmp0_;
	GraniteSettings* _tmp1_;
	GtkSettings* _tmp2_;
	GtkSettings* _tmp3_;
	GraniteSettingsColorScheme _tmp4_;
	GraniteSettingsColorScheme _tmp5_;
	GalaMenuDaemon* menu_daemon = NULL;
	GalaMenuDaemon* _tmp6_;
	self = (GalaDaemon*) g_type_create_instance (object_type);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = gala_daemon_ref (self);
	gala_daemon_register (self, ___lambda7__gasync_ready_callback, gala_daemon_ref (self));
	_tmp0_ = granite_settings_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data1_->granite_settings = _tmp1_;
	_tmp2_ = gtk_settings_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_data1_->gtk_settings = _tmp3_;
	_tmp4_ = granite_settings_get_prefers_color_scheme (_data1_->granite_settings);
	_tmp5_ = _tmp4_;
	g_object_set (_data1_->gtk_settings, "gtk-application-prefer-dark-theme", _tmp5_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
	g_signal_connect_data ((GObject*) _data1_->granite_settings, "notify::prefers-color-scheme", (GCallback) ___lambda8__g_object_notify, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	_tmp6_ = gala_menu_daemon_new ();
	menu_daemon = _tmp6_;
	gala_menu_daemon_setup_dbus (menu_daemon);
	_g_object_unref0 (menu_daemon);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return self;
}

GalaDaemon*
gala_daemon_new (void)
{
	return gala_daemon_construct (GALA_TYPE_DAEMON);
}

void
gala_daemon_run (GalaDaemon* self)
{
	g_return_if_fail (self != NULL);
	gtk_main ();
}

static void
gala_daemon_register_with_session_data_free (gpointer _data)
{
	GalaDaemonRegisterWithSessionData* _data_;
	_data_ = _data;
	_g_free0 (_data_->app_id);
	_g_object_unref0 (_data_->result);
	g_slice_free (GalaDaemonRegisterWithSessionData, _data_);
}

void
gala_daemon_register_with_session (const gchar* app_id,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	GalaDaemonRegisterWithSessionData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (app_id != NULL);
	_data_ = g_slice_new0 (GalaDaemonRegisterWithSessionData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gala_daemon_register_with_session_data_free);
	_tmp0_ = g_strdup (app_id);
	_g_free0 (_data_->app_id);
	_data_->app_id = _tmp0_;
	gala_daemon_register_with_session_co (_data_);
}

GalaSessionClient*
gala_daemon_register_with_session_finish (GAsyncResult* _res_)
{
	GalaSessionClient* result;
	GalaDaemonRegisterWithSessionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
gala_daemon_register_with_session_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	GalaDaemonRegisterWithSessionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gala_daemon_register_with_session_co (_data_);
}

static gboolean
gala_daemon_register_with_session_co (GalaDaemonRegisterWithSessionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->path = NULL;
	_data_->msg = NULL;
	_data_->start_id = NULL;
	_data_->session = NULL;
	_data_->session_client = NULL;
	_data_->_tmp0_ = g_getenv ("DESKTOP_AUTOSTART_ID");
	_data_->_tmp1_ = g_strdup (_data_->_tmp0_);
	_g_free0 (_data_->start_id);
	_data_->start_id = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->start_id;
	if (_data_->_tmp2_ != NULL) {
		g_unsetenv ("DESKTOP_AUTOSTART_ID");
	} else {
		_data_->_tmp3_ = g_strdup ("");
		_g_free0 (_data_->start_id);
		_data_->start_id = _data_->_tmp3_;
		g_warning ("Main.vala:78: DESKTOP_AUTOSTART_ID not set, session registration may b" \
"e broken (not running via session?)");
	}
	{
		_data_->_state_ = 1;
		g_async_initable_new_async (GALA_TYPE_SESSION_MANAGER_PROXY, 0, NULL, gala_daemon_register_with_session_ready, _data_, "g-flags", 0, "g-name", "org.gnome.SessionManager", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/gnome/SessionManager", "g-interface-name", "org.gnome.SessionManager", NULL);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = (GalaSessionManager*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp4_ = (GalaSessionManager*) _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->_tmp4_;
		_data_->_tmp4_ = NULL;
		_g_object_unref0 (_data_->session);
		_data_->session = _data_->_tmp6_;
		_g_object_unref0 (_data_->_tmp4_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("Main.vala:90: Unable to connect to session manager: %s", _data_->_tmp8_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp10_ = _data_->session;
		_data_->_tmp11_ = _data_->start_id;
		_data_->_state_ = 2;
		gala_session_manager_register_client (_data_->_tmp10_, _data_->app_id, _data_->_tmp11_, gala_daemon_register_with_session_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp12_ = gala_session_manager_register_client_finish (_data_->_tmp10_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp9_ = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp13_ = _data_->_tmp9_;
		_data_->_tmp9_ = NULL;
		_g_free0 (_data_->path);
		_data_->path = _data_->_tmp13_;
		_g_free0 (_data_->_tmp9_);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp14_ = _data_->_vala1_e;
		_data_->_tmp15_ = _data_->_tmp14_->message;
		_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
		_g_free0 (_data_->msg);
		_data_->msg = _data_->_tmp16_;
		_data_->_tmp17_ = _data_->_vala1_e;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		g_warning ("Main.vala:98: Error registering with session manager: %s", _data_->_tmp18_);
		_data_->result = NULL;
		_g_error_free0 (_data_->_vala1_e);
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp20_ = _data_->path;
		_data_->_state_ = 3;
		g_async_initable_new_async (GALA_TYPE_SESSION_CLIENT_PROXY, 0, NULL, gala_daemon_register_with_session_ready, _data_, "g-flags", 0, "g-name", "org.gnome.SessionManager", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", (const gchar*) _data_->_tmp20_, "g-interface-name", "org.gnome.SessionManager.ClientPrivate", NULL);
		return FALSE;
		_state_3:
		_data_->_tmp21_ = (GalaSessionClient*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp19_ = (GalaSessionClient*) _data_->_tmp21_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch2_g_error;
		}
		_data_->_tmp22_ = _data_->_tmp19_;
		_data_->_tmp19_ = NULL;
		_g_object_unref0 (_data_->session_client);
		_data_->session_client = _data_->_tmp22_;
		_g_object_unref0 (_data_->_tmp19_);
	}
	goto __finally2;
	__catch2_g_error:
	{
		_data_->_vala2_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp23_ = _data_->_vala2_e;
		_data_->_tmp24_ = _data_->_tmp23_->message;
		g_warning ("Main.vala:105: Unable to get private sessions client proxy: %s", _data_->_tmp24_);
		_data_->result = NULL;
		_g_error_free0 (_data_->_vala2_e);
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally2:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->session_client);
		_g_object_unref0 (_data_->session);
		_g_free0 (_data_->start_id);
		_g_free0 (_data_->msg);
		_g_free0 (_data_->path);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->session_client;
	_g_object_unref0 (_data_->session);
	_g_free0 (_data_->start_id);
	_g_free0 (_data_->msg);
	_g_free0 (_data_->path);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gala_daemon_register_data_free (gpointer _data)
{
	GalaDaemonRegisterData* _data_;
	_data_ = _data;
	_gala_daemon_unref0 (_data_->self);
	g_slice_free (GalaDaemonRegisterData, _data_);
}

static gpointer
_gala_daemon_ref0 (gpointer self)
{
	return self ? gala_daemon_ref (self) : NULL;
}

static void
gala_daemon_register (GalaDaemon* self,
                      GAsyncReadyCallback _callback_,
                      gpointer _user_data_)
{
	GalaDaemonRegisterData* _data_;
	GalaDaemon* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (GalaDaemonRegisterData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gala_daemon_register_data_free);
	_tmp0_ = _gala_daemon_ref0 (self);
	_data_->self = _tmp0_;
	gala_daemon_register_co (_data_);
}

static gboolean
gala_daemon_register_finish (GalaDaemon* self,
                             GAsyncResult* _res_)
{
	gboolean result;
	GalaDaemonRegisterData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
gala_daemon_register_ready (GObject* source_object,
                            GAsyncResult* _res_,
                            gpointer _user_data_)
{
	GalaDaemonRegisterData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gala_daemon_register_co (_data_);
}

static void
__lambda4_ (GalaDaemon* self)
{
	gala_daemon_end_session (self, FALSE);
}

static void
___lambda4__gala_session_client_query_end_session (GalaSessionClient* _sender,
                                                   guint flags,
                                                   gpointer self)
{
	__lambda4_ ((GalaDaemon*) self);
}

static void
__lambda5_ (GalaDaemon* self)
{
	gala_daemon_end_session (self, FALSE);
}

static void
___lambda5__gala_session_client_end_session (GalaSessionClient* _sender,
                                             guint flags,
                                             gpointer self)
{
	__lambda5_ ((GalaDaemon*) self);
}

static void
__lambda6_ (GalaDaemon* self)
{
	gala_daemon_end_session (self, TRUE);
}

static void
___lambda6__gala_session_client_stop (GalaSessionClient* _sender,
                                      gpointer self)
{
	__lambda6_ ((GalaDaemon*) self);
}

static gboolean
gala_daemon_register_co (GalaDaemonRegisterData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	gala_daemon_register_with_session ("org.pantheon.gala.daemon", gala_daemon_register_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = gala_daemon_register_with_session_finish (_data_->_res_);
	_g_object_unref0 (_data_->self->priv->sclient);
	_data_->self->priv->sclient = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->self->priv->sclient;
	g_signal_connect (_data_->_tmp1_, "query-end-session", (GCallback) ___lambda4__gala_session_client_query_end_session, _data_->self);
	_data_->_tmp2_ = _data_->self->priv->sclient;
	g_signal_connect (_data_->_tmp2_, "end-session", (GCallback) ___lambda5__gala_session_client_end_session, _data_->self);
	_data_->_tmp3_ = _data_->self->priv->sclient;
	g_signal_connect (_data_->_tmp3_, "stop", (GCallback) ___lambda6__gala_session_client_stop, _data_->self);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gala_daemon_end_session (GalaDaemon* self,
                         gboolean quit)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	if (quit) {
		gtk_main_quit ();
		return;
	}
	{
		GalaSessionClient* _tmp0_;
		_tmp0_ = self->priv->sclient;
		gala_session_client_end_session_response (_tmp0_, TRUE, "", &_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 ("Main.vala:131: Unable to respond to session manager: %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
gala_value_daemon_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
gala_value_daemon_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		gala_daemon_unref (value->data[0].v_pointer);
	}
}

static void
gala_value_daemon_copy_value (const GValue* src_value,
                              GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = gala_daemon_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
gala_value_daemon_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
gala_value_daemon_collect_value (GValue* value,
                                 guint n_collect_values,
                                 GTypeCValue* collect_values,
                                 guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		GalaDaemon * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = gala_daemon_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
gala_value_daemon_lcopy_value (const GValue* value,
                               guint n_collect_values,
                               GTypeCValue* collect_values,
                               guint collect_flags)
{
	GalaDaemon ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = gala_daemon_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
gala_param_spec_daemon (const gchar* name,
                        const gchar* nick,
                        const gchar* blurb,
                        GType object_type,
                        GParamFlags flags)
{
	GalaParamSpecDaemon* spec;
	g_return_val_if_fail (g_type_is_a (object_type, GALA_TYPE_DAEMON), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
gala_value_get_daemon (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GALA_TYPE_DAEMON), NULL);
	return value->data[0].v_pointer;
}

void
gala_value_set_daemon (GValue* value,
                       gpointer v_object)
{
	GalaDaemon * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GALA_TYPE_DAEMON));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GALA_TYPE_DAEMON));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		gala_daemon_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gala_daemon_unref (old);
	}
}

void
gala_value_take_daemon (GValue* value,
                        gpointer v_object)
{
	GalaDaemon * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GALA_TYPE_DAEMON));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GALA_TYPE_DAEMON));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		gala_daemon_unref (old);
	}
}

static void
gala_daemon_class_init (GalaDaemonClass * klass,
                        gpointer klass_data)
{
	gala_daemon_parent_class = g_type_class_peek_parent (klass);
	((GalaDaemonClass *) klass)->finalize = gala_daemon_finalize;
	g_type_class_adjust_private_offset (klass, &GalaDaemon_private_offset);
}

static void
gala_daemon_instance_init (GalaDaemon * self,
                           gpointer klass)
{
	self->priv = gala_daemon_get_instance_private (self);
	self->priv->sclient = NULL;
	self->ref_count = 1;
}

static void
gala_daemon_finalize (GalaDaemon * obj)
{
	GalaDaemon * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GALA_TYPE_DAEMON, GalaDaemon);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->sclient);
}

static GType
gala_daemon_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { gala_value_daemon_init, gala_value_daemon_free_value, gala_value_daemon_copy_value, gala_value_daemon_peek_pointer, "p", gala_value_daemon_collect_value, "p", gala_value_daemon_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (GalaDaemonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gala_daemon_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GalaDaemon), 0, (GInstanceInitFunc) gala_daemon_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType gala_daemon_type_id;
	gala_daemon_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GalaDaemon", &g_define_type_info, &g_define_type_fundamental_info, 0);
	GalaDaemon_private_offset = g_type_add_instance_private (gala_daemon_type_id, sizeof (GalaDaemonPrivate));
	return gala_daemon_type_id;
}

GType
gala_daemon_get_type (void)
{
	static volatile gsize gala_daemon_type_id__once = 0;
	if (g_once_init_enter (&gala_daemon_type_id__once)) {
		GType gala_daemon_type_id;
		gala_daemon_type_id = gala_daemon_get_type_once ();
		g_once_init_leave (&gala_daemon_type_id__once, gala_daemon_type_id);
	}
	return gala_daemon_type_id__once;
}

gpointer
gala_daemon_ref (gpointer instance)
{
	GalaDaemon * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
gala_daemon_unref (gpointer instance)
{
	GalaDaemon * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		GALA_DAEMON_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static gint
gala_main (gchar** args,
           gint args_length1)
{
	GOptionContext* ctx = NULL;
	GOptionContext* _tmp0_;
	GOptionContext* _tmp1_;
	GOptionContext* _tmp2_;
	GOptionGroup* _tmp3_;
	GalaDaemon* daemon = NULL;
	GalaDaemon* _tmp9_;
	GalaDaemon* _tmp10_;
	GError* _inner_error0_ = NULL;
	gint result;
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
	gtk_init ((gint*) (&args_length1), &args);
	_tmp0_ = g_option_context_new ("Gala Daemon");
	ctx = _tmp0_;
	_tmp1_ = ctx;
	g_option_context_set_help_enabled (_tmp1_, TRUE);
	_tmp2_ = ctx;
	_tmp3_ = gtk_get_option_group (FALSE);
	g_option_context_add_group (_tmp2_, _tmp3_);
	{
		GOptionContext* _tmp4_;
		_tmp4_ = ctx;
		g_option_context_parse (_tmp4_, (gint*) (&args_length1), &args, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FILE* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = stderr;
		_tmp6_ = e;
		_tmp7_ = _tmp6_->message;
		fprintf (_tmp5_, "Error: %s\n", _tmp7_);
		result = 0;
		_g_error_free0 (e);
		_g_option_context_free0 (ctx);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gint _tmp8_ = -1;
		_g_option_context_free0 (ctx);
		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 _tmp8_;
	}
	_tmp9_ = gala_daemon_new ();
	daemon = _tmp9_;
	_tmp10_ = daemon;
	gala_daemon_run (_tmp10_);
	result = 0;
	_gala_daemon_unref0 (daemon);
	_g_option_context_free0 (ctx);
	return result;
}

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

