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

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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
#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 TYPE_DESKTOP_INTEGRATION (desktop_integration_get_type ())
#define DESKTOP_INTEGRATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DESKTOP_INTEGRATION, DesktopIntegration))
#define IS_DESKTOP_INTEGRATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DESKTOP_INTEGRATION))
#define DESKTOP_INTEGRATION_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_DESKTOP_INTEGRATION, DesktopIntegrationIface))

typedef struct _DesktopIntegration DesktopIntegration;
typedef struct _DesktopIntegrationIface DesktopIntegrationIface;

#define TYPE_DESKTOP_INTEGRATION_PROXY (desktop_integration_proxy_get_type ())

#define DESKTOP_INTEGRATION_TYPE_RUNNING_APPLICATION (desktop_integration_running_application_get_type ())
typedef struct _DesktopIntegrationRunningApplication DesktopIntegrationRunningApplication;

#define DESKTOP_INTEGRATION_TYPE_WINDOW (desktop_integration_window_get_type ())
typedef struct _DesktopIntegrationWindow DesktopIntegrationWindow;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef GDBusProxy DesktopIntegrationProxy;
typedef GDBusProxyClass DesktopIntegrationProxyClass;

struct _DesktopIntegrationRunningApplication {
	gchar* app_id;
	GHashTable* details;
};

struct _DesktopIntegrationWindow {
	guint64 uid;
	GHashTable* properties;
};

struct _DesktopIntegrationIface {
	GTypeInterface parent_iface;
	DesktopIntegrationRunningApplication* (*get_running_applications) (DesktopIntegration* self, gint* result_length1, GError** error);
	DesktopIntegrationWindow* (*get_windows) (DesktopIntegration* self, gint* result_length1, GError** error);
	void (*focus_window) (DesktopIntegration* self, guint64 uid, GError** error);
};

VALA_EXTERN GType desktop_integration_proxy_get_type (void) G_GNUC_CONST ;
VALA_EXTERN guint desktop_integration_register_object (void* object,
                                           GDBusConnection* connection,
                                           const gchar* path,
                                           GError** error);
VALA_EXTERN GType desktop_integration_running_application_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DesktopIntegrationRunningApplication* desktop_integration_running_application_dup (const DesktopIntegrationRunningApplication* self);
VALA_EXTERN void desktop_integration_running_application_free (DesktopIntegrationRunningApplication* self);
VALA_EXTERN void desktop_integration_running_application_copy (const DesktopIntegrationRunningApplication* self,
                                                   DesktopIntegrationRunningApplication* dest);
VALA_EXTERN void desktop_integration_running_application_destroy (DesktopIntegrationRunningApplication* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (DesktopIntegrationRunningApplication, desktop_integration_running_application_destroy)
VALA_EXTERN GType desktop_integration_window_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DesktopIntegrationWindow* desktop_integration_window_dup (const DesktopIntegrationWindow* self);
VALA_EXTERN void desktop_integration_window_free (DesktopIntegrationWindow* self);
VALA_EXTERN void desktop_integration_window_copy (const DesktopIntegrationWindow* self,
                                      DesktopIntegrationWindow* dest);
VALA_EXTERN void desktop_integration_window_destroy (DesktopIntegrationWindow* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (DesktopIntegrationWindow, desktop_integration_window_destroy)
VALA_EXTERN GType desktop_integration_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DesktopIntegration, g_object_unref)
VALA_EXTERN DesktopIntegrationRunningApplication* desktop_integration_get_running_applications (DesktopIntegration* self,
                                                                                    gint* result_length1,
                                                                                    GError** error);
VALA_EXTERN DesktopIntegrationWindow* desktop_integration_get_windows (DesktopIntegration* self,
                                                           gint* result_length1,
                                                           GError** error);
VALA_EXTERN void desktop_integration_focus_window (DesktopIntegration* self,
                                       guint64 uid,
                                       GError** error);
static GType desktop_integration_get_type_once (void);
static void desktop_integration_proxy_g_signal (GDBusProxy* proxy,
                                         const gchar* sender_name,
                                         const gchar* signal_name,
                                         GVariant* parameters);
static DesktopIntegrationRunningApplication* desktop_integration_proxy_get_running_applications (DesktopIntegration* self,
                                                                                          gint* result_length1,
                                                                                          GError** error);
static DesktopIntegrationWindow* desktop_integration_proxy_get_windows (DesktopIntegration* self,
                                                                 gint* result_length1,
                                                                 GError** error);
static void desktop_integration_proxy_focus_window (DesktopIntegration* self,
                                             guint64 uid,
                                             GError** error);
static void desktop_integration_proxy_desktop_integration_interface_init (DesktopIntegrationIface* iface);
static void _vala_DesktopIntegrationRunningApplication_array_free (DesktopIntegrationRunningApplication * array,
                                                            gssize array_length);
static void _dbus_desktop_integration_get_running_applications (DesktopIntegration* self,
                                                         GVariant* _parameters_,
                                                         GDBusMethodInvocation* invocation);
static void _vala_DesktopIntegrationWindow_array_free (DesktopIntegrationWindow * array,
                                                gssize array_length);
static void _dbus_desktop_integration_get_windows (DesktopIntegration* self,
                                            GVariant* _parameters_,
                                            GDBusMethodInvocation* invocation);
static void _dbus_desktop_integration_focus_window (DesktopIntegration* self,
                                             GVariant* _parameters_,
                                             GDBusMethodInvocation* invocation);
static void desktop_integration_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* desktop_integration_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 desktop_integration_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 _desktop_integration_unregister_object (gpointer user_data);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo _desktop_integration_dbus_arg_info_get_running_applications_result = {-1, "result", "a(sa{sv})", NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_get_running_applications_in[] = {NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_get_running_applications_out[] = {&_desktop_integration_dbus_arg_info_get_running_applications_result, NULL};
static const GDBusMethodInfo _desktop_integration_dbus_method_info_get_running_applications = {-1, "GetRunningApplications", (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_get_running_applications_in), (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_get_running_applications_out), NULL};
static const GDBusArgInfo _desktop_integration_dbus_arg_info_get_windows_result = {-1, "result", "a(ta{sv})", NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_get_windows_in[] = {NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_get_windows_out[] = {&_desktop_integration_dbus_arg_info_get_windows_result, NULL};
static const GDBusMethodInfo _desktop_integration_dbus_method_info_get_windows = {-1, "GetWindows", (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_get_windows_in), (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_get_windows_out), NULL};
static const GDBusArgInfo _desktop_integration_dbus_arg_info_focus_window_uid = {-1, "uid", "t", NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_focus_window_in[] = {&_desktop_integration_dbus_arg_info_focus_window_uid, NULL};
static const GDBusArgInfo * const _desktop_integration_dbus_arg_info_focus_window_out[] = {NULL};
static const GDBusMethodInfo _desktop_integration_dbus_method_info_focus_window = {-1, "FocusWindow", (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_focus_window_in), (GDBusArgInfo **) (&_desktop_integration_dbus_arg_info_focus_window_out), NULL};
static const GDBusMethodInfo * const _desktop_integration_dbus_method_info[] = {&_desktop_integration_dbus_method_info_get_running_applications, &_desktop_integration_dbus_method_info_get_windows, &_desktop_integration_dbus_method_info_focus_window, NULL};
static const GDBusSignalInfo * const _desktop_integration_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _desktop_integration_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _desktop_integration_dbus_interface_info = {-1, "org.pantheon.gala.DesktopIntegration", (GDBusMethodInfo **) (&_desktop_integration_dbus_method_info), (GDBusSignalInfo **) (&_desktop_integration_dbus_signal_info), (GDBusPropertyInfo **) (&_desktop_integration_dbus_property_info), NULL};
static const GDBusInterfaceVTable _desktop_integration_dbus_interface_vtable = {desktop_integration_dbus_interface_method_call, desktop_integration_dbus_interface_get_property, desktop_integration_dbus_interface_set_property};

DesktopIntegrationRunningApplication*
desktop_integration_get_running_applications (DesktopIntegration* self,
                                              gint* result_length1,
                                              GError** error)
{
	DesktopIntegrationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = DESKTOP_INTEGRATION_GET_INTERFACE (self);
	if (_iface_->get_running_applications) {
		return _iface_->get_running_applications (self, result_length1, error);
	}
	return NULL;
}

DesktopIntegrationWindow*
desktop_integration_get_windows (DesktopIntegration* self,
                                 gint* result_length1,
                                 GError** error)
{
	DesktopIntegrationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = DESKTOP_INTEGRATION_GET_INTERFACE (self);
	if (_iface_->get_windows) {
		return _iface_->get_windows (self, result_length1, error);
	}
	return NULL;
}

void
desktop_integration_focus_window (DesktopIntegration* self,
                                  guint64 uid,
                                  GError** error)
{
	DesktopIntegrationIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = DESKTOP_INTEGRATION_GET_INTERFACE (self);
	if (_iface_->focus_window) {
		_iface_->focus_window (self, uid, error);
	}
}

static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

void
desktop_integration_running_application_copy (const DesktopIntegrationRunningApplication* self,
                                              DesktopIntegrationRunningApplication* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	_tmp0_ = (*self).app_id;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).app_id);
	(*dest).app_id = _tmp1_;
	_tmp2_ = (*self).details;
	_tmp3_ = _g_hash_table_ref0 (_tmp2_);
	_g_hash_table_unref0 ((*dest).details);
	(*dest).details = _tmp3_;
}

void
desktop_integration_running_application_destroy (DesktopIntegrationRunningApplication* self)
{
	_g_free0 ((*self).app_id);
	_g_hash_table_unref0 ((*self).details);
}

DesktopIntegrationRunningApplication*
desktop_integration_running_application_dup (const DesktopIntegrationRunningApplication* self)
{
	DesktopIntegrationRunningApplication* dup;
	dup = g_new0 (DesktopIntegrationRunningApplication, 1);
	desktop_integration_running_application_copy (self, dup);
	return dup;
}

void
desktop_integration_running_application_free (DesktopIntegrationRunningApplication* self)
{
	desktop_integration_running_application_destroy (self);
	g_free (self);
}

static GType
desktop_integration_running_application_get_type_once (void)
{
	GType desktop_integration_running_application_type_id;
	desktop_integration_running_application_type_id = g_boxed_type_register_static ("DesktopIntegrationRunningApplication", (GBoxedCopyFunc) desktop_integration_running_application_dup, (GBoxedFreeFunc) desktop_integration_running_application_free);
	return desktop_integration_running_application_type_id;
}

GType
desktop_integration_running_application_get_type (void)
{
	static volatile gsize desktop_integration_running_application_type_id__once = 0;
	if (g_once_init_enter (&desktop_integration_running_application_type_id__once)) {
		GType desktop_integration_running_application_type_id;
		desktop_integration_running_application_type_id = desktop_integration_running_application_get_type_once ();
		g_once_init_leave (&desktop_integration_running_application_type_id__once, desktop_integration_running_application_type_id);
	}
	return desktop_integration_running_application_type_id__once;
}

void
desktop_integration_window_copy (const DesktopIntegrationWindow* self,
                                 DesktopIntegrationWindow* dest)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	(*dest).uid = (*self).uid;
	_tmp0_ = (*self).properties;
	_tmp1_ = _g_hash_table_ref0 (_tmp0_);
	_g_hash_table_unref0 ((*dest).properties);
	(*dest).properties = _tmp1_;
}

void
desktop_integration_window_destroy (DesktopIntegrationWindow* self)
{
	_g_hash_table_unref0 ((*self).properties);
}

DesktopIntegrationWindow*
desktop_integration_window_dup (const DesktopIntegrationWindow* self)
{
	DesktopIntegrationWindow* dup;
	dup = g_new0 (DesktopIntegrationWindow, 1);
	desktop_integration_window_copy (self, dup);
	return dup;
}

void
desktop_integration_window_free (DesktopIntegrationWindow* self)
{
	desktop_integration_window_destroy (self);
	g_free (self);
}

static GType
desktop_integration_window_get_type_once (void)
{
	GType desktop_integration_window_type_id;
	desktop_integration_window_type_id = g_boxed_type_register_static ("DesktopIntegrationWindow", (GBoxedCopyFunc) desktop_integration_window_dup, (GBoxedFreeFunc) desktop_integration_window_free);
	return desktop_integration_window_type_id;
}

GType
desktop_integration_window_get_type (void)
{
	static volatile gsize desktop_integration_window_type_id__once = 0;
	if (g_once_init_enter (&desktop_integration_window_type_id__once)) {
		GType desktop_integration_window_type_id;
		desktop_integration_window_type_id = desktop_integration_window_get_type_once ();
		g_once_init_leave (&desktop_integration_window_type_id__once, desktop_integration_window_type_id);
	}
	return desktop_integration_window_type_id__once;
}

static void
desktop_integration_default_init (DesktopIntegrationIface * iface,
                                  gpointer iface_data)
{
}

static GType
desktop_integration_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DesktopIntegrationIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) desktop_integration_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType desktop_integration_type_id;
	desktop_integration_type_id = g_type_register_static (G_TYPE_INTERFACE, "DesktopIntegration", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (desktop_integration_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (desktop_integration_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) desktop_integration_proxy_get_type);
	g_type_set_qdata (desktop_integration_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.pantheon.gala.DesktopIntegration");
	g_type_set_qdata (desktop_integration_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_desktop_integration_dbus_interface_info));
	g_type_set_qdata (desktop_integration_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) desktop_integration_register_object);
	return desktop_integration_type_id;
}

GType
desktop_integration_get_type (void)
{
	static volatile gsize desktop_integration_type_id__once = 0;
	if (g_once_init_enter (&desktop_integration_type_id__once)) {
		GType desktop_integration_type_id;
		desktop_integration_type_id = desktop_integration_get_type_once ();
		g_once_init_leave (&desktop_integration_type_id__once, desktop_integration_type_id);
	}
	return desktop_integration_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (DesktopIntegrationProxy, desktop_integration_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_DESKTOP_INTEGRATION, desktop_integration_proxy_desktop_integration_interface_init) )
static void
desktop_integration_proxy_class_init (DesktopIntegrationProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = desktop_integration_proxy_g_signal;
}

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

static void
desktop_integration_proxy_init (DesktopIntegrationProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_desktop_integration_dbus_interface_info));
}

static DesktopIntegrationRunningApplication*
desktop_integration_proxy_get_running_applications (DesktopIntegration* self,
                                                    gint* result_length1,
                                                    GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	DesktopIntegrationRunningApplication* _result = NULL;
	gint _result_length1;
	GVariant* _tmp109_;
	DesktopIntegrationRunningApplication* _tmp110_;
	gint _tmp110__length;
	gint _tmp110__size;
	gint _tmp110__length1;
	GVariantIter _tmp111_;
	GVariant* _tmp112_;
	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.pantheon.gala.DesktopIntegration", "GetRunningApplications");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_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 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);
	_result_length1 = 0;
	_tmp109_ = g_variant_iter_next_value (&_reply_iter);
	_tmp110_ = g_new (DesktopIntegrationRunningApplication, 5);
	_tmp110__length = 0;
	_tmp110__size = 4;
	_tmp110__length1 = 0;
	g_variant_iter_init (&_tmp111_, _tmp109_);
	for (; (_tmp112_ = g_variant_iter_next_value (&_tmp111_)) != NULL; _tmp110__length1++) {
		DesktopIntegrationRunningApplication _tmp113_;
		GVariantIter _tmp114_;
		GVariant* _tmp115_;
		GVariant* _tmp116_;
		GHashTable* _tmp117_;
		GVariantIter _tmp118_;
		GVariant* _tmp119_;
		GVariant* _tmp120_;
		if (_tmp110__size == _tmp110__length) {
			_tmp110__size = 2 * _tmp110__size;
			_tmp110_ = g_renew (DesktopIntegrationRunningApplication, _tmp110_, _tmp110__size + 1);
		}
		g_variant_iter_init (&_tmp114_, _tmp112_);
		_tmp115_ = g_variant_iter_next_value (&_tmp114_);
		_tmp113_.app_id = g_variant_dup_string (_tmp115_, NULL);
		g_variant_unref (_tmp115_);
		_tmp116_ = g_variant_iter_next_value (&_tmp114_);
		_tmp117_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
		g_variant_iter_init (&_tmp118_, _tmp116_);
		while (g_variant_iter_loop (&_tmp118_, "{?*}", &_tmp119_, &_tmp120_)) {
			g_hash_table_insert (_tmp117_, g_variant_dup_string (_tmp119_, NULL), g_variant_get_variant (_tmp120_));
		}
		_tmp113_.details = _tmp117_;
		g_variant_unref (_tmp116_);
		_tmp110_[_tmp110__length++] = _tmp113_;
		g_variant_unref (_tmp112_);
	}
	_result_length1 = _tmp110__length1;
	_result = _tmp110_;
	g_variant_unref (_tmp109_);
	*result_length1 = _result_length1;
	g_object_unref (_reply_message);
	return _result;
}

static DesktopIntegrationWindow*
desktop_integration_proxy_get_windows (DesktopIntegration* self,
                                       gint* result_length1,
                                       GError** error)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	DesktopIntegrationWindow* _result = NULL;
	gint _result_length1;
	GVariant* _tmp121_;
	DesktopIntegrationWindow* _tmp122_;
	gint _tmp122__length;
	gint _tmp122__size;
	gint _tmp122__length1;
	GVariantIter _tmp123_;
	GVariant* _tmp124_;
	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.pantheon.gala.DesktopIntegration", "GetWindows");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_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 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);
	_result_length1 = 0;
	_tmp121_ = g_variant_iter_next_value (&_reply_iter);
	_tmp122_ = g_new (DesktopIntegrationWindow, 5);
	_tmp122__length = 0;
	_tmp122__size = 4;
	_tmp122__length1 = 0;
	g_variant_iter_init (&_tmp123_, _tmp121_);
	for (; (_tmp124_ = g_variant_iter_next_value (&_tmp123_)) != NULL; _tmp122__length1++) {
		DesktopIntegrationWindow _tmp125_;
		GVariantIter _tmp126_;
		GVariant* _tmp127_;
		GVariant* _tmp128_;
		GHashTable* _tmp129_;
		GVariantIter _tmp130_;
		GVariant* _tmp131_;
		GVariant* _tmp132_;
		if (_tmp122__size == _tmp122__length) {
			_tmp122__size = 2 * _tmp122__size;
			_tmp122_ = g_renew (DesktopIntegrationWindow, _tmp122_, _tmp122__size + 1);
		}
		g_variant_iter_init (&_tmp126_, _tmp124_);
		_tmp127_ = g_variant_iter_next_value (&_tmp126_);
		_tmp125_.uid = g_variant_get_uint64 (_tmp127_);
		g_variant_unref (_tmp127_);
		_tmp128_ = g_variant_iter_next_value (&_tmp126_);
		_tmp129_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
		g_variant_iter_init (&_tmp130_, _tmp128_);
		while (g_variant_iter_loop (&_tmp130_, "{?*}", &_tmp131_, &_tmp132_)) {
			g_hash_table_insert (_tmp129_, g_variant_dup_string (_tmp131_, NULL), g_variant_get_variant (_tmp132_));
		}
		_tmp125_.properties = _tmp129_;
		g_variant_unref (_tmp128_);
		_tmp122_[_tmp122__length++] = _tmp125_;
		g_variant_unref (_tmp124_);
	}
	_result_length1 = _tmp122__length1;
	_result = _tmp122_;
	g_variant_unref (_tmp121_);
	*result_length1 = _result_length1;
	g_object_unref (_reply_message);
	return _result;
}

static void
desktop_integration_proxy_focus_window (DesktopIntegration* self,
                                        guint64 uid,
                                        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.pantheon.gala.DesktopIntegration", "FocusWindow");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint64 (uid));
	_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
desktop_integration_proxy_desktop_integration_interface_init (DesktopIntegrationIface* iface)
{
	iface->get_running_applications = desktop_integration_proxy_get_running_applications;
	iface->get_windows = desktop_integration_proxy_get_windows;
	iface->focus_window = desktop_integration_proxy_focus_window;
}

static void
_vala_DesktopIntegrationRunningApplication_array_free (DesktopIntegrationRunningApplication * array,
                                                       gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			desktop_integration_running_application_destroy (&array[i]);
		}
	}
	g_free (array);
}

static void
_dbus_desktop_integration_get_running_applications (DesktopIntegration* self,
                                                    GVariant* _parameters_,
                                                    GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	DesktopIntegrationRunningApplication* result;
	gint result_length1 = 0;
	DesktopIntegrationRunningApplication* _tmp133_;
	GVariantBuilder _tmp134_;
	gint _tmp135_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = desktop_integration_get_running_applications (self, &result_length1, &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);
	_tmp133_ = result;
	g_variant_builder_init (&_tmp134_, G_VARIANT_TYPE ("a(sa{sv})"));
	for (_tmp135_ = 0; _tmp135_ < result_length1; _tmp135_++) {
		GVariantBuilder _tmp136_;
		GVariantBuilder _tmp137_;
		GHashTableIter _tmp138_;
		gpointer _tmp139_;
		gpointer _tmp140_;
		g_variant_builder_init (&_tmp136_, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_tmp136_, g_variant_new_string ((*_tmp133_).app_id));
		g_hash_table_iter_init (&_tmp138_, (*_tmp133_).details);
		g_variant_builder_init (&_tmp137_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp138_, &_tmp139_, &_tmp140_)) {
			const gchar* _key;
			GVariant* _value;
			_key = (const gchar*) _tmp139_;
			_value = (GVariant*) _tmp140_;
			g_variant_builder_add (&_tmp137_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp136_, g_variant_builder_end (&_tmp137_));
		g_variant_builder_add_value (&_tmp134_, g_variant_builder_end (&_tmp136_));
		_tmp133_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp134_));
	result = (_vala_DesktopIntegrationRunningApplication_array_free (result, result_length1), NULL);
	_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
_vala_DesktopIntegrationWindow_array_free (DesktopIntegrationWindow * array,
                                           gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			desktop_integration_window_destroy (&array[i]);
		}
	}
	g_free (array);
}

static void
_dbus_desktop_integration_get_windows (DesktopIntegration* self,
                                       GVariant* _parameters_,
                                       GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	DesktopIntegrationWindow* result;
	gint result_length1 = 0;
	DesktopIntegrationWindow* _tmp141_;
	GVariantBuilder _tmp142_;
	gint _tmp143_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	result = desktop_integration_get_windows (self, &result_length1, &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);
	_tmp141_ = result;
	g_variant_builder_init (&_tmp142_, G_VARIANT_TYPE ("a(ta{sv})"));
	for (_tmp143_ = 0; _tmp143_ < result_length1; _tmp143_++) {
		GVariantBuilder _tmp144_;
		GVariantBuilder _tmp145_;
		GHashTableIter _tmp146_;
		gpointer _tmp147_;
		gpointer _tmp148_;
		g_variant_builder_init (&_tmp144_, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_tmp144_, g_variant_new_uint64 ((*_tmp141_).uid));
		g_hash_table_iter_init (&_tmp146_, (*_tmp141_).properties);
		g_variant_builder_init (&_tmp145_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp146_, &_tmp147_, &_tmp148_)) {
			const gchar* _key;
			GVariant* _value;
			_key = (const gchar*) _tmp147_;
			_value = (GVariant*) _tmp148_;
			g_variant_builder_add (&_tmp145_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp144_, g_variant_builder_end (&_tmp145_));
		g_variant_builder_add_value (&_tmp142_, g_variant_builder_end (&_tmp144_));
		_tmp141_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp142_));
	result = (_vala_DesktopIntegrationWindow_array_free (result, result_length1), NULL);
	_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_desktop_integration_focus_window (DesktopIntegration* self,
                                        GVariant* _parameters_,
                                        GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	guint64 uid = 0ULL;
	GVariant* _tmp149_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp149_ = g_variant_iter_next_value (&_arguments_iter);
	uid = g_variant_get_uint64 (_tmp149_);
	g_variant_unref (_tmp149_);
	desktop_integration_focus_window (self, uid, &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
desktop_integration_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, "GetRunningApplications") == 0) {
		_dbus_desktop_integration_get_running_applications (object, parameters, invocation);
	} else if (strcmp (method_name, "GetWindows") == 0) {
		_dbus_desktop_integration_get_windows (object, parameters, invocation);
	} else if (strcmp (method_name, "FocusWindow") == 0) {
		_dbus_desktop_integration_focus_window (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
desktop_integration_dbus_interface_get_property (GDBusConnection* connection,
                                                 const gchar* sender,
                                                 const gchar* object_path,
                                                 const gchar* interface_name,
                                                 const gchar* property_name,
                                                 GError** error,
                                                 gpointer user_data)
{
	return NULL;
}

static gboolean
desktop_integration_dbus_interface_set_property (GDBusConnection* connection,
                                                 const gchar* sender,
                                                 const gchar* object_path,
                                                 const gchar* interface_name,
                                                 const gchar* property_name,
                                                 GVariant* value,
                                                 GError** error,
                                                 gpointer user_data)
{
	return FALSE;
}

guint
desktop_integration_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 *) (&_desktop_integration_dbus_interface_info), &_desktop_integration_dbus_interface_vtable, data, _desktop_integration_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_desktop_integration_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);
}

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

