/* Application.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Application.vala, do not modify */

/*
 * Copyright (c) 2011-2018 elementary, Inc. (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 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <granite.h>
#include "wingpanel.h"
#include <gee.h>

#define WINGPANEL_APPLICATION_LIST_INDICATORS_ACTION_NAME "list-indicators"
#define WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME "open-indicator"
#define WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME "close-indicator"
#define WINGPANEL_APPLICATION_SERVER_TYPE_ACTION_NAME "greeter"
#define WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME "toggle-indicator"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define WINGPANEL_TYPE_APPLICATION (wingpanel_application_get_type ())
#define WINGPANEL_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_TYPE_APPLICATION, WingpanelApplication))
#define WINGPANEL_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_TYPE_APPLICATION, WingpanelApplicationClass))
#define WINGPANEL_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_TYPE_APPLICATION))
#define WINGPANEL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_TYPE_APPLICATION))
#define WINGPANEL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_TYPE_APPLICATION, WingpanelApplicationClass))

typedef struct _WingpanelApplication WingpanelApplication;
typedef struct _WingpanelApplicationClass WingpanelApplicationClass;
typedef struct _WingpanelApplicationPrivate WingpanelApplicationPrivate;

#define WINGPANEL_TYPE_PANEL_WINDOW (wingpanel_panel_window_get_type ())
#define WINGPANEL_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindow))
#define WINGPANEL_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindowClass))
#define WINGPANEL_IS_PANEL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_TYPE_PANEL_WINDOW))
#define WINGPANEL_IS_PANEL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_TYPE_PANEL_WINDOW))
#define WINGPANEL_PANEL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_TYPE_PANEL_WINDOW, WingpanelPanelWindowClass))

typedef struct _WingpanelPanelWindow WingpanelPanelWindow;
typedef struct _WingpanelPanelWindowClass WingpanelPanelWindowClass;
enum  {
	WINGPANEL_APPLICATION_0_PROPERTY,
	WINGPANEL_APPLICATION_NUM_PROPERTIES
};
static GParamSpec* wingpanel_application_properties[WINGPANEL_APPLICATION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define WINGPANEL_SESSION_MANAGER_TYPE_SESSION_CLIENT (wingpanel_session_manager_session_client_get_type ())
#define WINGPANEL_SESSION_MANAGER_SESSION_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_SESSION_MANAGER_TYPE_SESSION_CLIENT, WingpanelSessionManagerSessionClient))
#define WINGPANEL_SESSION_MANAGER_IS_SESSION_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_SESSION_MANAGER_TYPE_SESSION_CLIENT))
#define WINGPANEL_SESSION_MANAGER_SESSION_CLIENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), WINGPANEL_SESSION_MANAGER_TYPE_SESSION_CLIENT, WingpanelSessionManagerSessionClientIface))

typedef struct _WingpanelSessionManagerSessionClient WingpanelSessionManagerSessionClient;
typedef struct _WingpanelSessionManagerSessionClientIface WingpanelSessionManagerSessionClientIface;

#define WINGPANEL_SESSION_MANAGER_TYPE_SESSION_CLIENT_PROXY (wingpanel_session_manager_session_client_proxy_get_type ())
typedef struct _Block1Data Block1Data;
typedef struct _WingpanelApplicationRegisterWithSessionData WingpanelApplicationRegisterWithSessionData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))
typedef struct _Block3Data Block3Data;
typedef struct _WingpanelPanelWindowPrivate WingpanelPanelWindowPrivate;

#define WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER (wingpanel_services_popover_manager_get_type ())
#define WINGPANEL_SERVICES_POPOVER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManager))
#define WINGPANEL_SERVICES_POPOVER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManagerClass))
#define WINGPANEL_SERVICES_IS_POPOVER_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER))
#define WINGPANEL_SERVICES_IS_POPOVER_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER))
#define WINGPANEL_SERVICES_POPOVER_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WINGPANEL_SERVICES_TYPE_POPOVER_MANAGER, WingpanelServicesPopoverManagerClass))

typedef struct _WingpanelServicesPopoverManager WingpanelServicesPopoverManager;
typedef struct _WingpanelServicesPopoverManagerClass WingpanelServicesPopoverManagerClass;

struct _WingpanelApplication {
	GtkApplication parent_instance;
	WingpanelApplicationPrivate * priv;
};

struct _WingpanelApplicationClass {
	GtkApplicationClass parent_class;
};

struct _WingpanelApplicationPrivate {
	WingpanelPanelWindow* panel_window;
};

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

struct _Block1Data {
	int _ref_count_;
	WingpanelApplication* self;
	WingpanelSessionManagerSessionClient* sclient;
	gpointer _async_data_;
};

struct _WingpanelApplicationRegisterWithSessionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	WingpanelApplication* self;
	gboolean result;
	Block1Data* _data1_;
	WingpanelSessionManagerSessionClient* _tmp0_;
	WingpanelSessionManagerSessionClient* _tmp1_;
	WingpanelSessionManagerSessionClient* _tmp2_;
	WingpanelSessionManagerSessionClient* _tmp3_;
	WingpanelSessionManagerSessionClient* _tmp4_;
};

struct _Block2Data {
	int _ref_count_;
	WingpanelApplication* self;
	GraniteSettings* granite_settings;
	GtkSettings* gtk_settings;
};

struct _Block3Data {
	int _ref_count_;
	WingpanelApplication* self;
	GSimpleAction* list_indicators_action;
};

struct _WingpanelPanelWindow {
	GtkWindow parent_instance;
	WingpanelPanelWindowPrivate * priv;
	WingpanelServicesPopoverManager* popover_manager;
};

struct _WingpanelPanelWindowClass {
	GtkWindowClass parent_class;
};

static gint WingpanelApplication_private_offset;
static gpointer wingpanel_application_parent_class = NULL;

VALA_EXTERN GType wingpanel_application_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelApplication, g_object_unref)
VALA_EXTERN GType wingpanel_panel_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelPanelWindow, g_object_unref)
static void wingpanel_application_register_with_session_data_free (gpointer _data);
static void wingpanel_application_register_with_session (WingpanelApplication* self,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static gboolean wingpanel_application_register_with_session_finish (WingpanelApplication* self,
                                                             GAsyncResult* _res_);
static gboolean wingpanel_application_register_with_session_co (WingpanelApplicationRegisterWithSessionData* _data_);
VALA_EXTERN GType wingpanel_session_manager_session_client_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint wingpanel_session_manager_session_client_register_object (void* object,
                                                                GDBusConnection* connection,
                                                                const gchar* path,
                                                                GError** error);
VALA_EXTERN GType wingpanel_session_manager_session_client_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelSessionManagerSessionClient, g_object_unref)
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
VALA_EXTERN void wingpanel_session_manager_register_with_session (const gchar* app_id,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
VALA_EXTERN WingpanelSessionManagerSessionClient* wingpanel_session_manager_register_with_session_finish (GAsyncResult* _res_);
static void wingpanel_application_register_with_session_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void __lambda24_ (Block1Data* _data1_,
                  guint flags);
static void wingpanel_application_session_respond (WingpanelApplication* self,
                                            WingpanelSessionManagerSessionClient* sclient,
                                            guint flags);
static void ___lambda24__wingpanel_session_manager_session_client_query_end_session (WingpanelSessionManagerSessionClient* _sender,
                                                                              guint flags,
                                                                              gpointer self);
static void __lambda25_ (Block1Data* _data1_,
                  guint flags);
static void ___lambda25__wingpanel_session_manager_session_client_end_session (WingpanelSessionManagerSessionClient* _sender,
                                                                        guint flags,
                                                                        gpointer self);
static void wingpanel_application_session_stop (WingpanelApplication* self);
static void _wingpanel_application_session_stop_wingpanel_session_manager_session_client_stop (WingpanelSessionManagerSessionClient* _sender,
                                                                                        gpointer self);
VALA_EXTERN void wingpanel_session_manager_session_client_end_session_response (WingpanelSessionManagerSessionClient* self,
                                                                    gboolean is_ok,
                                                                    const gchar* reason,
                                                                    GError** error);
static gint wingpanel_application_real_command_line (GApplication* base,
                                              GApplicationCommandLine* command_line);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void __lambda26_ (Block2Data* _data2_);
static void ___lambda26__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static void wingpanel_application_real_startup (GApplication* base);
VALA_EXTERN WingpanelPanelWindow* wingpanel_panel_window_new (GtkApplication* application);
VALA_EXTERN WingpanelPanelWindow* wingpanel_panel_window_construct (GType object_type,
                                                        GtkApplication* application);
static void wingpanel_application_register_actions (WingpanelApplication* self);
static void wingpanel_application_real_activate (GApplication* base);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gchar** wingpanel_application_list_indicators (WingpanelApplication* self,
                                               gint* result_length1);
static void __lambda27_ (Block3Data* _data3_);
static void ___lambda27__wingpanel_indicator_manager_indicator_added (WingpanelIndicatorManager* _sender,
                                                               WingpanelIndicator* indicator,
                                                               gpointer self);
static void __lambda28_ (Block3Data* _data3_);
static void ___lambda28__wingpanel_indicator_manager_indicator_removed (WingpanelIndicatorManager* _sender,
                                                                 WingpanelIndicator* indicator,
                                                                 gpointer self);
static void __lambda29_ (WingpanelApplication* self,
                  GVariant* parameter);
VALA_EXTERN GType wingpanel_services_popover_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (WingpanelServicesPopoverManager, g_object_unref)
VALA_EXTERN void wingpanel_services_popover_manager_set_popover_visible (WingpanelServicesPopoverManager* self,
                                                             const gchar* code_name,
                                                             gboolean visible);
static void ___lambda29__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static void __lambda30_ (WingpanelApplication* self,
                  GVariant* parameter);
static void ___lambda30__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static void __lambda31_ (WingpanelApplication* self,
                  GVariant* parameter);
VALA_EXTERN void wingpanel_panel_window_toggle_indicator (WingpanelPanelWindow* self,
                                              const gchar* name);
static void ___lambda31__g_simple_action_activate (GSimpleAction* _sender,
                                            GVariant* parameter,
                                            gpointer self);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static gint wingpanel_application_main (gchar** args,
                                 gint args_length1);
VALA_EXTERN WingpanelApplication* wingpanel_application_new (void);
VALA_EXTERN WingpanelApplication* wingpanel_application_construct (GType object_type);
static GObject * wingpanel_application_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _wingpanel_application___lambda32_ (WingpanelApplication* self,
                                         GObject* obj,
                                         GAsyncResult* res);
static void __wingpanel_application___lambda32__gasync_ready_callback (GObject* source_object,
                                                                GAsyncResult* res,
                                                                gpointer self);
static void wingpanel_application_finalize (GObject * obj);
static GType wingpanel_application_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GOptionEntry WINGPANEL_APPLICATION_OPTIONS[5] = {{WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME, 'o', (gint) 0, G_OPTION_ARG_STRING, NULL, "Open an indicator", "code_name"}, {WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME, 'c', (gint) 0, G_OPTION_ARG_STRING, NULL, "Close an indicator", "code_name"}, {WINGPANEL_APPLICATION_SERVER_TYPE_ACTION_NAME, 'g', (gint) 0, G_OPTION_ARG_NONE, NULL, "Server is a greeter", NULL}, {WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME, 't', (gint) 0, G_OPTION_ARG_STRING, NULL, "Toggle an indicator", "code_name"}, {NULL}};

static inline gpointer
wingpanel_application_get_instance_private (WingpanelApplication* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelApplication_private_offset);
}

static void
wingpanel_application_register_with_session_data_free (gpointer _data)
{
	WingpanelApplicationRegisterWithSessionData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (WingpanelApplicationRegisterWithSessionData, _data_);
}

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

static void
wingpanel_application_register_with_session (WingpanelApplication* self,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	WingpanelApplicationRegisterWithSessionData* _data_;
	WingpanelApplication* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (WingpanelApplicationRegisterWithSessionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, wingpanel_application_register_with_session_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	wingpanel_application_register_with_session_co (_data_);
}

static gboolean
wingpanel_application_register_with_session_finish (WingpanelApplication* self,
                                                    GAsyncResult* _res_)
{
	gboolean result;
	WingpanelApplicationRegisterWithSessionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

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_)) {
		WingpanelApplication* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->sclient);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
wingpanel_application_register_with_session_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	WingpanelApplicationRegisterWithSessionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	wingpanel_application_register_with_session_co (_data_);
}

static void
__lambda24_ (Block1Data* _data1_,
             guint flags)
{
	WingpanelApplication* self;
	WingpanelSessionManagerSessionClient* _tmp0_;
	self = _data1_->self;
	_tmp0_ = _data1_->sclient;
	wingpanel_application_session_respond (self, _tmp0_, flags);
}

static void
___lambda24__wingpanel_session_manager_session_client_query_end_session (WingpanelSessionManagerSessionClient* _sender,
                                                                         guint flags,
                                                                         gpointer self)
{
	__lambda24_ (self, flags);
}

static void
__lambda25_ (Block1Data* _data1_,
             guint flags)
{
	WingpanelApplication* self;
	WingpanelSessionManagerSessionClient* _tmp0_;
	self = _data1_->self;
	_tmp0_ = _data1_->sclient;
	wingpanel_application_session_respond (self, _tmp0_, flags);
}

static void
___lambda25__wingpanel_session_manager_session_client_end_session (WingpanelSessionManagerSessionClient* _sender,
                                                                   guint flags,
                                                                   gpointer self)
{
	__lambda25_ (self, flags);
}

static void
_wingpanel_application_session_stop_wingpanel_session_manager_session_client_stop (WingpanelSessionManagerSessionClient* _sender,
                                                                                   gpointer self)
{
	wingpanel_application_session_stop ((WingpanelApplication*) self);
}

static gboolean
wingpanel_application_register_with_session_co (WingpanelApplicationRegisterWithSessionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_data_->_data1_->self = g_object_ref (_data_->self);
	_data_->_data1_->_async_data_ = _data_;
	_data_->_state_ = 1;
	wingpanel_session_manager_register_with_session ("io.elementary.wingpanel", wingpanel_application_register_with_session_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = wingpanel_session_manager_register_with_session_finish (_data_->_res_);
	_data_->_data1_->sclient = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->_data1_->sclient;
	if (_data_->_tmp1_ == NULL) {
		_data_->result = FALSE;
		block1_data_unref (_data_->_data1_);
		_data_->_data1_ = NULL;
		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;
	}
	_data_->_tmp2_ = _data_->_data1_->sclient;
	g_signal_connect_data (_data_->_tmp2_, "query-end-session", (GCallback) ___lambda24__wingpanel_session_manager_session_client_query_end_session, block1_data_ref (_data_->_data1_), (GClosureNotify) block1_data_unref, 0);
	_data_->_tmp3_ = _data_->_data1_->sclient;
	g_signal_connect_data (_data_->_tmp3_, "end-session", (GCallback) ___lambda25__wingpanel_session_manager_session_client_end_session, block1_data_ref (_data_->_data1_), (GClosureNotify) block1_data_unref, 0);
	_data_->_tmp4_ = _data_->_data1_->sclient;
	g_signal_connect_object (_data_->_tmp4_, "stop", (GCallback) _wingpanel_application_session_stop_wingpanel_session_manager_session_client_stop, _data_->self, 0);
	_data_->result = TRUE;
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = NULL;
	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
wingpanel_application_session_respond (WingpanelApplication* self,
                                       WingpanelSessionManagerSessionClient* sclient,
                                       guint flags)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sclient != NULL);
	{
		wingpanel_session_manager_session_client_end_session_response (sclient, TRUE, "", &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("Application.vala:68: Unable to respond to session manager: %s", _tmp1_);
		_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
wingpanel_application_session_stop (WingpanelApplication* self)
{
	WingpanelPanelWindow* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->panel_window;
	if (_tmp0_ != NULL) {
		WingpanelPanelWindow* _tmp1_;
		_tmp1_ = self->priv->panel_window;
		gtk_widget_destroy ((GtkWidget*) _tmp1_);
	}
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		WingpanelApplication* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->gtk_settings);
		_g_object_unref0 (_data2_->granite_settings);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static gpointer
_g_variant_dict_ref0 (gpointer self)
{
	return self ? g_variant_dict_ref (self) : NULL;
}

static void
__lambda26_ (Block2Data* _data2_)
{
	WingpanelApplication* self;
	GtkSettings* _tmp0_;
	GraniteSettings* _tmp1_;
	GraniteSettingsColorScheme _tmp2_;
	GraniteSettingsColorScheme _tmp3_;
	self = _data2_->self;
	_tmp0_ = _data2_->gtk_settings;
	_tmp1_ = _data2_->granite_settings;
	_tmp2_ = granite_settings_get_prefers_color_scheme (_tmp1_);
	_tmp3_ = _tmp2_;
	g_object_set (_tmp0_, "gtk-application-prefer-dark-theme", _tmp3_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
}

static void
___lambda26__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	__lambda26_ (self);
}

static gint
wingpanel_application_real_command_line (GApplication* base,
                                         GApplicationCommandLine* command_line)
{
	WingpanelApplication * self;
	Block2Data* _data2_;
	GVariantDict* options = NULL;
	GVariantDict* _tmp0_;
	GVariantDict* _tmp1_;
	GVariantDict* _tmp2_;
	GraniteSettings* _tmp5_;
	GraniteSettings* _tmp6_;
	GtkSettings* _tmp7_;
	GtkSettings* _tmp8_;
	GtkSettings* _tmp9_;
	GtkSettings* _tmp10_;
	GraniteSettings* _tmp11_;
	GraniteSettingsColorScheme _tmp12_;
	GraniteSettingsColorScheme _tmp13_;
	GraniteSettings* _tmp14_;
	GVariantDict* _tmp15_;
	GVariantDict* _tmp20_;
	GVariantDict* _tmp25_;
	gint result;
	self = (WingpanelApplication*) base;
	g_return_val_if_fail (command_line != NULL, 0);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = g_application_command_line_get_options_dict (command_line);
	_tmp1_ = _g_variant_dict_ref0 (_tmp0_);
	options = _tmp1_;
	_tmp2_ = options;
	if (g_variant_dict_contains (_tmp2_, WINGPANEL_APPLICATION_SERVER_TYPE_ACTION_NAME)) {
		WingpanelIndicatorManager* _tmp3_;
		_tmp3_ = wingpanel_indicator_manager_get_default ();
		wingpanel_indicator_manager_initialize (_tmp3_, WINGPANEL_INDICATOR_MANAGER_SERVER_TYPE_GREETER);
	} else {
		WingpanelIndicatorManager* _tmp4_;
		_tmp4_ = wingpanel_indicator_manager_get_default ();
		wingpanel_indicator_manager_initialize (_tmp4_, WINGPANEL_INDICATOR_MANAGER_SERVER_TYPE_SESSION);
	}
	_tmp5_ = granite_settings_get_default ();
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_data2_->granite_settings = _tmp6_;
	_tmp7_ = gtk_settings_get_default ();
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_data2_->gtk_settings = _tmp8_;
	_tmp9_ = _data2_->gtk_settings;
	g_object_set (_tmp9_, "gtk-icon-theme-name", "elementary", NULL);
	_tmp10_ = _data2_->gtk_settings;
	_tmp11_ = _data2_->granite_settings;
	_tmp12_ = granite_settings_get_prefers_color_scheme (_tmp11_);
	_tmp13_ = _tmp12_;
	g_object_set (_tmp10_, "gtk-application-prefer-dark-theme", _tmp13_ == GRANITE_SETTINGS_COLOR_SCHEME_DARK, NULL);
	_tmp14_ = _data2_->granite_settings;
	g_signal_connect_data ((GObject*) _tmp14_, "notify::prefers-color-scheme", (GCallback) ___lambda26__g_object_notify, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
	_tmp15_ = options;
	if (g_variant_dict_contains (_tmp15_, WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME)) {
		GVariantDict* _tmp16_;
		const GVariantType* _tmp17_;
		GVariant* _tmp18_;
		GVariant* _tmp19_;
		_tmp16_ = options;
		_tmp17_ = G_VARIANT_TYPE_STRING;
		_tmp18_ = g_variant_dict_lookup_value (_tmp16_, WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME, _tmp17_);
		_tmp19_ = _tmp18_;
		g_action_group_activate_action ((GActionGroup*) self, WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME, _tmp19_);
		_g_variant_unref0 (_tmp19_);
	}
	_tmp20_ = options;
	if (g_variant_dict_contains (_tmp20_, WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME)) {
		GVariantDict* _tmp21_;
		const GVariantType* _tmp22_;
		GVariant* _tmp23_;
		GVariant* _tmp24_;
		_tmp21_ = options;
		_tmp22_ = G_VARIANT_TYPE_STRING;
		_tmp23_ = g_variant_dict_lookup_value (_tmp21_, WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME, _tmp22_);
		_tmp24_ = _tmp23_;
		g_action_group_activate_action ((GActionGroup*) self, WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME, _tmp24_);
		_g_variant_unref0 (_tmp24_);
	}
	_tmp25_ = options;
	if (g_variant_dict_contains (_tmp25_, WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME)) {
		GVariantDict* _tmp26_;
		const GVariantType* _tmp27_;
		GVariant* _tmp28_;
		GVariant* _tmp29_;
		_tmp26_ = options;
		_tmp27_ = G_VARIANT_TYPE_STRING;
		_tmp28_ = g_variant_dict_lookup_value (_tmp26_, WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME, _tmp27_);
		_tmp29_ = _tmp28_;
		g_action_group_activate_action ((GActionGroup*) self, WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME, _tmp29_);
		_g_variant_unref0 (_tmp29_);
	}
	result = 0;
	_g_variant_dict_unref0 (options);
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return result;
}

static void
wingpanel_application_real_startup (GApplication* base)
{
	WingpanelApplication * self;
	WingpanelPanelWindow* _tmp0_;
	WingpanelPanelWindow* _tmp1_;
	self = (WingpanelApplication*) base;
	G_APPLICATION_CLASS (wingpanel_application_parent_class)->startup ((GApplication*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_application_get_type (), GtkApplication));
	_tmp0_ = wingpanel_panel_window_new ((GtkApplication*) self);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->panel_window);
	self->priv->panel_window = _tmp0_;
	_tmp1_ = self->priv->panel_window;
	gtk_widget_show_all ((GtkWidget*) _tmp1_);
	wingpanel_application_register_actions (self);
}

static void
wingpanel_application_real_activate (GApplication* base)
{
	WingpanelApplication * self;
	self = (WingpanelApplication*) base;
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		WingpanelApplication* self;
		self = _data3_->self;
		_g_object_unref0 (_data3_->list_indicators_action);
		_g_object_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda27_ (Block3Data* _data3_)
{
	WingpanelApplication* self;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	self = _data3_->self;
	_tmp1_ = wingpanel_application_list_indicators (self, &_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp0_;
	_tmp3_ = g_variant_new_strv (_tmp2_, _tmp0_);
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	g_simple_action_set_state (_data3_->list_indicators_action, _tmp4_);
	_g_variant_unref0 (_tmp4_);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
}

static void
___lambda27__wingpanel_indicator_manager_indicator_added (WingpanelIndicatorManager* _sender,
                                                          WingpanelIndicator* indicator,
                                                          gpointer self)
{
	__lambda27_ (self);
}

static void
__lambda28_ (Block3Data* _data3_)
{
	WingpanelApplication* self;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	self = _data3_->self;
	_tmp1_ = wingpanel_application_list_indicators (self, &_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp0_;
	_tmp3_ = g_variant_new_strv (_tmp2_, _tmp0_);
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	g_simple_action_set_state (_data3_->list_indicators_action, _tmp4_);
	_g_variant_unref0 (_tmp4_);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
}

static void
___lambda28__wingpanel_indicator_manager_indicator_removed (WingpanelIndicatorManager* _sender,
                                                            WingpanelIndicator* indicator,
                                                            gpointer self)
{
	__lambda28_ (self);
}

static void
__lambda29_ (WingpanelApplication* self,
             GVariant* parameter)
{
	WingpanelPanelWindow* _tmp0_;
	WingpanelPanelWindow* _tmp1_;
	WingpanelServicesPopoverManager* _tmp2_;
	const gchar* _tmp3_;
	_tmp0_ = self->priv->panel_window;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->panel_window;
	_tmp2_ = _tmp1_->popover_manager;
	_tmp3_ = g_variant_get_string (parameter, NULL);
	wingpanel_services_popover_manager_set_popover_visible (_tmp2_, _tmp3_, TRUE);
}

static void
___lambda29__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda29_ ((WingpanelApplication*) self, parameter);
}

static void
__lambda30_ (WingpanelApplication* self,
             GVariant* parameter)
{
	WingpanelPanelWindow* _tmp0_;
	WingpanelPanelWindow* _tmp1_;
	WingpanelServicesPopoverManager* _tmp2_;
	const gchar* _tmp3_;
	_tmp0_ = self->priv->panel_window;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->panel_window;
	_tmp2_ = _tmp1_->popover_manager;
	_tmp3_ = g_variant_get_string (parameter, NULL);
	wingpanel_services_popover_manager_set_popover_visible (_tmp2_, _tmp3_, FALSE);
}

static void
___lambda30__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda30_ ((WingpanelApplication*) self, parameter);
}

static void
__lambda31_ (WingpanelApplication* self,
             GVariant* parameter)
{
	WingpanelPanelWindow* _tmp0_;
	WingpanelPanelWindow* _tmp1_;
	const gchar* _tmp2_;
	_tmp0_ = self->priv->panel_window;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->panel_window;
	_tmp2_ = g_variant_get_string (parameter, NULL);
	wingpanel_panel_window_toggle_indicator (_tmp1_, _tmp2_);
}

static void
___lambda31__g_simple_action_activate (GSimpleAction* _sender,
                                       GVariant* parameter,
                                       gpointer self)
{
	__lambda31_ ((WingpanelApplication*) self, parameter);
}

static void
wingpanel_application_register_actions (WingpanelApplication* self)
{
	Block3Data* _data3_;
	gint _tmp0_ = 0;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	GSimpleAction* _tmp5_;
	GSimpleAction* _tmp6_;
	WingpanelIndicatorManager* indicator_manager = NULL;
	WingpanelIndicatorManager* _tmp7_;
	WingpanelIndicatorManager* _tmp8_;
	GSimpleAction* open_indicator_action = NULL;
	const GVariantType* _tmp9_;
	GSimpleAction* _tmp10_;
	GSimpleAction* close_indicator_action = NULL;
	const GVariantType* _tmp11_;
	GSimpleAction* _tmp12_;
	GSimpleAction* toggle_indicator_action = NULL;
	const GVariantType* _tmp13_;
	GSimpleAction* _tmp14_;
	g_return_if_fail (self != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_object_ref (self);
	_tmp1_ = wingpanel_application_list_indicators (self, &_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp0_;
	_tmp3_ = g_variant_new_strv (_tmp2_, _tmp0_);
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_simple_action_new_stateful (WINGPANEL_APPLICATION_LIST_INDICATORS_ACTION_NAME, NULL, _tmp4_);
	_tmp6_ = _tmp5_;
	_g_variant_unref0 (_tmp4_);
	_tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL);
	_data3_->list_indicators_action = _tmp6_;
	_tmp7_ = wingpanel_indicator_manager_get_default ();
	_tmp8_ = _g_object_ref0 (_tmp7_);
	indicator_manager = _tmp8_;
	g_signal_connect_data (indicator_manager, "indicator-added", (GCallback) ___lambda27__wingpanel_indicator_manager_indicator_added, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	g_signal_connect_data (indicator_manager, "indicator-removed", (GCallback) ___lambda28__wingpanel_indicator_manager_indicator_removed, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	_tmp9_ = G_VARIANT_TYPE_STRING;
	_tmp10_ = g_simple_action_new (WINGPANEL_APPLICATION_OPEN_INDICATOR_ACTION_NAME, _tmp9_);
	open_indicator_action = _tmp10_;
	g_signal_connect_object (open_indicator_action, "activate", (GCallback) ___lambda29__g_simple_action_activate, self, 0);
	_tmp11_ = G_VARIANT_TYPE_STRING;
	_tmp12_ = g_simple_action_new (WINGPANEL_APPLICATION_CLOSE_INDICATOR_ACTION_NAME, _tmp11_);
	close_indicator_action = _tmp12_;
	g_signal_connect_object (close_indicator_action, "activate", (GCallback) ___lambda30__g_simple_action_activate, self, 0);
	_tmp13_ = G_VARIANT_TYPE_STRING;
	_tmp14_ = g_simple_action_new (WINGPANEL_APPLICATION_TOGGLE_INDICATOR_ACTION_NAME, _tmp13_);
	toggle_indicator_action = _tmp14_;
	g_signal_connect_object (toggle_indicator_action, "activate", (GCallback) ___lambda31__g_simple_action_activate, self, 0);
	g_action_map_add_action ((GActionMap*) self, (GAction*) _data3_->list_indicators_action);
	g_action_map_add_action ((GActionMap*) self, (GAction*) open_indicator_action);
	g_action_map_add_action ((GActionMap*) self, (GAction*) close_indicator_action);
	g_action_map_add_action ((GActionMap*) self, (GAction*) toggle_indicator_action);
	_g_object_unref0 (toggle_indicator_action);
	_g_object_unref0 (close_indicator_action);
	_g_object_unref0 (open_indicator_action);
	_g_object_unref0 (indicator_manager);
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

static void
_vala_array_add1 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar**
wingpanel_application_list_indicators (WingpanelApplication* self,
                                       gint* result_length1)
{
	gchar** code_names = NULL;
	gchar** _tmp0_;
	gint code_names_length1;
	gint _code_names_size_;
	gchar** _tmp13_;
	gint _tmp13__length1;
	gchar** result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	code_names = _tmp0_;
	code_names_length1 = 0;
	_code_names_size_ = code_names_length1;
	{
		GeeIterator* _indicator_it = NULL;
		WingpanelIndicatorManager* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp1_ = wingpanel_indicator_manager_get_default ();
		_tmp2_ = wingpanel_indicator_manager_get_indicators (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_indicator_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			WingpanelIndicator* indicator = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			WingpanelIndicator* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			gchar* _tmp12_;
			_tmp6_ = _indicator_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _indicator_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			indicator = (WingpanelIndicator*) _tmp8_;
			_tmp9_ = indicator;
			_tmp10_ = wingpanel_indicator_get_code_name (_tmp9_);
			_tmp11_ = _tmp10_;
			_tmp12_ = g_strdup (_tmp11_);
			_vala_array_add1 (&code_names, &code_names_length1, &_code_names_size_, _tmp12_);
			_g_object_unref0 (indicator);
		}
		_g_object_unref0 (_indicator_it);
	}
	_tmp13_ = code_names;
	_tmp13__length1 = code_names_length1;
	if (result_length1) {
		*result_length1 = _tmp13__length1;
	}
	result = _tmp13_;
	return result;
}

static gint
wingpanel_application_main (gchar** args,
                            gint args_length1)
{
	WingpanelApplication* _tmp0_;
	WingpanelApplication* _tmp1_;
	gint _tmp2_;
	gint result;
	_tmp0_ = wingpanel_application_new ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_application_run ((GApplication*) _tmp1_, (gint) args_length1, args);
	_g_object_unref0 (_tmp1_);
	result = _tmp2_;
	return result;
}

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

WingpanelApplication*
wingpanel_application_construct (GType object_type)
{
	WingpanelApplication * self = NULL;
	self = (WingpanelApplication*) g_object_new (object_type, NULL);
	return self;
}

WingpanelApplication*
wingpanel_application_new (void)
{
	return wingpanel_application_construct (WINGPANEL_TYPE_APPLICATION);
}

static void
_wingpanel_application___lambda32_ (WingpanelApplication* self,
                                    GObject* obj,
                                    GAsyncResult* res)
{
	gboolean success = FALSE;
	g_return_if_fail (res != NULL);
	success = wingpanel_application_register_with_session_finish (self, res);
	if (!success) {
		g_warning ("Application.vala:46: Failed to register with Session manager");
	}
}

static void
__wingpanel_application___lambda32__gasync_ready_callback (GObject* source_object,
                                                           GAsyncResult* res,
                                                           gpointer self)
{
	_wingpanel_application___lambda32_ ((WingpanelApplication*) self, source_object, res);
	g_object_unref (self);
}

static GObject *
wingpanel_application_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	WingpanelApplication * self;
	parent_class = G_OBJECT_CLASS (wingpanel_application_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_TYPE_APPLICATION, WingpanelApplication);
	g_application_set_flags ((GApplication*) self, G_APPLICATION_HANDLES_COMMAND_LINE);
	g_application_set_application_id ((GApplication*) self, "org.elementary.wingpanel");
	g_application_add_main_option_entries ((GApplication*) self, WINGPANEL_APPLICATION_OPTIONS);
	wingpanel_application_register_with_session (self, __wingpanel_application___lambda32__gasync_ready_callback, g_object_ref (self));
	return obj;
}

static void
wingpanel_application_class_init (WingpanelApplicationClass * klass,
                                  gpointer klass_data)
{
	wingpanel_application_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelApplication_private_offset);
	((GApplicationClass *) klass)->command_line = (gint (*) (GApplication*, GApplicationCommandLine*)) wingpanel_application_real_command_line;
	((GApplicationClass *) klass)->startup = (void (*) (GApplication*)) wingpanel_application_real_startup;
	((GApplicationClass *) klass)->activate = (void (*) (GApplication*)) wingpanel_application_real_activate;
	G_OBJECT_CLASS (klass)->constructor = wingpanel_application_constructor;
	G_OBJECT_CLASS (klass)->finalize = wingpanel_application_finalize;
}

static void
wingpanel_application_instance_init (WingpanelApplication * self,
                                     gpointer klass)
{
	self->priv = wingpanel_application_get_instance_private (self);
	self->priv->panel_window = NULL;
}

static void
wingpanel_application_finalize (GObject * obj)
{
	WingpanelApplication * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_TYPE_APPLICATION, WingpanelApplication);
	_g_object_unref0 (self->priv->panel_window);
	G_OBJECT_CLASS (wingpanel_application_parent_class)->finalize (obj);
}

static GType
wingpanel_application_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelApplicationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_application_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelApplication), 0, (GInstanceInitFunc) wingpanel_application_instance_init, NULL };
	GType wingpanel_application_type_id;
	wingpanel_application_type_id = g_type_register_static (gtk_application_get_type (), "WingpanelApplication", &g_define_type_info, 0);
	WingpanelApplication_private_offset = g_type_add_instance_private (wingpanel_application_type_id, sizeof (WingpanelApplicationPrivate));
	return wingpanel_application_type_id;
}

GType
wingpanel_application_get_type (void)
{
	static volatile gsize wingpanel_application_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_application_type_id__once)) {
		GType wingpanel_application_type_id;
		wingpanel_application_type_id = wingpanel_application_get_type_once ();
		g_once_init_leave (&wingpanel_application_type_id__once, wingpanel_application_type_id);
	}
	return wingpanel_application_type_id__once;
}

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);
}

