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

/*
 * Copyright (c) 2011-2015 Wingpanel Developers (http://launchpad.net/wingpanel)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 */

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	WINGPANEL_INTERFACE_DBUS_SERVER_0_PROPERTY,
	WINGPANEL_INTERFACE_DBUS_SERVER_NUM_PROPERTIES
};
static GParamSpec* wingpanel_interface_dbus_server_properties[WINGPANEL_INTERFACE_DBUS_SERVER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	WINGPANEL_INTERFACE_DBUS_SERVER_STATE_CHANGED_SIGNAL,
	WINGPANEL_INTERFACE_DBUS_SERVER_NUM_SIGNALS
};
static guint wingpanel_interface_dbus_server_signals[WINGPANEL_INTERFACE_DBUS_SERVER_NUM_SIGNALS] = {0};

struct _WingpanelInterfaceDBusServerPrivate {
	WingpanelInterfaceBackgroundManager* background_manager;
	WingpanelInterfaceFocusManager* focus_manager;
};

static gint WingpanelInterfaceDBusServer_private_offset;
static gpointer wingpanel_interface_dbus_server_parent_class = NULL;

static void __lambda20_ (WingpanelInterfaceDBusServer* self,
                  BackgroundState state,
                  guint animation_duration);
static void ___lambda20__wingpanel_interface_background_manager_state_changed (WingpanelInterfaceBackgroundManager* _sender,
                                                                        BackgroundState state,
                                                                        guint animation_duration,
                                                                        gpointer self);
static void g_cclosure_user_marshal_VOID__ENUM_UINT (GClosure * closure,
                                              GValue * return_value,
                                              guint n_param_values,
                                              const GValue * param_values,
                                              gpointer invocation_hint,
                                              gpointer marshal_data);
static void wingpanel_interface_dbus_server_finalize (GObject * obj);
static GType wingpanel_interface_dbus_server_get_type_once (void);
static void _dbus_wingpanel_interface_dbus_server_initialize (WingpanelInterfaceDBusServer* self,
                                                       GVariant* _parameters_,
                                                       GDBusMethodInvocation* invocation);
static void _dbus_wingpanel_interface_dbus_server_begin_grab_focused_window (WingpanelInterfaceDBusServer* self,
                                                                      GVariant* _parameters_,
                                                                      GDBusMethodInvocation* invocation);
static void _dbus_wingpanel_interface_dbus_server_remember_focused_window (WingpanelInterfaceDBusServer* self,
                                                                    GVariant* _parameters_,
                                                                    GDBusMethodInvocation* invocation);
static void _dbus_wingpanel_interface_dbus_server_restore_focused_window (WingpanelInterfaceDBusServer* self,
                                                                   GVariant* _parameters_,
                                                                   GDBusMethodInvocation* invocation);
static void wingpanel_interface_dbus_server_dbus_interface_method_call (GDBusConnection* connection,
                                                                 const gchar* sender,
                                                                 const gchar* object_path,
                                                                 const gchar* interface_name,
                                                                 const gchar* method_name,
                                                                 GVariant* parameters,
                                                                 GDBusMethodInvocation* invocation,
                                                                 gpointer user_data);
static GVariant* wingpanel_interface_dbus_server_dbus_interface_get_property (GDBusConnection* connection,
                                                                       const gchar* sender,
                                                                       const gchar* object_path,
                                                                       const gchar* interface_name,
                                                                       const gchar* property_name,
                                                                       GError** error,
                                                                       gpointer user_data);
static gboolean wingpanel_interface_dbus_server_dbus_interface_set_property (GDBusConnection* connection,
                                                                      const gchar* sender,
                                                                      const gchar* object_path,
                                                                      const gchar* interface_name,
                                                                      const gchar* property_name,
                                                                      GVariant* value,
                                                                      GError** error,
                                                                      gpointer user_data);
static void _dbus_wingpanel_interface_dbus_server_state_changed (GObject* _sender,
                                                          BackgroundState state,
                                                          guint animation_duration,
                                                          gpointer* _data);
static void _wingpanel_interface_dbus_server_unregister_object (gpointer user_data);

static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_initialize_panel_height = {-1, "panel_height", "i", NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_initialize_in[] = {&_wingpanel_interface_dbus_server_dbus_arg_info_initialize_panel_height, NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_initialize_out[] = {NULL};
static const GDBusMethodInfo _wingpanel_interface_dbus_server_dbus_method_info_initialize = {-1, "Initialize", (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_initialize_in), (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_initialize_out), NULL};
static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_x = {-1, "x", "i", NULL};
static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_y = {-1, "y", "i", NULL};
static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_result = {-1, "result", "b", NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_in[] = {&_wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_x, &_wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_y, NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_out[] = {&_wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_result, NULL};
static const GDBusMethodInfo _wingpanel_interface_dbus_server_dbus_method_info_begin_grab_focused_window = {-1, "BeginGrabFocusedWindow", (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_in), (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_begin_grab_focused_window_out), NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_remember_focused_window_in[] = {NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_remember_focused_window_out[] = {NULL};
static const GDBusMethodInfo _wingpanel_interface_dbus_server_dbus_method_info_remember_focused_window = {-1, "RememberFocusedWindow", (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_remember_focused_window_in), (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_remember_focused_window_out), NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_restore_focused_window_in[] = {NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_restore_focused_window_out[] = {NULL};
static const GDBusMethodInfo _wingpanel_interface_dbus_server_dbus_method_info_restore_focused_window = {-1, "RestoreFocusedWindow", (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_restore_focused_window_in), (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_restore_focused_window_out), NULL};
static const GDBusMethodInfo * const _wingpanel_interface_dbus_server_dbus_method_info[] = {&_wingpanel_interface_dbus_server_dbus_method_info_initialize, &_wingpanel_interface_dbus_server_dbus_method_info_begin_grab_focused_window, &_wingpanel_interface_dbus_server_dbus_method_info_remember_focused_window, &_wingpanel_interface_dbus_server_dbus_method_info_restore_focused_window, NULL};
static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_state_changed_state = {-1, "state", "i", NULL};
static const GDBusArgInfo _wingpanel_interface_dbus_server_dbus_arg_info_state_changed_animation_duration = {-1, "animation_duration", "u", NULL};
static const GDBusArgInfo * const _wingpanel_interface_dbus_server_dbus_arg_info_state_changed[] = {&_wingpanel_interface_dbus_server_dbus_arg_info_state_changed_state, &_wingpanel_interface_dbus_server_dbus_arg_info_state_changed_animation_duration, NULL};
static const GDBusSignalInfo _wingpanel_interface_dbus_server_dbus_signal_info_state_changed = {-1, "StateChanged", (GDBusArgInfo **) (&_wingpanel_interface_dbus_server_dbus_arg_info_state_changed), NULL};
static const GDBusSignalInfo * const _wingpanel_interface_dbus_server_dbus_signal_info[] = {&_wingpanel_interface_dbus_server_dbus_signal_info_state_changed, NULL};
static const GDBusPropertyInfo * const _wingpanel_interface_dbus_server_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _wingpanel_interface_dbus_server_dbus_interface_info = {-1, "org.pantheon.gala.WingpanelInterface", (GDBusMethodInfo **) (&_wingpanel_interface_dbus_server_dbus_method_info), (GDBusSignalInfo **) (&_wingpanel_interface_dbus_server_dbus_signal_info), (GDBusPropertyInfo **) (&_wingpanel_interface_dbus_server_dbus_property_info), NULL};
static const GDBusInterfaceVTable _wingpanel_interface_dbus_server_dbus_interface_vtable = {wingpanel_interface_dbus_server_dbus_interface_method_call, wingpanel_interface_dbus_server_dbus_interface_get_property, wingpanel_interface_dbus_server_dbus_interface_set_property};

static inline gpointer
wingpanel_interface_dbus_server_get_instance_private (WingpanelInterfaceDBusServer* self)
{
	return G_STRUCT_MEMBER_P (self, WingpanelInterfaceDBusServer_private_offset);
}

static void
__lambda20_ (WingpanelInterfaceDBusServer* self,
             BackgroundState state,
             guint animation_duration)
{
	g_signal_emit (self, wingpanel_interface_dbus_server_signals[WINGPANEL_INTERFACE_DBUS_SERVER_STATE_CHANGED_SIGNAL], 0, state, animation_duration);
}

static void
___lambda20__wingpanel_interface_background_manager_state_changed (WingpanelInterfaceBackgroundManager* _sender,
                                                                   BackgroundState state,
                                                                   guint animation_duration,
                                                                   gpointer self)
{
	__lambda20_ ((WingpanelInterfaceDBusServer*) self, state, animation_duration);
}

void
wingpanel_interface_dbus_server_initialize (WingpanelInterfaceDBusServer* self,
                                            gint panel_height,
                                            GError** error)
{
	WingpanelInterfaceBackgroundManager* _tmp0_;
	WingpanelInterfaceBackgroundManager* _tmp1_;
	WingpanelInterfaceFocusManager* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = wingpanel_interface_background_manager_new (panel_height);
	_g_object_unref0 (self->priv->background_manager);
	self->priv->background_manager = _tmp0_;
	_tmp1_ = self->priv->background_manager;
	g_signal_connect_object (_tmp1_, "state-changed", (GCallback) ___lambda20__wingpanel_interface_background_manager_state_changed, self, 0);
	_tmp2_ = wingpanel_interface_focus_manager_new ();
	_g_object_unref0 (self->priv->focus_manager);
	self->priv->focus_manager = _tmp2_;
}

gboolean
wingpanel_interface_dbus_server_begin_grab_focused_window (WingpanelInterfaceDBusServer* self,
                                                           gint x,
                                                           gint y,
                                                           GError** error)
{
	WingpanelInterfaceFocusManager* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->focus_manager;
	result = wingpanel_interface_focus_manager_begin_grab_focused_window (_tmp0_, x, y);
	return result;
}

void
wingpanel_interface_dbus_server_remember_focused_window (WingpanelInterfaceDBusServer* self,
                                                         GError** error)
{
	WingpanelInterfaceFocusManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->focus_manager;
	wingpanel_interface_focus_manager_remember_focused_window (_tmp0_);
}

void
wingpanel_interface_dbus_server_restore_focused_window (WingpanelInterfaceDBusServer* self,
                                                        GError** error)
{
	WingpanelInterfaceFocusManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->focus_manager;
	wingpanel_interface_focus_manager_restore_focused_window (_tmp0_);
}

WingpanelInterfaceDBusServer*
wingpanel_interface_dbus_server_construct (GType object_type)
{
	WingpanelInterfaceDBusServer * self = NULL;
	self = (WingpanelInterfaceDBusServer*) g_object_new (object_type, NULL);
	return self;
}

WingpanelInterfaceDBusServer*
wingpanel_interface_dbus_server_new (void)
{
	return wingpanel_interface_dbus_server_construct (WINGPANEL_INTERFACE_TYPE_DBUS_SERVER);
}

static void
g_cclosure_user_marshal_VOID__ENUM_UINT (GClosure * closure,
                                         GValue * return_value,
                                         guint n_param_values,
                                         const GValue * param_values,
                                         gpointer invocation_hint,
                                         gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__ENUM_UINT) (gpointer data1, gint arg_1, guint arg_2, gpointer data2);
	register GMarshalFunc_VOID__ENUM_UINT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__ENUM_UINT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_enum (param_values + 1), g_value_get_uint (param_values + 2), data2);
}

static void
wingpanel_interface_dbus_server_class_init (WingpanelInterfaceDBusServerClass * klass,
                                            gpointer klass_data)
{
	wingpanel_interface_dbus_server_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &WingpanelInterfaceDBusServer_private_offset);
	G_OBJECT_CLASS (klass)->finalize = wingpanel_interface_dbus_server_finalize;
	wingpanel_interface_dbus_server_signals[WINGPANEL_INTERFACE_DBUS_SERVER_STATE_CHANGED_SIGNAL] = g_signal_new ("state-changed", WINGPANEL_INTERFACE_TYPE_DBUS_SERVER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__ENUM_UINT, G_TYPE_NONE, 2, TYPE_BACKGROUND_STATE, G_TYPE_UINT);
}

static void
wingpanel_interface_dbus_server_instance_init (WingpanelInterfaceDBusServer * self,
                                               gpointer klass)
{
	self->priv = wingpanel_interface_dbus_server_get_instance_private (self);
}

static void
wingpanel_interface_dbus_server_finalize (GObject * obj)
{
	WingpanelInterfaceDBusServer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, WINGPANEL_INTERFACE_TYPE_DBUS_SERVER, WingpanelInterfaceDBusServer);
	_g_object_unref0 (self->priv->background_manager);
	_g_object_unref0 (self->priv->focus_manager);
	G_OBJECT_CLASS (wingpanel_interface_dbus_server_parent_class)->finalize (obj);
}

static GType
wingpanel_interface_dbus_server_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (WingpanelInterfaceDBusServerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) wingpanel_interface_dbus_server_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (WingpanelInterfaceDBusServer), 0, (GInstanceInitFunc) wingpanel_interface_dbus_server_instance_init, NULL };
	GType wingpanel_interface_dbus_server_type_id;
	wingpanel_interface_dbus_server_type_id = g_type_register_static (G_TYPE_OBJECT, "WingpanelInterfaceDBusServer", &g_define_type_info, 0);
	g_type_set_qdata (wingpanel_interface_dbus_server_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) wingpanel_interface_dbus_server_register_object);
	WingpanelInterfaceDBusServer_private_offset = g_type_add_instance_private (wingpanel_interface_dbus_server_type_id, sizeof (WingpanelInterfaceDBusServerPrivate));
	return wingpanel_interface_dbus_server_type_id;
}

GType
wingpanel_interface_dbus_server_get_type (void)
{
	static volatile gsize wingpanel_interface_dbus_server_type_id__once = 0;
	if (g_once_init_enter (&wingpanel_interface_dbus_server_type_id__once)) {
		GType wingpanel_interface_dbus_server_type_id;
		wingpanel_interface_dbus_server_type_id = wingpanel_interface_dbus_server_get_type_once ();
		g_once_init_leave (&wingpanel_interface_dbus_server_type_id__once, wingpanel_interface_dbus_server_type_id);
	}
	return wingpanel_interface_dbus_server_type_id__once;
}

static void
_dbus_wingpanel_interface_dbus_server_initialize (WingpanelInterfaceDBusServer* self,
                                                  GVariant* _parameters_,
                                                  GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint panel_height = 0;
	GVariant* _tmp0_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	panel_height = g_variant_get_int32 (_tmp0_);
	g_variant_unref (_tmp0_);
	wingpanel_interface_dbus_server_initialize (self, panel_height, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}

static void
_dbus_wingpanel_interface_dbus_server_begin_grab_focused_window (WingpanelInterfaceDBusServer* self,
                                                                 GVariant* _parameters_,
                                                                 GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gint x = 0;
	GVariant* _tmp1_;
	gint y = 0;
	GVariant* _tmp2_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gboolean result;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	x = g_variant_get_int32 (_tmp1_);
	g_variant_unref (_tmp1_);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	y = g_variant_get_int32 (_tmp2_);
	g_variant_unref (_tmp2_);
	result = wingpanel_interface_dbus_server_begin_grab_focused_window (self, x, y, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_reply_builder, g_variant_new_boolean (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);
}

static void
_dbus_wingpanel_interface_dbus_server_remember_focused_window (WingpanelInterfaceDBusServer* self,
                                                               GVariant* _parameters_,
                                                               GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	wingpanel_interface_dbus_server_remember_focused_window (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}

static void
_dbus_wingpanel_interface_dbus_server_restore_focused_window (WingpanelInterfaceDBusServer* self,
                                                              GVariant* _parameters_,
                                                              GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	wingpanel_interface_dbus_server_restore_focused_window (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}

static void
wingpanel_interface_dbus_server_dbus_interface_method_call (GDBusConnection* connection,
                                                            const gchar* sender,
                                                            const gchar* object_path,
                                                            const gchar* interface_name,
                                                            const gchar* method_name,
                                                            GVariant* parameters,
                                                            GDBusMethodInvocation* invocation,
                                                            gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "Initialize") == 0) {
		_dbus_wingpanel_interface_dbus_server_initialize (object, parameters, invocation);
	} else if (strcmp (method_name, "BeginGrabFocusedWindow") == 0) {
		_dbus_wingpanel_interface_dbus_server_begin_grab_focused_window (object, parameters, invocation);
	} else if (strcmp (method_name, "RememberFocusedWindow") == 0) {
		_dbus_wingpanel_interface_dbus_server_remember_focused_window (object, parameters, invocation);
	} else if (strcmp (method_name, "RestoreFocusedWindow") == 0) {
		_dbus_wingpanel_interface_dbus_server_restore_focused_window (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
wingpanel_interface_dbus_server_dbus_interface_get_property (GDBusConnection* connection,
                                                             const gchar* sender,
                                                             const gchar* object_path,
                                                             const gchar* interface_name,
                                                             const gchar* property_name,
                                                             GError** error,
                                                             gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}

static gboolean
wingpanel_interface_dbus_server_dbus_interface_set_property (GDBusConnection* connection,
                                                             const gchar* sender,
                                                             const gchar* object_path,
                                                             const gchar* interface_name,
                                                             const gchar* property_name,
                                                             GVariant* value,
                                                             GError** error,
                                                             gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

static void
_dbus_wingpanel_interface_dbus_server_state_changed (GObject* _sender,
                                                     BackgroundState state,
                                                     guint animation_duration,
                                                     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_int32 (state));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (animation_duration));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.pantheon.gala.WingpanelInterface", "StateChanged", _arguments, NULL);
}

guint
wingpanel_interface_dbus_server_register_object (gpointer object,
                                                 GDBusConnection* connection,
                                                 const gchar* path,
                                                 GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_wingpanel_interface_dbus_server_dbus_interface_info), &_wingpanel_interface_dbus_server_dbus_interface_vtable, data, _wingpanel_interface_dbus_server_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "state-changed", (GCallback) _dbus_wingpanel_interface_dbus_server_state_changed, data);
	return result;
}

static void
_wingpanel_interface_dbus_server_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_wingpanel_interface_dbus_server_state_changed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

