/* global-shortcuts-provider.c generated by valac 0.56.19, the Vala compiler
 * generated from global-shortcuts-provider.vala, do not modify */

/*
 * Copyright (c) 2025-2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib.h>
#include <glib-object.h>
#include "ft_plugin_portal.h"
#include <stdlib.h>
#include <string.h>
#include "ft_core.h"
#include "ft_ui.h"
#include <gdk/gdk.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.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

#define PORTAL_TYPE_GLOBAL_SHORTCUTS_ERROR (portal_global_shortcuts_error_get_type ())
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_iter_free0(var) ((var == NULL) ? NULL : (var = (g_variant_iter_free (var), NULL)))
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
enum  {
	PORTAL_GLOBAL_SHORTCUTS_PROVIDER_0_PROPERTY,
	PORTAL_GLOBAL_SHORTCUTS_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* portal_global_shortcuts_provider_properties[PORTAL_GLOBAL_SHORTCUTS_PROVIDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block3Data Block3Data;
typedef struct _Block4Data Block4Data;
#define _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _PortalGlobalShortcutsProviderCreateSessionData PortalGlobalShortcutsProviderCreateSessionData;
typedef struct _Block5Data Block5Data;
typedef struct _PortalGlobalShortcutsProviderBindShortcutsData PortalGlobalShortcutsProviderBindShortcutsData;
typedef struct _Block6Data Block6Data;
typedef struct _PortalGlobalShortcutsProviderOpenEditDialogData PortalGlobalShortcutsProviderOpenEditDialogData;
typedef struct _PortalGlobalShortcutsProviderInitializeData PortalGlobalShortcutsProviderInitializeData;
typedef struct _PortalGlobalShortcutsProviderEnableData PortalGlobalShortcutsProviderEnableData;
typedef struct _PortalGlobalShortcutsProviderDisableData PortalGlobalShortcutsProviderDisableData;
typedef struct _PortalGlobalShortcutsProviderUninitializeData PortalGlobalShortcutsProviderUninitializeData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

typedef enum  {
	PORTAL_GLOBAL_SHORTCUTS_ERROR_REQUEST,
	PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION,
	PORTAL_GLOBAL_SHORTCUTS_ERROR_BIND_SHORTCUTS,
	PORTAL_GLOBAL_SHORTCUTS_ERROR_CONFIGURE_SHORTCUTS,
	PORTAL_GLOBAL_SHORTCUTS_ERROR_LIST_SHORTCUTS
} PortalGlobalShortcutsError;
#define PORTAL_GLOBAL_SHORTCUTS_ERROR portal_global_shortcuts_error_quark ()

struct _PortalGlobalShortcutsProviderPrivate {
	GDBusConnection* connection;
	PortalGlobalShortcuts* proxy;
	PortalShortcut* shortcuts;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	GCancellable* cancellable;
	char* session_handle;
	GHashTable* accelerators;
	guint dbus_watcher_id;
	guint bind_shortcuts_idle_id;
	gboolean is_configured;
	gboolean bound_shortcuts;
	gulong shortcuts_changed_id;
};

struct _Block3Data {
	int _ref_count_;
	GHashTable* self;
	GFunc func;
	gpointer func_target;
};

struct _Block4Data {
	int _ref_count_;
	PortalGlobalShortcutsProvider* self;
	gpointer _async_data_;
};

struct _PortalGlobalShortcutsProviderCreateSessionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	Block4Data* _data4_;
	guint timestamp;
	gchar* handle_token;
	GDBusConnection* _tmp0_;
	gchar* _tmp1_;
	PortalGlobalShortcuts* _tmp2_;
	const gchar* _tmp3_;
	GError* _tmp4_;
	GVariantDict* options;
	GVariantDict* _tmp5_;
	GVariantDict* _tmp6_;
	const gchar* _tmp7_;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	GVariantDict* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	GVariant* _tmp15_;
	GVariant* _tmp16_;
	PortalGlobalShortcuts* _tmp17_;
	GVariantDict* _tmp18_;
	GVariant* _tmp19_;
	GVariant* _tmp20_;
	char* _tmp21_;
	char* _tmp22_;
	GError* _error_;
	GError* _tmp23_;
	const gchar* _tmp24_;
	GError* _tmp25_;
	const char* _tmp26_;
	GError* _tmp27_;
	GError* _inner_error0_;
};

struct _Block5Data {
	int _ref_count_;
	PortalGlobalShortcutsProvider* self;
	GVariant* shortcuts_variant;
	gpointer _async_data_;
};

struct _PortalGlobalShortcutsProviderBindShortcutsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	Block5Data* _data5_;
	gchar* handle_token;
	PortalShortcut* _tmp0_;
	gint _tmp0__length1;
	gboolean _tmp1_;
	const char* _tmp2_;
	gchar* _tmp3_;
	GDBusConnection* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _error_;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _tmp9_;
	PortalGlobalShortcuts* _tmp10_;
	GVariantDict* options;
	GVariantDict* _tmp11_;
	GVariantDict* _tmp12_;
	const gchar* _tmp13_;
	GVariant* _tmp14_;
	GVariant* _tmp15_;
	PortalShortcut* shortcuts;
	PortalShortcut* _tmp16_;
	gint _tmp16__length1;
	gint _tmp17_;
	PortalShortcut* _tmp18_;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	PortalGlobalShortcuts* _tmp19_;
	const char* _tmp20_;
	PortalShortcut* _tmp21_;
	gint _tmp21__length1;
	GVariant* _tmp22_;
	GVariant* _tmp23_;
	GVariantDict* _tmp24_;
	GVariant* _tmp25_;
	GVariant* _tmp26_;
	char* _tmp27_;
	char* _tmp28_;
	GVariant* _tmp29_;
	GVariant* _tmp30_;
	GError* _vala1__error_;
	GError* _tmp31_;
	const gchar* _tmp32_;
	GError* _tmp33_;
	GError* _inner_error1_;
	PortalGlobalShortcuts* _tmp34_;
	GError* _inner_error0_;
};

struct _Block6Data {
	int _ref_count_;
	PortalGlobalShortcutsProvider* self;
	gpointer _async_data_;
};

struct _PortalGlobalShortcutsProviderOpenEditDialogData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	gchar* window_identifier;
	Block6Data* _data6_;
	gchar* handle_token;
	gboolean _tmp0_;
	PortalGlobalShortcuts* _tmp1_;
	PortalShortcut* _tmp2_;
	gint _tmp2__length1;
	gchar* _tmp3_;
	GDBusConnection* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _error_;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _tmp9_;
	GVariantDict* options;
	GVariantDict* _tmp10_;
	GVariantDict* _tmp11_;
	const gchar* _tmp12_;
	GVariant* _tmp13_;
	GVariant* _tmp14_;
	GVariant* options_variant;
	GVariantDict* _tmp15_;
	GVariant* _tmp16_;
	gboolean _tmp17_;
	PortalGlobalShortcuts* _tmp18_;
	guint32 _tmp19_;
	guint32 _tmp20_;
	PortalGlobalShortcuts* _tmp21_;
	gboolean has_configure_shortcuts;
	gboolean _tmp22_;
	const char* _tmp23_;
	PortalGlobalShortcuts* _tmp24_;
	const char* _tmp25_;
	GVariant* _tmp26_;
	GError* _vala1__error_;
	GError* _tmp27_;
	const gchar* _tmp28_;
	GError* _tmp29_;
	GError* _tmp30_;
	gboolean _tmp31_;
	const char* _tmp32_;
	PortalShortcut* shortcuts;
	PortalShortcut* _tmp33_;
	gint _tmp33__length1;
	gint _tmp34_;
	PortalShortcut* _tmp35_;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	PortalShortcut _tmp36_;
	PortalGlobalShortcuts* _tmp37_;
	const char* _tmp38_;
	PortalShortcut* _tmp39_;
	gint _tmp39__length1;
	GVariant* _tmp40_;
	GVariant* _tmp41_;
	GVariant* _tmp42_;
	char* _tmp43_;
	char* _tmp44_;
	GError* _vala2__error_;
	GError* _tmp45_;
	const gchar* _tmp46_;
	GError* _tmp47_;
	GError* _tmp48_;
	GError* _inner_error0_;
};

struct _PortalGlobalShortcutsProviderInitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	GCancellable* cancellable;
	PortalShortcut* _tmp0_;
};

struct _PortalGlobalShortcutsProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	GCancellable* cancellable;
	gboolean _tmp0_;
	gboolean _tmp1_;
	PortalGlobalShortcuts* _tmp2_;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	GCancellable* _tmp5_;
	GCancellable* _tmp6_;
	GCancellable* _tmp7_;
	GCancellable* _tmp8_;
	GSettings* _tmp9_;
	PortalGlobalShortcuts* _tmp10_;
	GCancellable* _tmp11_;
	PortalGlobalShortcuts* _tmp12_;
	PortalGlobalShortcuts* _tmp13_;
	PortalGlobalShortcuts* _tmp14_;
	PortalGlobalShortcuts* _tmp15_;
	gulong _tmp16_;
	PortalGlobalShortcuts* _tmp17_;
	guint32 _tmp18_;
	guint32 _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _error_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	GError* _tmp24_;
	GError* _tmp25_;
	GError* _inner_error0_;
};

struct _PortalGlobalShortcutsProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
	GCancellable* _tmp0_;
	GCancellable* _tmp1_;
	PortalGlobalShortcuts* _tmp2_;
	PortalGlobalShortcuts* _tmp3_;
	guint _tmp4_;
	PortalGlobalShortcuts* _tmp5_;
	guint _tmp6_;
};

struct _PortalGlobalShortcutsProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalGlobalShortcutsProvider* self;
};

static gint PortalGlobalShortcutsProvider_private_offset;
static gpointer portal_global_shortcuts_provider_parent_class = NULL;
static FtGlobalShortcutsProviderIface * portal_global_shortcuts_provider_ft_global_shortcuts_provider_parent_iface = NULL;
static GType portal_global_shortcuts_provider_type_id = 0;

VALA_EXTERN GQuark portal_global_shortcuts_error_quark (void);
VALA_EXTERN GType portal_global_shortcuts_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GVariant* portal_serialize_shortcut (PortalShortcut* shortcut);
VALA_EXTERN GVariant* portal_serialize_shortcuts (PortalShortcut* shortcuts,
                                      gint shortcuts_length1);
static void _vala_array_add1 (GVariant** * array,
                       gint* length,
                       gint* size,
                       GVariant* value);
VALA_EXTERN PortalShortcut* portal_deserialize_shortcuts (GVariant* shortcuts_variant,
                                              gint* result_length1);
static void _vala_array_add2 (PortalShortcut* * array,
                       gint* length,
                       gint* size,
                       const PortalShortcut* value);
VALA_EXTERN gboolean portal_is_kde (void);
VALA_EXTERN gchar* portal_parse_trigger_description (const gchar* trigger_description);
VALA_EXTERN gchar* portal_to_pascal_case (const gchar* key_name);
VALA_EXTERN gchar* portal_format_accelerator_kde (FtAccelerator* accelerator);
static void _vala_array_add3 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add4 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add5 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add6 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add7 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add8 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add9 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add10 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN gchar* portal_format_accelerator (const gchar* accelerator_string);
static void _vala_PortalShortcut_array_free (PortalShortcut * array,
                                      gssize array_length);
static void portal_global_shortcuts_provider_mark_as_configured (PortalGlobalShortcutsProvider* self);
static void portal_global_shortcuts_provider_update_accelerators (PortalGlobalShortcutsProvider* self,
                                                           GVariant* shortcuts);
static void _g_free0_ (gpointer var);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void ___lambda2__gh_func (gconstpointer key,
                          gconstpointer value,
                          gpointer self);
static void ___lambda7_ (PortalGlobalShortcutsProvider* self,
                  const gchar* shortcut_id);
static void ____lambda7__gfunc (gconstpointer data,
                         gpointer self);
static PortalShortcut* portal_global_shortcuts_provider_format_shortcuts (PortalGlobalShortcutsProvider* self,
                                                                   PortalShortcut* shortcuts,
                                                                   gint shortcuts_length1,
                                                                   gint* result_length1);
static void _vala_array_add11 (PortalShortcut* * array,
                        gint* length,
                        gint* size,
                        const PortalShortcut* value);
static void portal_global_shortcuts_provider_create_extra_shortcut (PortalGlobalShortcutsProvider* self,
                                                             PortalShortcut* result);
static gint portal_global_shortcuts_provider_find_shortcut (PortalGlobalShortcutsProvider* self,
                                                     const gchar* name);
static void portal_global_shortcuts_provider_create_session_data_free (gpointer _data);
static void portal_global_shortcuts_provider_create_session (PortalGlobalShortcutsProvider* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void portal_global_shortcuts_provider_create_session_finish (PortalGlobalShortcutsProvider* self,
                                                             GAsyncResult* _res_,
                                                             GError** error);
static gboolean portal_global_shortcuts_provider_create_session_co (PortalGlobalShortcutsProviderCreateSessionData* _data_);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void ___lambda8_ (Block4Data* _data4_,
                  guint32 response,
                  GVariant* results);
static void ____lambda8__portal_request_callback (guint32 response,
                                           GVariant* results,
                                           gpointer self);
static void portal_global_shortcuts_provider_create_session_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void portal_global_shortcuts_provider_bind_shortcuts_data_free (gpointer _data);
static void portal_global_shortcuts_provider_bind_shortcuts (PortalGlobalShortcutsProvider* self,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static void portal_global_shortcuts_provider_bind_shortcuts_finish (PortalGlobalShortcutsProvider* self,
                                                             GAsyncResult* _res_,
                                                             GError** error);
static gboolean portal_global_shortcuts_provider_bind_shortcuts_co (PortalGlobalShortcutsProviderBindShortcutsData* _data_);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void portal_global_shortcuts_provider_bind_shortcuts_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void ___lambda9_ (Block5Data* _data5_,
                  guint32 response,
                  GVariant* results);
static void ____lambda9__portal_request_callback (guint32 response,
                                           GVariant* results,
                                           gpointer self);
static void portal_global_shortcuts_provider_schedule_bind_shortcuts (PortalGlobalShortcutsProvider* self);
static gboolean __lambda10_ (PortalGlobalShortcutsProvider* self);
static void __lambda11_ (PortalGlobalShortcutsProvider* self,
                  GObject* obj,
                  GAsyncResult* res);
static void ___lambda11__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gboolean ___lambda10__gsource_func (gpointer self);
static void portal_global_shortcuts_provider_on_name_appeared (PortalGlobalShortcutsProvider* self,
                                                        GDBusConnection* connection,
                                                        const gchar* name,
                                                        const gchar* name_owner);
VALA_EXTERN gboolean portal_has_dbus_interface (GDBusConnection* connection,
                                    const gchar* bus_name,
                                    const gchar* object_path,
                                    const gchar* interface_name,
                                    gint timeout);
static void portal_global_shortcuts_provider_on_name_vanished (PortalGlobalShortcutsProvider* self,
                                                        GDBusConnection* connection,
                                                        const gchar* name);
static void portal_global_shortcuts_provider_on_activated (PortalGlobalShortcutsProvider* self,
                                                    const char* session_handle,
                                                    const gchar* shortcut_id,
                                                    guint64 timestamp,
                                                    GVariant* options);
static void portal_global_shortcuts_provider_on_shortcuts_changed (PortalGlobalShortcutsProvider* self,
                                                            const char* session_handle,
                                                            GVariant* shortcuts);
static void portal_global_shortcuts_provider_real_add_shortcut (FtGlobalShortcutsProvider* base,
                                                         const gchar* name,
                                                         const gchar* description,
                                                         const gchar* default_accelerator);
static void _vala_array_add12 (PortalShortcut* * array,
                        gint* length,
                        gint* size,
                        const PortalShortcut* value);
static gchar* portal_global_shortcuts_provider_real_lookup_accelerator (FtGlobalShortcutsProvider* base,
                                                                 const gchar* name);
static void portal_global_shortcuts_provider_real_open_edit_dialog_data_free (gpointer _data);
static void portal_global_shortcuts_provider_real_open_edit_dialog (FtGlobalShortcutsProvider* base,
                                                             const gchar* window_identifier,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean portal_global_shortcuts_provider_real_open_edit_dialog_co (PortalGlobalShortcutsProviderOpenEditDialogData* _data_);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void ___lambda12_ (Block6Data* _data6_,
                   guint32 response,
                   GVariant* results);
static void ____lambda12__portal_request_callback (guint32 response,
                                            GVariant* results,
                                            gpointer self);
static void portal_global_shortcuts_provider_open_edit_dialog_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_);
VALA_EXTERN gboolean portal_has_dbus_method (GDBusProxy* proxy,
                                 const gchar* name);
static void _vala_array_add13 (PortalShortcut* * array,
                        gint* length,
                        gint* size,
                        const PortalShortcut* value);
static void portal_global_shortcuts_provider_real_initialize_data_free (gpointer _data);
static void portal_global_shortcuts_provider_real_initialize (FtProvider* base,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gboolean portal_global_shortcuts_provider_real_initialize_co (PortalGlobalShortcutsProviderInitializeData* _data_);
static void _portal_global_shortcuts_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                     const gchar* name,
                                                                                     const gchar* name_owner,
                                                                                     gpointer self);
static void _portal_global_shortcuts_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                     const gchar* name,
                                                                                     gpointer self);
static void portal_global_shortcuts_provider_real_enable_data_free (gpointer _data);
static void portal_global_shortcuts_provider_real_enable (FtProvider* base,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gboolean portal_global_shortcuts_provider_real_enable_co (PortalGlobalShortcutsProviderEnableData* _data_);
static void portal_global_shortcuts_provider_enable_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void _portal_global_shortcuts_provider_on_activated_portal_global_shortcuts_activated (PortalGlobalShortcuts* _sender,
                                                                                       const char* session_handle,
                                                                                       const gchar* shortcut_id,
                                                                                       guint64 timestamp,
                                                                                       GVariant* options,
                                                                                       gpointer self);
static void _portal_global_shortcuts_provider_on_shortcuts_changed_portal_global_shortcuts_shortcuts_changed (PortalGlobalShortcuts* _sender,
                                                                                                       const char* session_handle,
                                                                                                       GVariant* shortcuts,
                                                                                                       gpointer self);
static void portal_global_shortcuts_provider_real_disable_data_free (gpointer _data);
static void portal_global_shortcuts_provider_real_disable (FtProvider* base,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static gboolean portal_global_shortcuts_provider_real_disable_co (PortalGlobalShortcutsProviderDisableData* _data_);
static void portal_global_shortcuts_provider_real_uninitialize_data_free (gpointer _data);
static void portal_global_shortcuts_provider_real_uninitialize (FtProvider* base,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean portal_global_shortcuts_provider_real_uninitialize_co (PortalGlobalShortcutsProviderUninitializeData* _data_);
static void portal_global_shortcuts_provider_finalize (GObject * obj);
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 gssize _vala_array_length (gpointer array);

GQuark
portal_global_shortcuts_error_quark (void)
{
	return g_quark_from_static_string ("portal-global-shortcuts-error-quark");
}

static GType
portal_global_shortcuts_error_get_type_once (void)
{
	static const GEnumValue values[] = {{PORTAL_GLOBAL_SHORTCUTS_ERROR_REQUEST, "PORTAL_GLOBAL_SHORTCUTS_ERROR_REQUEST", "request"}, {PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION, "PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION", "create-session"}, {PORTAL_GLOBAL_SHORTCUTS_ERROR_BIND_SHORTCUTS, "PORTAL_GLOBAL_SHORTCUTS_ERROR_BIND_SHORTCUTS", "bind-shortcuts"}, {PORTAL_GLOBAL_SHORTCUTS_ERROR_CONFIGURE_SHORTCUTS, "PORTAL_GLOBAL_SHORTCUTS_ERROR_CONFIGURE_SHORTCUTS", "configure-shortcuts"}, {PORTAL_GLOBAL_SHORTCUTS_ERROR_LIST_SHORTCUTS, "PORTAL_GLOBAL_SHORTCUTS_ERROR_LIST_SHORTCUTS", "list-shortcuts"}, {0, NULL, NULL}};
	GType portal_global_shortcuts_error_type_id;
	portal_global_shortcuts_error_type_id = g_enum_register_static ("PortalGlobalShortcutsError", values);
	return portal_global_shortcuts_error_type_id;
}

GType
portal_global_shortcuts_error_get_type (void)
{
	static volatile gsize portal_global_shortcuts_error_type_id__once = 0;
	if (g_once_init_enter (&portal_global_shortcuts_error_type_id__once)) {
		GType portal_global_shortcuts_error_type_id;
		portal_global_shortcuts_error_type_id = portal_global_shortcuts_error_get_type_once ();
		g_once_init_leave (&portal_global_shortcuts_error_type_id__once, portal_global_shortcuts_error_type_id);
	}
	return portal_global_shortcuts_error_type_id__once;
}

GVariant*
portal_serialize_shortcut (PortalShortcut* shortcut)
{
	GVariantBuilder* properties = NULL;
	const GVariantType* _tmp0_;
	GVariantBuilder* _tmp1_;
	PortalShortcut _tmp2_;
	const gchar* _tmp3_;
	GVariant* _tmp4_;
	GVariant* _tmp5_;
	PortalShortcut _tmp6_;
	const gchar* _tmp7_;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	PortalShortcut _tmp10_;
	const gchar* _tmp11_;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	GVariant** _tmp14_;
	GVariant** _tmp15_;
	gint _tmp15__length1;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	GVariant* result;
	g_return_val_if_fail (shortcut != NULL, NULL);
	_tmp0_ = G_VARIANT_TYPE_VARDICT;
	_tmp1_ = g_variant_builder_new (_tmp0_);
	properties = _tmp1_;
	_tmp2_ = *shortcut;
	_tmp3_ = _tmp2_.description;
	_tmp4_ = g_variant_new_string (_tmp3_);
	g_variant_ref_sink (_tmp4_);
	_tmp5_ = _tmp4_;
	g_variant_builder_add (properties, "{sv}", "description", _tmp5_, NULL);
	_g_variant_unref0 (_tmp5_);
	_tmp6_ = *shortcut;
	_tmp7_ = _tmp6_.preferred_trigger;
	_tmp8_ = g_variant_new_string (_tmp7_);
	g_variant_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	g_variant_builder_add (properties, "{sv}", "preferred_trigger", _tmp9_, NULL);
	_g_variant_unref0 (_tmp9_);
	_tmp10_ = *shortcut;
	_tmp11_ = _tmp10_.id;
	_tmp12_ = g_variant_new_string (_tmp11_);
	g_variant_ref_sink (_tmp12_);
	_tmp13_ = g_variant_builder_end (properties);
	g_variant_ref_sink (_tmp13_);
	_tmp14_ = g_new0 (GVariant*, 2 + 1);
	_tmp14_[0] = _tmp12_;
	_tmp14_[1] = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp15__length1 = 2;
	_tmp16_ = g_variant_new_tuple (_tmp15_, 2);
	g_variant_ref_sink (_tmp16_);
	_tmp17_ = _tmp16_;
	_tmp15_ = (_vala_array_free (_tmp15_, _tmp15__length1, (GDestroyNotify) g_variant_unref), NULL);
	result = _tmp17_;
	_g_variant_builder_unref0 (properties);
	return result;
}

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

GVariant*
portal_serialize_shortcuts (PortalShortcut* shortcuts,
                            gint shortcuts_length1)
{
	GVariant** serialized_shortcuts = NULL;
	GVariant** _tmp0_;
	gint serialized_shortcuts_length1;
	gint _serialized_shortcuts_size_;
	GVariantType* _tmp5_;
	GVariantType* _tmp6_;
	GVariant** _tmp7_;
	gint _tmp7__length1;
	GVariant* _tmp8_;
	GVariant* _tmp9_;
	GVariant* result;
	_tmp0_ = g_new0 (GVariant*, 0 + 1);
	serialized_shortcuts = _tmp0_;
	serialized_shortcuts_length1 = 0;
	_serialized_shortcuts_size_ = serialized_shortcuts_length1;
	{
		PortalShortcut* shortcut_collection = NULL;
		gint shortcut_collection_length1 = 0;
		gint _shortcut_collection_size_ = 0;
		gint shortcut_it = 0;
		shortcut_collection = shortcuts;
		shortcut_collection_length1 = shortcuts_length1;
		for (shortcut_it = 0; shortcut_it < shortcut_collection_length1; shortcut_it = shortcut_it + 1) {
			PortalShortcut _tmp1_;
			PortalShortcut _tmp2_ = {0};
			PortalShortcut shortcut = {0};
			_tmp1_ = shortcut_collection[shortcut_it];
			portal_shortcut_copy (&_tmp1_, &_tmp2_);
			shortcut = _tmp2_;
			{
				PortalShortcut _tmp3_;
				GVariant* _tmp4_;
				_tmp3_ = shortcut;
				_tmp4_ = portal_serialize_shortcut (&_tmp3_);
				_vala_array_add1 (&serialized_shortcuts, &serialized_shortcuts_length1, &_serialized_shortcuts_size_, _tmp4_);
				portal_shortcut_destroy (&shortcut);
			}
		}
	}
	_tmp5_ = g_variant_type_new ("(sa{sv})");
	_tmp6_ = _tmp5_;
	_tmp7_ = serialized_shortcuts;
	_tmp7__length1 = serialized_shortcuts_length1;
	_tmp8_ = g_variant_new_array (_tmp6_, _tmp7_, _tmp7__length1);
	g_variant_ref_sink (_tmp8_);
	_tmp9_ = _tmp8_;
	_g_variant_type_free0 (_tmp6_);
	result = _tmp9_;
	serialized_shortcuts = (_vala_array_free (serialized_shortcuts, serialized_shortcuts_length1, (GDestroyNotify) g_variant_unref), NULL);
	return result;
}

static void
_vala_array_add2 (PortalShortcut* * array,
                  gint* length,
                  gint* size,
                  const PortalShortcut* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PortalShortcut, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

PortalShortcut*
portal_deserialize_shortcuts (GVariant* shortcuts_variant,
                              gint* result_length1)
{
	PortalShortcut* shortcuts = NULL;
	PortalShortcut* _tmp0_;
	gint shortcuts_length1;
	gint _shortcuts_size_;
	GVariantIter* shortcuts_iterator = NULL;
	GVariantIter* _tmp1_;
	GVariant* tuple_variant = NULL;
	PortalShortcut* _tmp43_;
	gint _tmp43__length1;
	PortalShortcut* result;
	g_return_val_if_fail (shortcuts_variant != NULL, NULL);
	_tmp0_ = g_new0 (PortalShortcut, 0);
	shortcuts = _tmp0_;
	shortcuts_length1 = 0;
	_shortcuts_size_ = shortcuts_length1;
	_tmp1_ = g_variant_iter_new (shortcuts_variant);
	shortcuts_iterator = _tmp1_;
	while (TRUE) {
		GVariantIter* _tmp2_;
		GVariant* _tmp3_;
		GVariant* _tmp4_;
		PortalShortcut shortcut = {0};
		GVariant* _tmp5_;
		GVariant* _tmp6_;
		GVariant* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		PortalShortcut _tmp13_ = {0};
		PortalShortcut _tmp14_;
		GVariant* properties = NULL;
		GVariant* _tmp15_;
		GVariant* _tmp16_;
		GVariantIter* properties_iterator = NULL;
		GVariant* _tmp17_;
		GVariantIter* _tmp18_;
		gchar* key = NULL;
		GVariant* variant = NULL;
		PortalShortcut _tmp40_;
		PortalShortcut _tmp41_;
		PortalShortcut _tmp42_ = {0};
		_tmp2_ = shortcuts_iterator;
		_tmp3_ = g_variant_iter_next_value (_tmp2_);
		_g_variant_unref0 (tuple_variant);
		tuple_variant = _tmp3_;
		_tmp4_ = tuple_variant;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = tuple_variant;
		_tmp6_ = g_variant_get_child_value (_tmp5_, (gsize) 0);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_variant_get_string (_tmp7_, NULL);
		_tmp9_ = g_strdup (_tmp8_);
		_tmp10_ = g_strdup ("");
		_tmp11_ = g_strdup ("");
		_tmp12_ = g_strdup ("");
		memset (&_tmp13_, 0, sizeof (PortalShortcut));
		_g_free0 (_tmp13_.id);
		_tmp13_.id = _tmp9_;
		_g_free0 (_tmp13_.description);
		_tmp13_.description = _tmp10_;
		_g_free0 (_tmp13_.preferred_trigger);
		_tmp13_.preferred_trigger = _tmp11_;
		_g_free0 (_tmp13_.trigger_description);
		_tmp13_.trigger_description = _tmp12_;
		_tmp14_ = _tmp13_;
		_g_variant_unref0 (_tmp7_);
		shortcut = _tmp14_;
		_tmp15_ = tuple_variant;
		_tmp16_ = g_variant_get_child_value (_tmp15_, (gsize) 1);
		properties = _tmp16_;
		_tmp17_ = properties;
		_tmp18_ = g_variant_iter_new (_tmp17_);
		properties_iterator = _tmp18_;
		while (TRUE) {
			GVariantIter* _tmp19_;
			gchar* _tmp20_ = NULL;
			GVariant* _tmp21_ = NULL;
			gboolean _tmp22_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			GQuark _tmp26_ = 0U;
			static GQuark _tmp25_label0 = 0;
			static GQuark _tmp25_label1 = 0;
			static GQuark _tmp25_label2 = 0;
			_tmp19_ = properties_iterator;
			_tmp22_ = g_variant_iter_next (_tmp19_, "{sv}", &_tmp20_, &_tmp21_, NULL);
			_g_free0 (key);
			key = _tmp20_;
			_g_variant_unref0 (variant);
			variant = _tmp21_;
			if (!_tmp22_) {
				break;
			}
			_tmp23_ = key;
			_tmp24_ = _tmp23_;
			_tmp26_ = (NULL == _tmp24_) ? 0 : g_quark_from_string (_tmp24_);
			if (_tmp26_ == ((0 != _tmp25_label0) ? _tmp25_label0 : (_tmp25_label0 = g_quark_from_static_string ("description")))) {
				switch (0) {
					default:
					{
						GVariant* _tmp27_;
						const gchar* _tmp28_;
						gchar* _tmp29_;
						_tmp27_ = variant;
						_tmp28_ = g_variant_get_string (_tmp27_, NULL);
						_tmp29_ = g_strdup (_tmp28_);
						_g_free0 (shortcut.description);
						shortcut.description = _tmp29_;
						break;
					}
				}
			} else if (_tmp26_ == ((0 != _tmp25_label1) ? _tmp25_label1 : (_tmp25_label1 = g_quark_from_static_string ("preferred_trigger")))) {
				switch (0) {
					default:
					{
						GVariant* _tmp30_;
						const gchar* _tmp31_;
						gchar* _tmp32_;
						_tmp30_ = variant;
						_tmp31_ = g_variant_get_string (_tmp30_, NULL);
						_tmp32_ = g_strdup (_tmp31_);
						_g_free0 (shortcut.preferred_trigger);
						shortcut.preferred_trigger = _tmp32_;
						break;
					}
				}
			} else if (_tmp26_ == ((0 != _tmp25_label2) ? _tmp25_label2 : (_tmp25_label2 = g_quark_from_static_string ("trigger_description")))) {
				switch (0) {
					default:
					{
						GVariant* _tmp33_;
						const gchar* _tmp34_;
						gchar* _tmp35_;
						_tmp33_ = variant;
						_tmp34_ = g_variant_get_string (_tmp33_, NULL);
						_tmp35_ = g_strdup (_tmp34_);
						_g_free0 (shortcut.trigger_description);
						shortcut.trigger_description = _tmp35_;
						break;
					}
				}
			} else {
				switch (0) {
					default:
					{
						const gchar* _tmp36_;
						GVariant* _tmp37_;
						gchar* _tmp38_;
						gchar* _tmp39_;
						_tmp36_ = key;
						_tmp37_ = variant;
						_tmp38_ = g_variant_print (_tmp37_, TRUE);
						_tmp39_ = _tmp38_;
						g_debug ("global-shortcuts-provider.vala:84: Unhandled shortcut property %s=%s", _tmp36_, _tmp39_);
						_g_free0 (_tmp39_);
						break;
					}
				}
			}
		}
		_tmp40_ = shortcut;
		_tmp41_ = _tmp40_;
		portal_shortcut_copy (&_tmp41_, &_tmp42_);
		_vala_array_add2 (&shortcuts, &shortcuts_length1, &_shortcuts_size_, &_tmp42_);
		_g_variant_unref0 (variant);
		_g_free0 (key);
		_g_variant_iter_free0 (properties_iterator);
		_g_variant_unref0 (properties);
		portal_shortcut_destroy (&shortcut);
	}
	_tmp43_ = shortcuts;
	_tmp43__length1 = shortcuts_length1;
	if (result_length1) {
		*result_length1 = _tmp43__length1;
	}
	result = _tmp43_;
	_g_variant_unref0 (tuple_variant);
	_g_variant_iter_free0 (shortcuts_iterator);
	return result;
}

gboolean
portal_is_kde (void)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	gboolean result;
	_tmp0_ = ft_get_desktop_name ();
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	g_free (_tmp1_);
	if ((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("kde")))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string ("lxqt"))))) {
		switch (0) {
			default:
			{
				result = TRUE;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FALSE;
				return result;
			}
		}
	}
}

/**
     * `GlobalShortcuts` API doesn't expose the accelerator_string value in a standardized way,
     * we need to extract it from text.
     */
static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
	result = _tmp4_;
	return result;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

gchar*
portal_parse_trigger_description (const gchar* trigger_description)
{
	gboolean _tmp0_ = FALSE;
	gchar* _tmp41_;
	gchar* result;
	if (trigger_description != NULL) {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (trigger_description);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_ > 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint position_start = 0;
		gint position_end = 0;
		gint _tmp3_;
		gint _tmp4_;
		gint comma_position = 0;
		gint accelerator_position = 0;
		gboolean _tmp5_ = FALSE;
		GString* accelerator_string = NULL;
		GString* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar** _tmp10_;
		gchar** _tmp11_;
		gchar** _tmp12_;
		gint _tmp12__length1;
		GString* _tmp38_;
		const gchar* _tmp39_;
		gchar* _tmp40_;
		position_start = 0;
		_tmp3_ = strlen (trigger_description);
		_tmp4_ = _tmp3_;
		position_end = _tmp4_;
		comma_position = string_index_of (trigger_description, ", ", 0);
		if (comma_position > 0) {
			position_end = comma_position;
		}
		accelerator_position = string_index_of (trigger_description, "<", 0);
		if (accelerator_position >= 0) {
			_tmp5_ = TRUE;
		} else {
			_tmp5_ = !portal_is_kde ();
		}
		if (_tmp5_) {
			gchar* _tmp6_;
			position_start = MAX (position_start, accelerator_position);
			_tmp6_ = string_slice (trigger_description, (glong) position_start, (glong) position_end);
			result = _tmp6_;
			return result;
		}
		_tmp7_ = g_string_new ("");
		accelerator_string = _tmp7_;
		_tmp8_ = string_slice (trigger_description, (glong) position_start, (glong) position_end);
		_tmp9_ = _tmp8_;
		_tmp11_ = _tmp10_ = g_strsplit (_tmp9_, "+", 0);
		_tmp12_ = _tmp11_;
		_tmp12__length1 = _vala_array_length (_tmp10_);
		_g_free0 (_tmp9_);
		{
			gchar** key_collection = NULL;
			gint key_collection_length1 = 0;
			gint _key_collection_size_ = 0;
			gint key_it = 0;
			key_collection = _tmp12_;
			key_collection_length1 = _tmp12__length1;
			for (key_it = 0; key_it < key_collection_length1; key_it = key_it + 1) {
				gchar* _tmp13_;
				gchar* key = NULL;
				_tmp13_ = g_strdup (key_collection[key_it]);
				key = _tmp13_;
				{
					const gchar* _tmp14_;
					gchar* _tmp15_;
					const gchar* _tmp16_;
					const gchar* _tmp17_;
					GQuark _tmp19_ = 0U;
					static GQuark _tmp18_label0 = 0;
					static GQuark _tmp18_label1 = 0;
					static GQuark _tmp18_label2 = 0;
					static GQuark _tmp18_label3 = 0;
					static GQuark _tmp18_label4 = 0;
					static GQuark _tmp18_label5 = 0;
					static GQuark _tmp18_label6 = 0;
					static GQuark _tmp18_label7 = 0;
					_tmp14_ = key;
					_tmp15_ = string_strip (_tmp14_);
					_g_free0 (key);
					key = _tmp15_;
					_tmp16_ = key;
					_tmp17_ = _tmp16_;
					_tmp19_ = (NULL == _tmp17_) ? 0 : g_quark_from_string (_tmp17_);
					if ((_tmp19_ == ((0 != _tmp18_label0) ? _tmp18_label0 : (_tmp18_label0 = g_quark_from_static_string ("Meta")))) || (_tmp19_ == ((0 != _tmp18_label1) ? _tmp18_label1 : (_tmp18_label1 = g_quark_from_static_string ("Super"))))) {
						switch (0) {
							default:
							{
								GString* _tmp20_;
								_tmp20_ = accelerator_string;
								g_string_append (_tmp20_, "<Super>");
								break;
							}
						}
					} else if ((_tmp19_ == ((0 != _tmp18_label2) ? _tmp18_label2 : (_tmp18_label2 = g_quark_from_static_string ("Ctrl")))) || (_tmp19_ == ((0 != _tmp18_label3) ? _tmp18_label3 : (_tmp18_label3 = g_quark_from_static_string ("Control"))))) {
						switch (0) {
							default:
							{
								GString* _tmp21_;
								_tmp21_ = accelerator_string;
								g_string_append (_tmp21_, "<Control>");
								break;
							}
						}
					} else if ((_tmp19_ == ((0 != _tmp18_label4) ? _tmp18_label4 : (_tmp18_label4 = g_quark_from_static_string ("Alt")))) || (_tmp19_ == ((0 != _tmp18_label5) ? _tmp18_label5 : (_tmp18_label5 = g_quark_from_static_string ("Shift"))))) {
						switch (0) {
							default:
							{
								GString* _tmp22_;
								const gchar* _tmp23_;
								const gchar* _tmp24_;
								gchar* _tmp25_;
								gchar* _tmp26_;
								_tmp22_ = accelerator_string;
								_tmp23_ = key;
								_tmp24_ = string_to_string (_tmp23_);
								_tmp25_ = g_strconcat ("<", _tmp24_, ">", NULL);
								_tmp26_ = _tmp25_;
								g_string_append (_tmp22_, _tmp26_);
								_g_free0 (_tmp26_);
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label6) ? _tmp18_label6 : (_tmp18_label6 = g_quark_from_static_string ("PgUp")))) {
						switch (0) {
							default:
							{
								GString* _tmp27_;
								_tmp27_ = accelerator_string;
								g_string_append (_tmp27_, "Page_Up");
								break;
							}
						}
					} else if (_tmp19_ == ((0 != _tmp18_label7) ? _tmp18_label7 : (_tmp18_label7 = g_quark_from_static_string ("PgDown")))) {
						switch (0) {
							default:
							{
								GString* _tmp28_;
								_tmp28_ = accelerator_string;
								g_string_append (_tmp28_, "Page_Down");
								break;
							}
						}
					} else {
						switch (0) {
							default:
							{
								gchar* _tmp29_ = NULL;
								const gchar* _tmp30_;
								gint _tmp31_;
								gint _tmp32_;
								GString* _tmp37_;
								_tmp30_ = key;
								_tmp31_ = strlen (_tmp30_);
								_tmp32_ = _tmp31_;
								if (_tmp32_ == 1) {
									const gchar* _tmp33_;
									gchar* _tmp34_;
									_tmp33_ = key;
									_tmp34_ = g_utf8_strdown (_tmp33_, (gssize) -1);
									_g_free0 (_tmp29_);
									_tmp29_ = _tmp34_;
								} else {
									const gchar* _tmp35_;
									gchar* _tmp36_;
									_tmp35_ = key;
									_tmp36_ = g_strdup (_tmp35_);
									_g_free0 (_tmp29_);
									_tmp29_ = _tmp36_;
								}
								_tmp37_ = accelerator_string;
								g_string_append (_tmp37_, _tmp29_);
								_g_free0 (_tmp29_);
								break;
							}
						}
					}
					_g_free0 (key);
				}
			}
			key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
		}
		_tmp38_ = accelerator_string;
		_tmp39_ = _tmp38_->str;
		_tmp40_ = g_strdup (_tmp39_);
		result = _tmp40_;
		_g_string_free0 (accelerator_string);
		return result;
	}
	_tmp41_ = g_strdup ("");
	result = _tmp41_;
	return result;
}

static gboolean
string_get_next_char (const gchar* self,
                      gint* index,
                      gunichar* c)
{
	gunichar _vala_c = 0U;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_vala_c = g_utf8_get_char (((gchar*) self) + (*index));
	if (_vala_c != ((gunichar) 0)) {
		gchar* _tmp0_;
		_tmp0_ = g_utf8_next_char (((gchar*) self) + (*index));
		*index = (gint) (_tmp0_ - ((gchar*) self));
		result = TRUE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	} else {
		result = FALSE;
		if (c) {
			*c = _vala_c;
		}
		return result;
	}
}

gchar*
portal_to_pascal_case (const gchar* key_name)
{
	GString* builder = NULL;
	GString* _tmp0_;
	gboolean uppercase_next = FALSE;
	gint index = 0;
	gunichar chr = 0U;
	GString* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (key_name != NULL, NULL);
	_tmp0_ = g_string_new ("");
	builder = _tmp0_;
	uppercase_next = TRUE;
	index = 0;
	while (TRUE) {
		gunichar _tmp1_ = 0U;
		gboolean _tmp2_;
		gunichar _tmp3_ = 0U;
		GString* _tmp4_;
		_tmp2_ = string_get_next_char (key_name, &index, &_tmp1_);
		chr = _tmp1_;
		if (!_tmp2_) {
			break;
		}
		if (chr == ((gunichar) '_')) {
			uppercase_next = TRUE;
			continue;
		}
		if (uppercase_next) {
			_tmp3_ = g_unichar_toupper (chr);
		} else {
			_tmp3_ = chr;
		}
		_tmp4_ = builder;
		g_string_append_unichar (_tmp4_, _tmp3_);
		uppercase_next = FALSE;
	}
	_tmp5_ = builder;
	_tmp6_ = _tmp5_->str;
	_tmp7_ = g_strdup (_tmp6_);
	result = _tmp7_;
	_g_string_free0 (builder);
	return result;
}

static void
_vala_array_add3 (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 void
_vala_array_add4 (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 void
_vala_array_add5 (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 void
_vala_array_add6 (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*
g_unichar_to_string (gunichar self)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_new0 (gchar, 7);
	str = (gchar*) _tmp0_;
	g_unichar_to_utf8 (self, str);
	result = str;
	return result;
}

static void
_vala_array_add7 (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 void
_vala_array_add8 (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 void
_vala_array_add9 (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 void
_vala_array_add10 (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*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

gchar*
portal_format_accelerator_kde (FtAccelerator* accelerator)
{
	gchar** labels = NULL;
	gchar** _tmp0_;
	gint labels_length1;
	gint _labels_size_;
	FtAccelerator _tmp1_;
	FtAccelerator _tmp3_;
	FtAccelerator _tmp5_;
	FtAccelerator _tmp7_;
	gunichar chr = 0U;
	FtAccelerator _tmp9_;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gchar** _tmp22_;
	gint _tmp22__length1;
	gchar* _tmp23_;
	gchar* result;
	g_return_val_if_fail (accelerator != NULL, NULL);
	_tmp0_ = g_new0 (gchar*, 0 + 1);
	labels = _tmp0_;
	labels_length1 = 0;
	_labels_size_ = labels_length1;
	_tmp1_ = *accelerator;
	if ((_tmp1_.modifiers & GDK_SUPER_MASK) == GDK_SUPER_MASK) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("Meta");
		_vala_array_add3 (&labels, &labels_length1, &_labels_size_, _tmp2_);
	}
	_tmp3_ = *accelerator;
	if ((_tmp3_.modifiers & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("Ctrl");
		_vala_array_add4 (&labels, &labels_length1, &_labels_size_, _tmp4_);
	}
	_tmp5_ = *accelerator;
	if ((_tmp5_.modifiers & GDK_ALT_MASK) == GDK_ALT_MASK) {
		gchar* _tmp6_;
		_tmp6_ = g_strdup ("Alt");
		_vala_array_add5 (&labels, &labels_length1, &_labels_size_, _tmp6_);
	}
	_tmp7_ = *accelerator;
	if ((_tmp7_.modifiers & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) {
		gchar* _tmp8_;
		_tmp8_ = g_strdup ("Shift");
		_vala_array_add6 (&labels, &labels_length1, &_labels_size_, _tmp8_);
	}
	_tmp9_ = *accelerator;
	chr = (gunichar) gdk_keyval_to_unicode (_tmp9_.keyval);
	if (chr != ((gunichar) '\x00')) {
		_tmp11_ = chr < ((gunichar) '\x80');
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		_tmp10_ = g_unichar_isgraph (chr);
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		gchar* _tmp12_;
		_tmp12_ = g_unichar_to_string (g_unichar_toupper (chr));
		_vala_array_add7 (&labels, &labels_length1, &_labels_size_, _tmp12_);
	} else {
		FtAccelerator _tmp13_;
		_tmp13_ = *accelerator;
		switch (_tmp13_.keyval) {
			case GDK_KEY_Page_Up:
			{
				gchar* _tmp14_;
				_tmp14_ = g_strdup ("PgUp");
				_vala_array_add8 (&labels, &labels_length1, &_labels_size_, _tmp14_);
				break;
			}
			case GDK_KEY_Page_Down:
			{
				gchar* _tmp15_;
				_tmp15_ = g_strdup ("PgDown");
				_vala_array_add9 (&labels, &labels_length1, &_labels_size_, _tmp15_);
				break;
			}
			default:
			{
				gchar* keyval_name = NULL;
				FtAccelerator _tmp16_;
				const gchar* _tmp17_;
				gchar* _tmp18_;
				const gchar* _tmp19_;
				_tmp16_ = *accelerator;
				_tmp17_ = gdk_keyval_name (_tmp16_.keyval);
				_tmp18_ = g_strdup (_tmp17_);
				keyval_name = _tmp18_;
				_tmp19_ = keyval_name;
				if (_tmp19_ != NULL) {
					const gchar* _tmp20_;
					gchar* _tmp21_;
					_tmp20_ = keyval_name;
					_tmp21_ = portal_to_pascal_case (_tmp20_);
					_vala_array_add10 (&labels, &labels_length1, &_labels_size_, _tmp21_);
				}
				_g_free0 (keyval_name);
				break;
			}
		}
	}
	_tmp22_ = labels;
	_tmp22__length1 = labels_length1;
	_tmp23_ = _vala_g_strjoinv ("+", _tmp22_, (gint) _tmp22__length1);
	result = _tmp23_;
	labels = (_vala_array_free (labels, labels_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

gchar*
portal_format_accelerator (const gchar* accelerator_string)
{
	gchar* result;
	g_return_val_if_fail (accelerator_string != NULL, NULL);
	if (g_strcmp0 (accelerator_string, "") == 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("");
		result = _tmp0_;
		return result;
	}
	if (portal_is_kde ()) {
		FtAccelerator accelerator = {0};
		FtAccelerator _tmp1_ = {0};
		gchar* _tmp2_ = NULL;
		gchar* _tmp6_;
		ft_accelerator_from_string (accelerator_string, &_tmp1_);
		accelerator = _tmp1_;
		if (!ft_accelerator_is_empty (&accelerator)) {
			FtAccelerator _tmp3_;
			gchar* _tmp4_;
			_tmp3_ = accelerator;
			_tmp4_ = portal_format_accelerator_kde (&_tmp3_);
			_g_free0 (_tmp2_);
			_tmp2_ = _tmp4_;
		} else {
			gchar* _tmp5_;
			_tmp5_ = g_strdup ("");
			_g_free0 (_tmp2_);
			_tmp2_ = _tmp5_;
		}
		_tmp6_ = _tmp2_;
		_tmp2_ = NULL;
		result = _tmp6_;
		_g_free0 (_tmp2_);
		return result;
	} else {
		gchar* _tmp7_;
		_tmp7_ = g_strdup (accelerator_string);
		result = _tmp7_;
		return result;
	}
}

static inline gpointer
portal_global_shortcuts_provider_get_instance_private (PortalGlobalShortcutsProvider* self)
{
	return G_STRUCT_MEMBER_P (self, PortalGlobalShortcutsProvider_private_offset);
}

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

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

static void
portal_global_shortcuts_provider_mark_as_configured (PortalGlobalShortcutsProvider* self)
{
	g_return_if_fail (self != NULL);
	if (!self->priv->is_configured) {
		GSettings* settings = NULL;
		GSettings* _tmp0_;
		GSettings* _tmp1_;
		GSettings* _tmp2_;
		_tmp0_ = ft_get_settings ();
		_tmp1_ = _g_object_ref0 (_tmp0_);
		settings = _tmp1_;
		_tmp2_ = settings;
		g_settings_set_boolean (_tmp2_, "global-shortcuts-configured", TRUE);
		self->priv->is_configured = TRUE;
		_g_object_unref0 (settings);
	}
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

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

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_)) {
		GHashTable* self;
		self = _data3_->self;
		_g_hash_table_unref0 (self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda2_ (Block3Data* _data3_,
            gconstpointer k,
            gconstpointer v)
{
	GHashTable* self;
	self = _data3_->self;
	_data3_->func (v, _data3_->func_target);
}

static void
___lambda2__gh_func (gconstpointer key,
                     gconstpointer value,
                     gpointer self)
{
	__lambda2_ (self, key, value);
}

static void
_vala_g_hash_set_foreach (GHashTable* self,
                          GFunc func,
                          gpointer func_target)
{
	Block3Data* _data3_;
	g_return_if_fail (self != NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	_data3_->self = g_hash_table_ref (self);
	_data3_->func = func;
	_data3_->func_target = func_target;
	g_hash_table_foreach ((GHashTable*) self, ___lambda2__gh_func, _data3_);
	block3_data_unref (_data3_);
	_data3_ = NULL;
}

static void
___lambda7_ (PortalGlobalShortcutsProvider* self,
             const gchar* shortcut_id)
{
	g_return_if_fail (shortcut_id != NULL);
	g_signal_emit_by_name ((FtGlobalShortcutsProvider*) self, "accelerator-changed", shortcut_id);
}

static void
____lambda7__gfunc (gconstpointer data,
                    gpointer self)
{
	___lambda7_ ((PortalGlobalShortcutsProvider*) self, (const gchar*) data);
}

static void
portal_global_shortcuts_provider_update_accelerators (PortalGlobalShortcutsProvider* self,
                                                      GVariant* shortcuts)
{
	GHashTable* changed_ids = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* new_accelerators = NULL;
	GHashFunc _tmp3_;
	GEqualFunc _tmp4_;
	GHashTable* _tmp5_;
	gboolean is_initialized = FALSE;
	GHashTable* _tmp6_;
	PortalShortcut* _tmp7_;
	gint _tmp7__length1;
	gint _tmp29_ = 0;
	PortalShortcut* _tmp30_;
	GHashTable* _tmp63_;
	GHashTable* _tmp64_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (shortcuts != NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_free0_);
	changed_ids = _tmp2_;
	_tmp3_ = g_str_hash;
	_tmp4_ = g_str_equal;
	_tmp5_ = g_hash_table_new_full (_tmp3_, _tmp4_, _g_free0_, _g_free0_);
	new_accelerators = _tmp5_;
	_tmp6_ = self->priv->accelerators;
	is_initialized = _tmp6_ != NULL;
	_tmp7_ = self->priv->shortcuts;
	_tmp7__length1 = self->priv->shortcuts_length1;
	{
		PortalShortcut* shortcut_collection = NULL;
		gint shortcut_collection_length1 = 0;
		gint _shortcut_collection_size_ = 0;
		gint shortcut_it = 0;
		shortcut_collection = _tmp7_;
		shortcut_collection_length1 = _tmp7__length1;
		for (shortcut_it = 0; shortcut_it < shortcut_collection_length1; shortcut_it = shortcut_it + 1) {
			PortalShortcut _tmp8_;
			PortalShortcut _tmp9_ = {0};
			PortalShortcut shortcut = {0};
			_tmp8_ = shortcut_collection[shortcut_it];
			portal_shortcut_copy (&_tmp8_, &_tmp9_);
			shortcut = _tmp9_;
			{
				gboolean _tmp10_ = FALSE;
				gboolean _tmp11_ = FALSE;
				GHashTable* _tmp12_;
				GHashTable* _tmp24_;
				PortalShortcut _tmp25_;
				const gchar* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				_tmp12_ = self->priv->accelerators;
				if (_tmp12_ != NULL) {
					GHashTable* _tmp13_;
					PortalShortcut _tmp14_;
					const gchar* _tmp15_;
					_tmp13_ = self->priv->accelerators;
					_tmp14_ = shortcut;
					_tmp15_ = _tmp14_.id;
					_tmp11_ = g_hash_table_contains (_tmp13_, _tmp15_);
				} else {
					_tmp11_ = FALSE;
				}
				if (_tmp11_) {
					GHashTable* _tmp16_;
					PortalShortcut _tmp17_;
					const gchar* _tmp18_;
					gconstpointer _tmp19_;
					_tmp16_ = self->priv->accelerators;
					_tmp17_ = shortcut;
					_tmp18_ = _tmp17_.id;
					_tmp19_ = g_hash_table_lookup (_tmp16_, _tmp18_);
					_tmp10_ = g_strcmp0 ((const gchar*) _tmp19_, "") != 0;
				} else {
					_tmp10_ = FALSE;
				}
				if (_tmp10_) {
					GHashTable* _tmp20_;
					PortalShortcut _tmp21_;
					const gchar* _tmp22_;
					gchar* _tmp23_;
					_tmp20_ = changed_ids;
					_tmp21_ = shortcut;
					_tmp22_ = _tmp21_.id;
					_tmp23_ = g_strdup (_tmp22_);
					g_hash_table_add (_tmp20_, _tmp23_);
				}
				_tmp24_ = new_accelerators;
				_tmp25_ = shortcut;
				_tmp26_ = _tmp25_.id;
				_tmp27_ = g_strdup (_tmp26_);
				_tmp28_ = g_strdup ("");
				g_hash_table_insert (_tmp24_, _tmp27_, _tmp28_);
				portal_shortcut_destroy (&shortcut);
			}
		}
	}
	_tmp30_ = portal_deserialize_shortcuts (shortcuts, &_tmp29_);
	{
		PortalShortcut* shortcut_collection = NULL;
		gint shortcut_collection_length1 = 0;
		gint _shortcut_collection_size_ = 0;
		gint shortcut_it = 0;
		shortcut_collection = _tmp30_;
		shortcut_collection_length1 = _tmp29_;
		for (shortcut_it = 0; shortcut_it < shortcut_collection_length1; shortcut_it = shortcut_it + 1) {
			PortalShortcut _tmp31_;
			PortalShortcut _tmp32_ = {0};
			PortalShortcut shortcut = {0};
			_tmp31_ = shortcut_collection[shortcut_it];
			portal_shortcut_copy (&_tmp31_, &_tmp32_);
			shortcut = _tmp32_;
			{
				const gchar* _tmp33_ = NULL;
				gboolean _tmp34_ = FALSE;
				GHashTable* _tmp35_;
				gchar* existing_accelerator = NULL;
				gchar* _tmp43_;
				gchar* accelerator = NULL;
				PortalShortcut _tmp44_;
				const gchar* _tmp45_;
				gchar* _tmp46_;
				const gchar* _tmp47_;
				const gchar* _tmp48_;
				GHashTable* _tmp57_;
				PortalShortcut _tmp58_;
				const gchar* _tmp59_;
				gchar* _tmp60_;
				const gchar* _tmp61_;
				gchar* _tmp62_;
				_tmp35_ = self->priv->accelerators;
				if (_tmp35_ != NULL) {
					GHashTable* _tmp36_;
					PortalShortcut _tmp37_;
					const gchar* _tmp38_;
					_tmp36_ = self->priv->accelerators;
					_tmp37_ = shortcut;
					_tmp38_ = _tmp37_.id;
					_tmp34_ = g_hash_table_contains (_tmp36_, _tmp38_);
				} else {
					_tmp34_ = FALSE;
				}
				if (_tmp34_) {
					GHashTable* _tmp39_;
					PortalShortcut _tmp40_;
					const gchar* _tmp41_;
					gconstpointer _tmp42_;
					_tmp39_ = self->priv->accelerators;
					_tmp40_ = shortcut;
					_tmp41_ = _tmp40_.id;
					_tmp42_ = g_hash_table_lookup (_tmp39_, _tmp41_);
					_tmp33_ = (const gchar*) _tmp42_;
				} else {
					_tmp33_ = "";
				}
				_tmp43_ = g_strdup (_tmp33_);
				existing_accelerator = _tmp43_;
				_tmp44_ = shortcut;
				_tmp45_ = _tmp44_.trigger_description;
				_tmp46_ = portal_parse_trigger_description (_tmp45_);
				accelerator = _tmp46_;
				_tmp47_ = accelerator;
				_tmp48_ = existing_accelerator;
				if (g_strcmp0 (_tmp47_, _tmp48_) == 0) {
					GHashTable* _tmp49_;
					PortalShortcut _tmp50_;
					const gchar* _tmp51_;
					_tmp49_ = changed_ids;
					_tmp50_ = shortcut;
					_tmp51_ = _tmp50_.id;
					g_hash_table_remove (_tmp49_, _tmp51_);
				} else {
					const gchar* _tmp52_;
					_tmp52_ = accelerator;
					if (g_strcmp0 (_tmp52_, "") != 0) {
						GHashTable* _tmp53_;
						PortalShortcut _tmp54_;
						const gchar* _tmp55_;
						gchar* _tmp56_;
						_tmp53_ = changed_ids;
						_tmp54_ = shortcut;
						_tmp55_ = _tmp54_.id;
						_tmp56_ = g_strdup (_tmp55_);
						g_hash_table_add (_tmp53_, _tmp56_);
					}
				}
				_tmp57_ = new_accelerators;
				_tmp58_ = shortcut;
				_tmp59_ = _tmp58_.id;
				_tmp60_ = g_strdup (_tmp59_);
				_tmp61_ = accelerator;
				_tmp62_ = g_strdup (_tmp61_);
				g_hash_table_insert (_tmp57_, _tmp60_, _tmp62_);
				_g_free0 (accelerator);
				_g_free0 (existing_accelerator);
				portal_shortcut_destroy (&shortcut);
			}
		}
		shortcut_collection = (_vala_PortalShortcut_array_free (shortcut_collection, shortcut_collection_length1), NULL);
	}
	_tmp63_ = new_accelerators;
	_tmp64_ = _g_hash_table_ref0 (_tmp63_);
	_g_hash_table_unref0 (self->priv->accelerators);
	self->priv->accelerators = _tmp64_;
	if (is_initialized) {
		GHashTable* _tmp65_;
		_tmp65_ = changed_ids;
		_vala_g_hash_set_foreach (_tmp65_, ____lambda7__gfunc, self);
	}
	_g_hash_table_unref0 (new_accelerators);
	_g_hash_table_unref0 (changed_ids);
}

/**
         * GlobalShortcuts API doesn't standardize the format of the shortcuts.
         *
         * App uses Gdk/GNOME format. We may need to convert it to local format.
         */
static void
_vala_array_add11 (PortalShortcut* * array,
                   gint* length,
                   gint* size,
                   const PortalShortcut* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PortalShortcut, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static PortalShortcut*
portal_global_shortcuts_provider_format_shortcuts (PortalGlobalShortcutsProvider* self,
                                                   PortalShortcut* shortcuts,
                                                   gint shortcuts_length1,
                                                   gint* result_length1)
{
	PortalShortcut* _result_ = NULL;
	PortalShortcut* _tmp0_;
	gint _result__length1;
	gint __result__size_;
	PortalShortcut* _tmp14_;
	gint _tmp14__length1;
	PortalShortcut* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_new0 (PortalShortcut, 0);
	_result_ = _tmp0_;
	_result__length1 = 0;
	__result__size_ = _result__length1;
	{
		PortalShortcut* shortcut_collection = NULL;
		gint shortcut_collection_length1 = 0;
		gint _shortcut_collection_size_ = 0;
		gint shortcut_it = 0;
		shortcut_collection = shortcuts;
		shortcut_collection_length1 = shortcuts_length1;
		for (shortcut_it = 0; shortcut_it < shortcut_collection_length1; shortcut_it = shortcut_it + 1) {
			PortalShortcut shortcut = {0};
			shortcut = shortcut_collection[shortcut_it];
			{
				PortalShortcut _tmp1_;
				const gchar* _tmp2_;
				gchar* _tmp3_;
				PortalShortcut _tmp4_;
				const gchar* _tmp5_;
				gchar* _tmp6_;
				PortalShortcut _tmp7_;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				PortalShortcut _tmp10_;
				const gchar* _tmp11_;
				gchar* _tmp12_;
				PortalShortcut _tmp13_ = {0};
				_tmp1_ = shortcut;
				_tmp2_ = _tmp1_.id;
				_tmp3_ = g_strdup (_tmp2_);
				_tmp4_ = shortcut;
				_tmp5_ = _tmp4_.description;
				_tmp6_ = g_strdup (_tmp5_);
				_tmp7_ = shortcut;
				_tmp8_ = _tmp7_.preferred_trigger;
				_tmp9_ = portal_format_accelerator (_tmp8_);
				_tmp10_ = shortcut;
				_tmp11_ = _tmp10_.trigger_description;
				_tmp12_ = g_strdup (_tmp11_);
				memset (&_tmp13_, 0, sizeof (PortalShortcut));
				_g_free0 (_tmp13_.id);
				_tmp13_.id = _tmp3_;
				_g_free0 (_tmp13_.description);
				_tmp13_.description = _tmp6_;
				_g_free0 (_tmp13_.preferred_trigger);
				_tmp13_.preferred_trigger = _tmp9_;
				_g_free0 (_tmp13_.trigger_description);
				_tmp13_.trigger_description = _tmp12_;
				_vala_array_add11 (&_result_, &_result__length1, &__result__size_, &_tmp13_);
			}
		}
	}
	_tmp14_ = _result_;
	_tmp14__length1 = _result__length1;
	if (result_length1) {
		*result_length1 = _tmp14__length1;
	}
	result = _tmp14_;
	return result;
}

static void
portal_global_shortcuts_provider_create_extra_shortcut (PortalGlobalShortcutsProvider* self,
                                                        PortalShortcut* result)
{
	guint timestamp = 0U;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	PortalShortcut _tmp6_ = {0};
	PortalShortcut _tmp7_;
	g_return_if_fail (self != NULL);
	timestamp = ft_timestamp_to_seconds_uint32 (ft_timestamp_from_now ());
	_tmp0_ = g_strdup_printf ("%u", timestamp);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strconcat ("unused-", _tmp1_, NULL);
	_tmp3_ = g_strdup (_ ("Unused"));
	_tmp4_ = g_strdup ("");
	_tmp5_ = g_strdup ("");
	memset (&_tmp6_, 0, sizeof (PortalShortcut));
	_g_free0 (_tmp6_.id);
	_tmp6_.id = _tmp2_;
	_g_free0 (_tmp6_.description);
	_tmp6_.description = _tmp3_;
	_g_free0 (_tmp6_.preferred_trigger);
	_tmp6_.preferred_trigger = _tmp4_;
	_g_free0 (_tmp6_.trigger_description);
	_tmp6_.trigger_description = _tmp5_;
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp1_);
	*result = _tmp7_;
	return;
}

static gint
portal_global_shortcuts_provider_find_shortcut (PortalGlobalShortcutsProvider* self,
                                                const gchar* name)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (name != NULL, -1);
	{
		gint index = 0;
		index = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				PortalShortcut* _tmp2_;
				gint _tmp2__length1;
				PortalShortcut* _tmp3_;
				gint _tmp3__length1;
				PortalShortcut _tmp4_;
				const gchar* _tmp5_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = index;
					index = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = self->priv->shortcuts;
				_tmp2__length1 = self->priv->shortcuts_length1;
				if (!(index < _tmp2__length1)) {
					break;
				}
				_tmp3_ = self->priv->shortcuts;
				_tmp3__length1 = self->priv->shortcuts_length1;
				_tmp4_ = _tmp3_[index];
				_tmp5_ = _tmp4_.id;
				if (g_strcmp0 (_tmp5_, name) == 0) {
					result = index;
					return result;
				}
			}
		}
	}
	result = -1;
	return result;
}

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

static void
portal_global_shortcuts_provider_create_session (PortalGlobalShortcutsProvider* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	PortalGlobalShortcutsProviderCreateSessionData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderCreateSessionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_create_session_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_global_shortcuts_provider_create_session_co (_data_);
}

static void
portal_global_shortcuts_provider_create_session_finish (PortalGlobalShortcutsProvider* self,
                                                        GAsyncResult* _res_,
                                                        GError** error)
{
	PortalGlobalShortcutsProviderCreateSessionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block4Data*
block4_data_ref (Block4Data* _data4_)
{
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}

static void
block4_data_unref (void * _userdata_)
{
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		PortalGlobalShortcutsProvider* self;
		self = _data4_->self;
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}

static void
___lambda8_ (Block4Data* _data4_,
             guint32 response,
             GVariant* results)
{
	PortalGlobalShortcutsProvider* self;
	GVariant* session_handle_variant = NULL;
	GVariant* _tmp0_;
	GVariant* _tmp1_;
	self = _data4_->self;
	g_return_if_fail (results != NULL);
	_tmp0_ = g_variant_lookup_value (results, "session_handle", NULL);
	session_handle_variant = _tmp0_;
	_tmp1_ = session_handle_variant;
	if (_tmp1_ != NULL) {
		GVariant* _tmp2_;
		const gchar* _tmp3_;
		char* _tmp4_;
		_tmp2_ = session_handle_variant;
		_tmp3_ = g_variant_get_string (_tmp2_, NULL);
		_tmp4_ = g_strdup (_tmp3_);
		_g_free0 (self->priv->session_handle);
		self->priv->session_handle = _tmp4_;
		self->priv->bound_shortcuts = FALSE;
	}
	portal_global_shortcuts_provider_create_session_co (_data4_->_async_data_);
	_g_variant_unref0 (session_handle_variant);
}

static void
____lambda8__portal_request_callback (guint32 response,
                                      GVariant* results,
                                      gpointer self)
{
	___lambda8_ (self, response, results);
}

static void
portal_global_shortcuts_provider_create_session_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	PortalGlobalShortcutsProviderCreateSessionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_global_shortcuts_provider_create_session_co (_data_);
}

static gboolean
portal_global_shortcuts_provider_create_session_co (PortalGlobalShortcutsProviderCreateSessionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data4_ = g_slice_new0 (Block4Data);
	_data_->_data4_->_ref_count_ = 1;
	_data_->_data4_->self = g_object_ref (_data_->self);
	_data_->_data4_->_async_data_ = _data_;
	_data_->timestamp = ft_timestamp_to_seconds_uint32 (ft_timestamp_from_now ());
	{
		_data_->_tmp0_ = _data_->self->priv->connection;
		_data_->_state_ = 1;
		portal_create_request (_data_->_tmp0_, ____lambda8__portal_request_callback, _data_->_data4_, portal_global_shortcuts_provider_create_session_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = portal_create_request_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->handle_token = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->self->priv->proxy;
		if (_data_->_tmp2_ == NULL) {
			_data_->_tmp3_ = _data_->handle_token;
			portal_destroy_request (_data_->_tmp3_);
			_data_->_tmp4_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION, "Provider disabled during request");
			_data_->_inner_error0_ = _data_->_tmp4_;
			_g_free0 (_data_->handle_token);
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = g_variant_dict_new (NULL);
		_data_->options = _data_->_tmp5_;
		_data_->_tmp6_ = _data_->options;
		_data_->_tmp7_ = _data_->handle_token;
		_data_->_tmp8_ = g_variant_new_string (_data_->_tmp7_);
		g_variant_ref_sink (_data_->_tmp8_);
		_data_->_tmp9_ = _data_->_tmp8_;
		g_variant_dict_insert_value (_data_->_tmp6_, "handle_token", _data_->_tmp9_);
		_g_variant_unref0 (_data_->_tmp9_);
		_data_->_tmp10_ = _data_->options;
		_data_->_tmp11_ = g_strdup_printf ("%u", _data_->timestamp);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = g_strconcat ("focustimer_", _data_->_tmp12_, NULL);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = g_variant_new_string (_data_->_tmp14_);
		g_variant_ref_sink (_data_->_tmp15_);
		_data_->_tmp16_ = _data_->_tmp15_;
		g_variant_dict_insert_value (_data_->_tmp10_, "session_handle_token", _data_->_tmp16_);
		_g_variant_unref0 (_data_->_tmp16_);
		_g_free0 (_data_->_tmp14_);
		_g_free0 (_data_->_tmp12_);
		_data_->_tmp17_ = _data_->self->priv->proxy;
		_data_->_tmp18_ = _data_->options;
		_data_->_tmp19_ = g_variant_dict_end (_data_->_tmp18_);
		g_variant_ref_sink (_data_->_tmp19_);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_state_ = 2;
		portal_global_shortcuts_create_session (_data_->_tmp17_, _data_->_tmp20_, portal_global_shortcuts_provider_create_session_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp21_ = portal_global_shortcuts_create_session_finish (_data_->_tmp17_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_g_free0 (_data_->_tmp22_);
		_g_variant_unref0 (_data_->_tmp20_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_variant_dict_unref0 (_data_->options);
			_g_free0 (_data_->handle_token);
			goto __catch0_g_error;
		}
		_data_->_state_ = 3;
		return FALSE;
		_state_3:
		;
		_g_variant_dict_unref0 (_data_->options);
		_g_free0 (_data_->handle_token);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp23_ = _data_->_error_;
		_data_->_tmp24_ = _data_->_tmp23_->message;
		_data_->_tmp25_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION, _data_->_tmp24_);
		_data_->_inner_error0_ = _data_->_tmp25_;
		_g_error_free0 (_data_->_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == PORTAL_GLOBAL_SHORTCUTS_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block4_data_unref (_data_->_data4_);
			_data_->_data4_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			block4_data_unref (_data_->_data4_);
			_data_->_data4_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp26_ = _data_->self->priv->session_handle;
	if (_data_->_tmp26_ == NULL) {
		_data_->_tmp27_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_CREATE_SESSION, "No session_handle in response");
		_data_->_inner_error0_ = _data_->_tmp27_;
		if (_data_->_inner_error0_->domain == PORTAL_GLOBAL_SHORTCUTS_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block4_data_unref (_data_->_data4_);
			_data_->_data4_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			block4_data_unref (_data_->_data4_);
			_data_->_data4_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	block4_data_unref (_data_->_data4_);
	_data_->_data4_ = 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
portal_global_shortcuts_provider_bind_shortcuts_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderBindShortcutsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderBindShortcutsData, _data_);
}

static void
portal_global_shortcuts_provider_bind_shortcuts (PortalGlobalShortcutsProvider* self,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	PortalGlobalShortcutsProviderBindShortcutsData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderBindShortcutsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_bind_shortcuts_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_global_shortcuts_provider_bind_shortcuts_co (_data_);
}

static void
portal_global_shortcuts_provider_bind_shortcuts_finish (PortalGlobalShortcutsProvider* self,
                                                        GAsyncResult* _res_,
                                                        GError** error)
{
	PortalGlobalShortcutsProviderBindShortcutsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
         * Bind (register) shortcuts
         *
         * It needs to be called once per session for the shortcuts to work, even if they have been
         * registered before.
         *
         * Binding shortcuts may show a dialog. Initially, we delay it until `open_edit_dialog()`
         * is used. Once `mark_as_configured()` is called, we may use `bind_shortcuts` at app
         * startup and enjoy the shortcuts without seeing the dialog. It will still show up when
         * new shortcuts are introduced.
         */
static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		PortalGlobalShortcutsProvider* self;
		self = _data5_->self;
		_g_variant_unref0 (_data5_->shortcuts_variant);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static void
portal_global_shortcuts_provider_bind_shortcuts_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	PortalGlobalShortcutsProviderBindShortcutsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_global_shortcuts_provider_bind_shortcuts_co (_data_);
}

static void
___lambda9_ (Block5Data* _data5_,
             guint32 response,
             GVariant* results)
{
	PortalGlobalShortcutsProvider* self;
	GVariant* _tmp0_;
	self = _data5_->self;
	g_return_if_fail (results != NULL);
	_tmp0_ = g_variant_lookup_value (results, "shortcuts", NULL);
	_g_variant_unref0 (_data5_->shortcuts_variant);
	_data5_->shortcuts_variant = _tmp0_;
	portal_global_shortcuts_provider_bind_shortcuts_co (_data5_->_async_data_);
}

static void
____lambda9__portal_request_callback (guint32 response,
                                      GVariant* results,
                                      gpointer self)
{
	___lambda9_ (self, response, results);
}

static gboolean
portal_global_shortcuts_provider_bind_shortcuts_co (PortalGlobalShortcutsProviderBindShortcutsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data5_ = g_slice_new0 (Block5Data);
	_data_->_data5_->_ref_count_ = 1;
	_data_->_data5_->self = g_object_ref (_data_->self);
	_data_->_data5_->_async_data_ = _data_;
	_data_->_data5_->shortcuts_variant = NULL;
	_data_->_tmp0_ = _data_->self->priv->shortcuts;
	_data_->_tmp0__length1 = _data_->self->priv->shortcuts_length1;
	if (_data_->_tmp0__length1 == 0) {
		_g_free0 (_data_->handle_token);
		block5_data_unref (_data_->_data5_);
		_data_->_data5_ = 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;
	}
	if (_data_->self->priv->bind_shortcuts_idle_id != ((guint) 0)) {
		g_source_remove (_data_->self->priv->bind_shortcuts_idle_id);
		_data_->self->priv->bind_shortcuts_idle_id = (guint) 0;
	}
	_data_->_tmp2_ = _data_->self->priv->session_handle;
	if (_data_->_tmp2_ == NULL) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp1_ = _data_->self->priv->bound_shortcuts;
	}
	if (_data_->_tmp1_) {
		_data_->_state_ = 1;
		portal_global_shortcuts_provider_create_session (_data_->self, portal_global_shortcuts_provider_bind_shortcuts_ready, _data_);
		return FALSE;
		_state_1:
		portal_global_shortcuts_provider_create_session_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == PORTAL_GLOBAL_SHORTCUTS_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->handle_token);
				block5_data_unref (_data_->_data5_);
				_data_->_data5_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_free0 (_data_->handle_token);
				block5_data_unref (_data_->_data5_);
				_data_->_data5_ = NULL;
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	{
		_data_->_tmp4_ = _data_->self->priv->connection;
		_data_->_state_ = 2;
		portal_create_request (_data_->_tmp4_, ____lambda9__portal_request_callback, _data_->_data5_, portal_global_shortcuts_provider_bind_shortcuts_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp5_ = portal_create_request_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp3_ = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->_tmp3_;
		_data_->_tmp3_ = NULL;
		_g_free0 (_data_->handle_token);
		_data_->handle_token = _data_->_tmp6_;
		_g_free0 (_data_->_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->_error_;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		_data_->_tmp9_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_REQUEST, _data_->_tmp8_);
		_data_->_inner_error0_ = _data_->_tmp9_;
		_g_error_free0 (_data_->_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == PORTAL_GLOBAL_SHORTCUTS_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->handle_token);
			block5_data_unref (_data_->_data5_);
			_data_->_data5_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->handle_token);
			block5_data_unref (_data_->_data5_);
			_data_->_data5_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp10_ = _data_->self->priv->proxy;
	g_signal_handler_block (_data_->_tmp10_, _data_->self->priv->shortcuts_changed_id);
	{
		_data_->_tmp11_ = g_variant_dict_new (NULL);
		_data_->options = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->options;
		_data_->_tmp13_ = _data_->handle_token;
		_data_->_tmp14_ = g_variant_new_string (_data_->_tmp13_);
		g_variant_ref_sink (_data_->_tmp14_);
		_data_->_tmp15_ = _data_->_tmp14_;
		g_variant_dict_insert_value (_data_->_tmp12_, "handle_token", _data_->_tmp15_);
		_g_variant_unref0 (_data_->_tmp15_);
		_data_->_tmp16_ = _data_->self->priv->shortcuts;
		_data_->_tmp16__length1 = _data_->self->priv->shortcuts_length1;
		_data_->_tmp17_ = 0;
		_data_->_tmp18_ = portal_global_shortcuts_provider_format_shortcuts (_data_->self, _data_->_tmp16_, (gint) _data_->_tmp16__length1, &_data_->_tmp17_);
		_data_->shortcuts = _data_->_tmp18_;
		_data_->shortcuts_length1 = _data_->_tmp17_;
		_data_->_shortcuts_size_ = _data_->shortcuts_length1;
		_data_->_tmp19_ = _data_->self->priv->proxy;
		_data_->_tmp20_ = _data_->self->priv->session_handle;
		_data_->_tmp21_ = _data_->shortcuts;
		_data_->_tmp21__length1 = _data_->shortcuts_length1;
		_data_->_tmp22_ = portal_serialize_shortcuts (_data_->_tmp21_, (gint) _data_->_tmp21__length1);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->options;
		_data_->_tmp25_ = g_variant_dict_end (_data_->_tmp24_);
		g_variant_ref_sink (_data_->_tmp25_);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_state_ = 3;
		portal_global_shortcuts_bind_shortcuts (_data_->_tmp19_, _data_->_tmp20_, _data_->_tmp23_, "", _data_->_tmp26_, portal_global_shortcuts_provider_bind_shortcuts_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp27_ = portal_global_shortcuts_bind_shortcuts_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_g_free0 (_data_->_tmp28_);
		_g_variant_unref0 (_data_->_tmp26_);
		_g_variant_unref0 (_data_->_tmp23_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->shortcuts = (_vala_PortalShortcut_array_free (_data_->shortcuts, _data_->shortcuts_length1), NULL);
			_g_variant_dict_unref0 (_data_->options);
			goto __catch1_g_error;
		}
		_data_->self->priv->bound_shortcuts = TRUE;
		_data_->_state_ = 4;
		return FALSE;
		_state_4:
		;
		portal_global_shortcuts_provider_mark_as_configured (_data_->self);
		_data_->_tmp29_ = _data_->_data5_->shortcuts_variant;
		if (_data_->_tmp29_ != NULL) {
			_data_->_tmp30_ = _data_->_data5_->shortcuts_variant;
			portal_global_shortcuts_provider_update_accelerators (_data_->self, _data_->_tmp30_);
		}
		_data_->shortcuts = (_vala_PortalShortcut_array_free (_data_->shortcuts, _data_->shortcuts_length1), NULL);
		_g_variant_dict_unref0 (_data_->options);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1__error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp31_ = _data_->_vala1__error_;
		_data_->_tmp32_ = _data_->_tmp31_->message;
		_data_->_tmp33_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_BIND_SHORTCUTS, _data_->_tmp32_);
		_data_->_inner_error0_ = _data_->_tmp33_;
		_g_error_free0 (_data_->_vala1__error_);
		goto __finally1;
	}
	__finally1:
	{
		_data_->_tmp34_ = _data_->self->priv->proxy;
		g_signal_handler_unblock (_data_->_tmp34_, _data_->self->priv->shortcuts_changed_id);
	}
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == PORTAL_GLOBAL_SHORTCUTS_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->handle_token);
			block5_data_unref (_data_->_data5_);
			_data_->_data5_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->handle_token);
			block5_data_unref (_data_->_data5_);
			_data_->_data5_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_g_free0 (_data_->handle_token);
	block5_data_unref (_data_->_data5_);
	_data_->_data5_ = 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
__lambda11_ (PortalGlobalShortcutsProvider* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		portal_global_shortcuts_provider_bind_shortcuts_finish (self, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = _error_;
		_tmp1_ = _tmp0_->message;
		g_warning ("global-shortcuts-provider.vala:524: Error while binding shortcuts: %s", _tmp1_);
		_g_error_free0 (_error_);
	}
	__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
___lambda11__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda11_ ((PortalGlobalShortcutsProvider*) self, source_object, res);
	g_object_unref (self);
}

static gboolean
__lambda10_ (PortalGlobalShortcutsProvider* self)
{
	gboolean result;
	self->priv->bind_shortcuts_idle_id = (guint) 0;
	portal_global_shortcuts_provider_bind_shortcuts (self, ___lambda11__gasync_ready_callback, g_object_ref (self));
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda10__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda10_ ((PortalGlobalShortcutsProvider*) self);
	return result;
}

static void
portal_global_shortcuts_provider_schedule_bind_shortcuts (PortalGlobalShortcutsProvider* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->bind_shortcuts_idle_id != ((guint) 0)) {
		return;
	}
	self->priv->bind_shortcuts_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda10__gsource_func, g_object_ref (self), g_object_unref);
	g_source_set_name_by_id (self->priv->bind_shortcuts_idle_id, "Portal.GlobalShortcutsProvider.bind_shortcuts");
}

static void
portal_global_shortcuts_provider_on_name_appeared (PortalGlobalShortcutsProvider* self,
                                                   GDBusConnection* connection,
                                                   const gchar* name,
                                                   const gchar* name_owner)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (connection != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (name_owner != NULL);
	if (portal_has_dbus_interface (connection, name, "/org/freedesktop/portal/desktop", "org.freedesktop.portal.GlobalShortcuts", -1)) {
		GDBusConnection* _tmp0_;
		ft_provider_set_available ((FtProvider*) self, TRUE);
		_tmp0_ = _g_object_ref0 (connection);
		_g_object_unref0 (self->priv->connection);
		self->priv->connection = _tmp0_;
	}
}

static void
portal_global_shortcuts_provider_on_name_vanished (PortalGlobalShortcutsProvider* self,
                                                   GDBusConnection* connection,
                                                   const gchar* name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	ft_provider_set_available ((FtProvider*) self, FALSE);
	_g_object_unref0 (self->priv->connection);
	self->priv->connection = NULL;
}

static void
portal_global_shortcuts_provider_on_activated (PortalGlobalShortcutsProvider* self,
                                               const char* session_handle,
                                               const gchar* shortcut_id,
                                               guint64 timestamp,
                                               GVariant* options)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (session_handle != NULL);
	g_return_if_fail (shortcut_id != NULL);
	g_return_if_fail (options != NULL);
	g_signal_emit_by_name ((FtGlobalShortcutsProvider*) self, "shortcut-activated", shortcut_id);
}

/**
         * `ShortcutsChanged` handler
         *
         * `shortcuts` is the list of currently active shortcuts.
         */
static void
portal_global_shortcuts_provider_on_shortcuts_changed (PortalGlobalShortcutsProvider* self,
                                                       const char* session_handle,
                                                       GVariant* shortcuts)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (session_handle != NULL);
	g_return_if_fail (shortcuts != NULL);
	portal_global_shortcuts_provider_update_accelerators (self, shortcuts);
}

static void
_vala_array_add12 (PortalShortcut* * array,
                   gint* length,
                   gint* size,
                   const PortalShortcut* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PortalShortcut, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static void
portal_global_shortcuts_provider_real_add_shortcut (FtGlobalShortcutsProvider* base,
                                                    const gchar* name,
                                                    const gchar* description,
                                                    const gchar* default_accelerator)
{
	PortalGlobalShortcutsProvider * self;
	const char* _tmp0_;
	PortalShortcut shortcut = {0};
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	PortalShortcut _tmp4_ = {0};
	gint index = 0;
	PortalShortcut _tmp5_;
	const gchar* _tmp6_;
	self = (PortalGlobalShortcutsProvider*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (description != NULL);
	g_return_if_fail (default_accelerator != NULL);
	_tmp0_ = self->priv->session_handle;
	_vala_return_if_fail (_tmp0_ != NULL, "this.session_handle != null");
	_tmp1_ = g_strdup (name);
	_tmp2_ = g_strdup (description);
	_tmp3_ = g_strdup (default_accelerator);
	memset (&_tmp4_, 0, sizeof (PortalShortcut));
	_g_free0 (_tmp4_.id);
	_tmp4_.id = _tmp1_;
	_g_free0 (_tmp4_.description);
	_tmp4_.description = _tmp2_;
	_g_free0 (_tmp4_.preferred_trigger);
	_tmp4_.preferred_trigger = _tmp3_;
	shortcut = _tmp4_;
	_tmp5_ = shortcut;
	_tmp6_ = _tmp5_.id;
	index = portal_global_shortcuts_provider_find_shortcut (self, _tmp6_);
	if (index >= 0) {
		PortalShortcut* _tmp7_;
		gint _tmp7__length1;
		PortalShortcut _tmp8_;
		PortalShortcut _tmp9_;
		PortalShortcut _tmp10_ = {0};
		_tmp7_ = self->priv->shortcuts;
		_tmp7__length1 = self->priv->shortcuts_length1;
		_tmp8_ = shortcut;
		_tmp9_ = _tmp8_;
		portal_shortcut_copy (&_tmp9_, &_tmp10_);
		portal_shortcut_destroy (&_tmp7_[index]);
		_tmp7_[index] = _tmp10_;
	} else {
		PortalShortcut _tmp11_;
		PortalShortcut _tmp12_;
		PortalShortcut _tmp13_ = {0};
		_tmp11_ = shortcut;
		_tmp12_ = _tmp11_;
		portal_shortcut_copy (&_tmp12_, &_tmp13_);
		_vala_array_add12 (&self->priv->shortcuts, &self->priv->shortcuts_length1, &self->priv->_shortcuts_size_, &_tmp13_);
	}
	if (self->priv->is_configured) {
		portal_global_shortcuts_provider_schedule_bind_shortcuts (self);
	}
	portal_shortcut_destroy (&shortcut);
}

static gchar*
portal_global_shortcuts_provider_real_lookup_accelerator (FtGlobalShortcutsProvider* base,
                                                          const gchar* name)
{
	PortalGlobalShortcutsProvider * self;
	const gchar* _tmp0_ = NULL;
	GHashTable* _tmp1_;
	gchar* _tmp5_;
	gchar* result;
	self = (PortalGlobalShortcutsProvider*) base;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp1_ = self->priv->accelerators;
	if (_tmp1_ != NULL) {
		const gchar* _tmp2_ = NULL;
		GHashTable* _tmp3_;
		gconstpointer _tmp4_;
		_tmp3_ = self->priv->accelerators;
		_tmp4_ = g_hash_table_lookup (_tmp3_, name);
		_tmp2_ = (const gchar*) _tmp4_;
		if (_tmp2_ == NULL) {
			_tmp2_ = "";
		}
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = "";
	}
	_tmp5_ = g_strdup (_tmp0_);
	result = _tmp5_;
	return result;
}

static void
portal_global_shortcuts_provider_real_open_edit_dialog_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderOpenEditDialogData* _data_;
	_data_ = _data;
	_g_free0 (_data_->window_identifier);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderOpenEditDialogData, _data_);
}

static void
portal_global_shortcuts_provider_real_open_edit_dialog (FtGlobalShortcutsProvider* base,
                                                        const gchar* window_identifier,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	PortalGlobalShortcutsProvider * self;
	PortalGlobalShortcutsProviderOpenEditDialogData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (window_identifier != NULL);
	self = (PortalGlobalShortcutsProvider*) base;
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderOpenEditDialogData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_real_open_edit_dialog_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (window_identifier);
	_g_free0 (_data_->window_identifier);
	_data_->window_identifier = _tmp1_;
	portal_global_shortcuts_provider_real_open_edit_dialog_co (_data_);
}

static void
portal_global_shortcuts_provider_open_edit_dialog_finish (FtGlobalShortcutsProvider* base,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	PortalGlobalShortcutsProviderOpenEditDialogData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		PortalGlobalShortcutsProvider* self;
		self = _data6_->self;
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
___lambda12_ (Block6Data* _data6_,
              guint32 response,
              GVariant* results)
{
	PortalGlobalShortcutsProvider* self;
	self = _data6_->self;
	g_return_if_fail (results != NULL);
	portal_global_shortcuts_provider_real_open_edit_dialog_co (_data6_->_async_data_);
}

static void
____lambda12__portal_request_callback (guint32 response,
                                       GVariant* results,
                                       gpointer self)
{
	___lambda12_ (self, response, results);
}

static void
portal_global_shortcuts_provider_open_edit_dialog_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_)
{
	PortalGlobalShortcutsProviderOpenEditDialogData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_global_shortcuts_provider_real_open_edit_dialog_co (_data_);
}

static void
_vala_array_add13 (PortalShortcut* * array,
                   gint* length,
                   gint* size,
                   const PortalShortcut* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (PortalShortcut, *array, *size);
	}
	(*array)[(*length)++] = *value;
}

static gboolean
portal_global_shortcuts_provider_real_open_edit_dialog_co (PortalGlobalShortcutsProviderOpenEditDialogData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		case 7:
		goto _state_7;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data6_ = g_slice_new0 (Block6Data);
	_data_->_data6_->_ref_count_ = 1;
	_data_->_data6_->self = g_object_ref (_data_->self);
	_data_->_data6_->_async_data_ = _data_;
	_data_->_tmp1_ = _data_->self->priv->proxy;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = TRUE;
	} else {
		_data_->_tmp2_ = _data_->self->priv->shortcuts;
		_data_->_tmp2__length1 = _data_->self->priv->shortcuts_length1;
		_data_->_tmp0_ = _data_->_tmp2__length1 == 0;
	}
	if (_data_->_tmp0_) {
		_g_free0 (_data_->handle_token);
		block6_data_unref (_data_->_data6_);
		_data_->_data6_ = 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;
	}
	if (_data_->self->priv->bind_shortcuts_idle_id != ((guint) 0)) {
		g_source_remove (_data_->self->priv->bind_shortcuts_idle_id);
		_data_->self->priv->bind_shortcuts_idle_id = (guint) 0;
	}
	{
		_data_->_tmp4_ = _data_->self->priv->connection;
		_data_->_state_ = 1;
		portal_create_request (_data_->_tmp4_, ____lambda12__portal_request_callback, _data_->_data6_, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp5_ = portal_create_request_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp3_ = _data_->_tmp5_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp6_ = _data_->_tmp3_;
		_data_->_tmp3_ = NULL;
		_g_free0 (_data_->handle_token);
		_data_->handle_token = _data_->_tmp6_;
		_g_free0 (_data_->_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->_error_;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		_data_->_tmp9_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_REQUEST, _data_->_tmp8_);
		_data_->_inner_error0_ = _data_->_tmp9_;
		_g_error_free0 (_data_->_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->handle_token);
		block6_data_unref (_data_->_data6_);
		_data_->_data6_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp10_ = g_variant_dict_new (NULL);
	_data_->options = _data_->_tmp10_;
	_data_->_tmp11_ = _data_->options;
	_data_->_tmp12_ = _data_->handle_token;
	_data_->_tmp13_ = g_variant_new_string (_data_->_tmp12_);
	g_variant_ref_sink (_data_->_tmp13_);
	_data_->_tmp14_ = _data_->_tmp13_;
	g_variant_dict_insert_value (_data_->_tmp11_, "handle_token", _data_->_tmp14_);
	_g_variant_unref0 (_data_->_tmp14_);
	_data_->_tmp15_ = _data_->options;
	_data_->_tmp16_ = g_variant_dict_end (_data_->_tmp15_);
	g_variant_ref_sink (_data_->_tmp16_);
	_data_->options_variant = _data_->_tmp16_;
	_data_->_tmp18_ = _data_->self->priv->proxy;
	_data_->_tmp19_ = portal_global_shortcuts_get_version (_data_->_tmp18_);
	_data_->_tmp20_ = _data_->_tmp19_;
	if (_data_->_tmp20_ >= ((guint32) 2)) {
		_data_->_tmp21_ = _data_->self->priv->proxy;
		_data_->_tmp17_ = portal_has_dbus_method (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp21_, g_dbus_proxy_get_type (), GDBusProxy), "ConfigureShortcuts");
	} else {
		_data_->_tmp17_ = FALSE;
	}
	_data_->has_configure_shortcuts = _data_->_tmp17_;
	if (_data_->has_configure_shortcuts) {
		_data_->_tmp22_ = _data_->self->priv->is_configured;
	} else {
		_data_->_tmp22_ = FALSE;
	}
	if (_data_->_tmp22_) {
		_data_->_tmp23_ = _data_->self->priv->session_handle;
		if (_data_->_tmp23_ == NULL) {
			_data_->_state_ = 2;
			portal_global_shortcuts_provider_create_session (_data_->self, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
			return FALSE;
			_state_2:
			portal_global_shortcuts_provider_create_session_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_variant_unref0 (_data_->options_variant);
				_g_variant_dict_unref0 (_data_->options);
				_g_free0 (_data_->handle_token);
				block6_data_unref (_data_->_data6_);
				_data_->_data6_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		if (!_data_->self->priv->bound_shortcuts) {
			_data_->_state_ = 3;
			portal_global_shortcuts_provider_bind_shortcuts (_data_->self, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
			return FALSE;
			_state_3:
			portal_global_shortcuts_provider_bind_shortcuts_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_variant_unref0 (_data_->options_variant);
				_g_variant_dict_unref0 (_data_->options);
				_g_free0 (_data_->handle_token);
				block6_data_unref (_data_->_data6_);
				_data_->_data6_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		{
			_data_->_tmp24_ = _data_->self->priv->proxy;
			_data_->_tmp25_ = _data_->self->priv->session_handle;
			_data_->_tmp26_ = _data_->options_variant;
			_data_->_state_ = 4;
			portal_global_shortcuts_configure_shortcuts (_data_->_tmp24_, _data_->_tmp25_, _data_->window_identifier, _data_->_tmp26_, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
			return FALSE;
			_state_4:
			portal_global_shortcuts_configure_shortcuts_finish (_data_->_tmp24_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch1_g_error;
			}
		}
		goto __finally1;
		__catch1_g_error:
		{
			_data_->_vala1__error_ = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp27_ = _data_->_vala1__error_;
			_data_->_tmp28_ = _data_->_tmp27_->message;
			_data_->_tmp29_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_CONFIGURE_SHORTCUTS, _data_->_tmp28_);
			_data_->_tmp30_ = _data_->_tmp29_;
			_g_error_free0 (_data_->_tmp30_);
			_g_error_free0 (_data_->_vala1__error_);
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_variant_unref0 (_data_->options_variant);
			_g_variant_dict_unref0 (_data_->options);
			_g_free0 (_data_->handle_token);
			block6_data_unref (_data_->_data6_);
			_data_->_data6_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	} else {
		_data_->_tmp32_ = _data_->self->priv->session_handle;
		if (_data_->_tmp32_ == NULL) {
			_data_->_tmp31_ = TRUE;
		} else {
			_data_->_tmp31_ = _data_->self->priv->bound_shortcuts;
		}
		if (_data_->_tmp31_) {
			_data_->_state_ = 5;
			portal_global_shortcuts_provider_create_session (_data_->self, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
			return FALSE;
			_state_5:
			portal_global_shortcuts_provider_create_session_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_variant_unref0 (_data_->options_variant);
				_g_variant_dict_unref0 (_data_->options);
				_g_free0 (_data_->handle_token);
				block6_data_unref (_data_->_data6_);
				_data_->_data6_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		{
			_data_->_tmp33_ = _data_->self->priv->shortcuts;
			_data_->_tmp33__length1 = _data_->self->priv->shortcuts_length1;
			_data_->_tmp34_ = 0;
			_data_->_tmp35_ = portal_global_shortcuts_provider_format_shortcuts (_data_->self, _data_->_tmp33_, (gint) _data_->_tmp33__length1, &_data_->_tmp34_);
			_data_->shortcuts = _data_->_tmp35_;
			_data_->shortcuts_length1 = _data_->_tmp34_;
			_data_->_shortcuts_size_ = _data_->shortcuts_length1;
			if (!_data_->has_configure_shortcuts) {
				memset (&_data_->_tmp36_, 0, sizeof (PortalShortcut));
				portal_global_shortcuts_provider_create_extra_shortcut (_data_->self, &_data_->_tmp36_);
				_vala_array_add13 (&_data_->shortcuts, &_data_->shortcuts_length1, &_data_->_shortcuts_size_, &_data_->_tmp36_);
			}
			_data_->_tmp37_ = _data_->self->priv->proxy;
			_data_->_tmp38_ = _data_->self->priv->session_handle;
			_data_->_tmp39_ = _data_->shortcuts;
			_data_->_tmp39__length1 = _data_->shortcuts_length1;
			_data_->_tmp40_ = portal_serialize_shortcuts (_data_->_tmp39_, (gint) _data_->_tmp39__length1);
			_data_->_tmp41_ = _data_->_tmp40_;
			_data_->_tmp42_ = _data_->options_variant;
			_data_->_state_ = 6;
			portal_global_shortcuts_bind_shortcuts (_data_->_tmp37_, _data_->_tmp38_, _data_->_tmp41_, _data_->window_identifier, _data_->_tmp42_, portal_global_shortcuts_provider_open_edit_dialog_ready, _data_);
			return FALSE;
			_state_6:
			_data_->_tmp43_ = portal_global_shortcuts_bind_shortcuts_finish (_data_->_tmp37_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp44_ = _data_->_tmp43_;
			_g_free0 (_data_->_tmp44_);
			_g_variant_unref0 (_data_->_tmp41_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_data_->shortcuts = (_vala_PortalShortcut_array_free (_data_->shortcuts, _data_->shortcuts_length1), NULL);
				goto __catch2_g_error;
			}
			_data_->self->priv->bound_shortcuts = TRUE;
			portal_global_shortcuts_provider_mark_as_configured (_data_->self);
			_data_->shortcuts = (_vala_PortalShortcut_array_free (_data_->shortcuts, _data_->shortcuts_length1), NULL);
		}
		goto __finally2;
		__catch2_g_error:
		{
			_data_->_vala2__error_ = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp45_ = _data_->_vala2__error_;
			_data_->_tmp46_ = _data_->_tmp45_->message;
			_data_->_tmp47_ = g_error_new_literal (PORTAL_GLOBAL_SHORTCUTS_ERROR, PORTAL_GLOBAL_SHORTCUTS_ERROR_BIND_SHORTCUTS, _data_->_tmp46_);
			_data_->_tmp48_ = _data_->_tmp47_;
			_g_error_free0 (_data_->_tmp48_);
			_g_error_free0 (_data_->_vala2__error_);
		}
		__finally2:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_variant_unref0 (_data_->options_variant);
			_g_variant_dict_unref0 (_data_->options);
			_g_free0 (_data_->handle_token);
			block6_data_unref (_data_->_data6_);
			_data_->_data6_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_state_ = 7;
	return FALSE;
	_state_7:
	;
	_g_variant_unref0 (_data_->options_variant);
	_g_variant_dict_unref0 (_data_->options);
	_g_free0 (_data_->handle_token);
	block6_data_unref (_data_->_data6_);
	_data_->_data6_ = 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
portal_global_shortcuts_provider_real_initialize_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderInitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderInitializeData, _data_);
}

static void
portal_global_shortcuts_provider_real_initialize (FtProvider* base,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	PortalGlobalShortcutsProvider * self;
	PortalGlobalShortcutsProviderInitializeData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (PortalGlobalShortcutsProvider*) base;
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_real_initialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	portal_global_shortcuts_provider_real_initialize_co (_data_);
}

static void
portal_global_shortcuts_provider_initialize_finish (FtProvider* base,
                                                    GAsyncResult* _res_,
                                                    GError** error)
{
	PortalGlobalShortcutsProviderInitializeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_portal_global_shortcuts_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                const gchar* name,
                                                                                const gchar* name_owner,
                                                                                gpointer self)
{
	portal_global_shortcuts_provider_on_name_appeared ((PortalGlobalShortcutsProvider*) self, connection, name, name_owner);
}

static void
_portal_global_shortcuts_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                const gchar* name,
                                                                                gpointer self)
{
	portal_global_shortcuts_provider_on_name_vanished ((PortalGlobalShortcutsProvider*) self, connection, name);
}

static gboolean
portal_global_shortcuts_provider_real_initialize_co (PortalGlobalShortcutsProviderInitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_new0 (PortalShortcut, 0);
	_data_->self->priv->shortcuts = (_vala_PortalShortcut_array_free (_data_->self->priv->shortcuts, _data_->self->priv->shortcuts_length1), NULL);
	_data_->self->priv->shortcuts = _data_->_tmp0_;
	_data_->self->priv->shortcuts_length1 = 0;
	_data_->self->priv->_shortcuts_size_ = _data_->self->priv->shortcuts_length1;
	if (_data_->self->priv->dbus_watcher_id == ((guint) 0)) {
		_data_->self->priv->dbus_watcher_id = g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, "org.freedesktop.portal.Desktop", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_portal_global_shortcuts_provider_on_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _portal_global_shortcuts_provider_on_name_appeared_gbus_name_appeared_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)), (GClosure*) ((_portal_global_shortcuts_provider_on_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _portal_global_shortcuts_provider_on_name_vanished_gbus_name_vanished_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)));
	}
	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
portal_global_shortcuts_provider_real_enable_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderEnableData, _data_);
}

static void
portal_global_shortcuts_provider_real_enable (FtProvider* base,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	PortalGlobalShortcutsProvider * self;
	PortalGlobalShortcutsProviderEnableData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (PortalGlobalShortcutsProvider*) base;
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_real_enable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	portal_global_shortcuts_provider_real_enable_co (_data_);
}

static void
portal_global_shortcuts_provider_enable_finish (FtProvider* base,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	PortalGlobalShortcutsProviderEnableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
portal_global_shortcuts_provider_enable_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	PortalGlobalShortcutsProviderEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_global_shortcuts_provider_real_enable_co (_data_);
}

static void
_portal_global_shortcuts_provider_on_activated_portal_global_shortcuts_activated (PortalGlobalShortcuts* _sender,
                                                                                  const char* session_handle,
                                                                                  const gchar* shortcut_id,
                                                                                  guint64 timestamp,
                                                                                  GVariant* options,
                                                                                  gpointer self)
{
	portal_global_shortcuts_provider_on_activated ((PortalGlobalShortcutsProvider*) self, session_handle, shortcut_id, timestamp, options);
}

static void
_portal_global_shortcuts_provider_on_shortcuts_changed_portal_global_shortcuts_shortcuts_changed (PortalGlobalShortcuts* _sender,
                                                                                                  const char* session_handle,
                                                                                                  GVariant* shortcuts,
                                                                                                  gpointer self)
{
	portal_global_shortcuts_provider_on_shortcuts_changed ((PortalGlobalShortcutsProvider*) self, session_handle, shortcuts);
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static gboolean
portal_global_shortcuts_provider_real_enable_co (PortalGlobalShortcutsProviderEnableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp2_ = _data_->self->priv->proxy;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->self->priv->cancellable;
		_data_->_tmp1_ = _data_->_tmp3_ != NULL;
	} else {
		_data_->_tmp1_ = FALSE;
	}
	if (_data_->_tmp1_) {
		_data_->_tmp4_ = _data_->self->priv->cancellable;
		_data_->_tmp0_ = !g_cancellable_is_cancelled (_data_->_tmp4_);
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		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;
	}
	if (_data_->cancellable != NULL) {
		_data_->_tmp6_ = _g_object_ref0 (_data_->cancellable);
		_g_object_unref0 (_data_->_tmp5_);
		_data_->_tmp5_ = _data_->_tmp6_;
	} else {
		_data_->_tmp7_ = g_cancellable_new ();
		_g_object_unref0 (_data_->_tmp5_);
		_data_->_tmp5_ = _data_->_tmp7_;
	}
	_data_->_tmp8_ = _data_->_tmp5_;
	_data_->_tmp5_ = NULL;
	_g_object_unref0 (_data_->self->priv->cancellable);
	_data_->self->priv->cancellable = _data_->_tmp8_;
	_data_->_tmp9_ = ft_get_settings ();
	_data_->self->priv->is_configured = g_settings_get_boolean (_data_->_tmp9_, "global-shortcuts-configured");
	{
		_data_->_tmp11_ = _data_->self->priv->cancellable;
		_data_->_state_ = 1;
		g_async_initable_new_async (PORTAL_TYPE_GLOBAL_SHORTCUTS_PROXY, 0, _data_->_tmp11_, portal_global_shortcuts_provider_enable_ready, _data_, "g-flags", G_DBUS_PROXY_FLAGS_NONE, "g-name", "org.freedesktop.portal.Desktop", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/portal/desktop", "g-interface-name", "org.freedesktop.portal.GlobalShortcuts", NULL);
		return FALSE;
		_state_1:
		_data_->_tmp12_ = (PortalGlobalShortcuts*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp10_ = (PortalGlobalShortcuts*) _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp13_ = _data_->_tmp10_;
		_data_->_tmp10_ = NULL;
		_g_object_unref0 (_data_->self->priv->proxy);
		_data_->self->priv->proxy = _data_->_tmp13_;
		_data_->_tmp14_ = _data_->self->priv->proxy;
		g_signal_connect_object (_data_->_tmp14_, "activated", (GCallback) _portal_global_shortcuts_provider_on_activated_portal_global_shortcuts_activated, _data_->self, 0);
		_data_->_tmp15_ = _data_->self->priv->proxy;
		_data_->_tmp16_ = g_signal_connect_object (_data_->_tmp15_, "shortcuts-changed", (GCallback) _portal_global_shortcuts_provider_on_shortcuts_changed_portal_global_shortcuts_shortcuts_changed, _data_->self, 0);
		_data_->self->priv->shortcuts_changed_id = _data_->_tmp16_;
		_data_->_tmp17_ = _data_->self->priv->proxy;
		_data_->_tmp18_ = portal_global_shortcuts_get_version (_data_->_tmp17_);
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = bool_to_string (_data_->self->priv->is_configured);
		_data_->_tmp21_ = _data_->_tmp20_;
		g_info ("global-shortcuts-provider.vala:728: GlobalShortcuts version=%u is_conf" \
"igured=%s", (guint) _data_->_tmp19_, _data_->_tmp21_);
		_g_free0 (_data_->_tmp21_);
		_data_->_state_ = 2;
		portal_global_shortcuts_provider_create_session (_data_->self, portal_global_shortcuts_provider_enable_ready, _data_);
		return FALSE;
		_state_2:
		portal_global_shortcuts_provider_create_session_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->_tmp10_);
			goto __catch0_g_error;
		}
		if (_data_->self->priv->is_configured) {
			_data_->_state_ = 3;
			portal_global_shortcuts_provider_bind_shortcuts (_data_->self, portal_global_shortcuts_provider_enable_ready, _data_);
			return FALSE;
			_state_3:
			portal_global_shortcuts_provider_bind_shortcuts_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->_tmp10_);
				goto __catch0_g_error;
			}
		}
		_g_object_unref0 (_data_->_tmp10_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp22_ = _data_->_error_;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		g_warning ("global-shortcuts-provider.vala:739: Error while creating global shortc" \
"uts session: %s", _data_->_tmp23_);
		_data_->_tmp24_ = _data_->_error_;
		_data_->_tmp25_ = _g_error_copy0 (_data_->_tmp24_);
		_data_->_inner_error0_ = _data_->_tmp25_;
		_g_error_free0 (_data_->_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->_tmp5_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->_tmp5_);
	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
portal_global_shortcuts_provider_real_disable_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderDisableData, _data_);
}

static void
portal_global_shortcuts_provider_real_disable (FtProvider* base,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	PortalGlobalShortcutsProvider * self;
	PortalGlobalShortcutsProviderDisableData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	self = (PortalGlobalShortcutsProvider*) base;
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_global_shortcuts_provider_real_disable_co (_data_);
}

static void
portal_global_shortcuts_provider_disable_finish (FtProvider* base,
                                                 GAsyncResult* _res_,
                                                 GError** error)
{
	PortalGlobalShortcutsProviderDisableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
portal_global_shortcuts_provider_real_disable_co (PortalGlobalShortcutsProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->cancellable;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->cancellable;
		g_cancellable_cancel (_data_->_tmp1_);
	}
	if (_data_->self->priv->bind_shortcuts_idle_id != ((guint) 0)) {
		g_source_remove (_data_->self->priv->bind_shortcuts_idle_id);
		_data_->self->priv->bind_shortcuts_idle_id = (guint) 0;
	}
	_data_->_tmp2_ = _data_->self->priv->proxy;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->self->priv->proxy;
		g_signal_parse_name ("activated", PORTAL_TYPE_GLOBAL_SHORTCUTS, &_data_->_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp4_, 0, NULL, (GCallback) _portal_global_shortcuts_provider_on_activated_portal_global_shortcuts_activated, _data_->self);
		_data_->_tmp5_ = _data_->self->priv->proxy;
		g_signal_parse_name ("shortcuts-changed", PORTAL_TYPE_GLOBAL_SHORTCUTS, &_data_->_tmp6_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp6_, 0, NULL, (GCallback) _portal_global_shortcuts_provider_on_shortcuts_changed_portal_global_shortcuts_shortcuts_changed, _data_->self);
		_g_object_unref0 (_data_->self->priv->proxy);
		_data_->self->priv->proxy = NULL;
	}
	_g_free0 (_data_->self->priv->session_handle);
	_data_->self->priv->session_handle = 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
portal_global_shortcuts_provider_real_uninitialize_data_free (gpointer _data)
{
	PortalGlobalShortcutsProviderUninitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalGlobalShortcutsProviderUninitializeData, _data_);
}

static void
portal_global_shortcuts_provider_real_uninitialize (FtProvider* base,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	PortalGlobalShortcutsProvider * self;
	PortalGlobalShortcutsProviderUninitializeData* _data_;
	PortalGlobalShortcutsProvider* _tmp0_;
	self = (PortalGlobalShortcutsProvider*) base;
	_data_ = g_slice_new0 (PortalGlobalShortcutsProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_global_shortcuts_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_global_shortcuts_provider_real_uninitialize_co (_data_);
}

static void
portal_global_shortcuts_provider_uninitialize_finish (FtProvider* base,
                                                      GAsyncResult* _res_,
                                                      GError** error)
{
	PortalGlobalShortcutsProviderUninitializeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
portal_global_shortcuts_provider_real_uninitialize_co (PortalGlobalShortcutsProviderUninitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->dbus_watcher_id != ((guint) 0)) {
		g_bus_unwatch_name (_data_->self->priv->dbus_watcher_id);
		_data_->self->priv->dbus_watcher_id = (guint) 0;
	}
	_g_object_unref0 (_data_->self->priv->cancellable);
	_data_->self->priv->cancellable = NULL;
	_data_->self->priv->shortcuts = (_vala_PortalShortcut_array_free (_data_->self->priv->shortcuts, _data_->self->priv->shortcuts_length1), NULL);
	_data_->self->priv->shortcuts = NULL;
	_data_->self->priv->shortcuts_length1 = 0;
	_data_->self->priv->_shortcuts_size_ = _data_->self->priv->shortcuts_length1;
	_g_hash_table_unref0 (_data_->self->priv->accelerators);
	_data_->self->priv->accelerators = 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;
}

PortalGlobalShortcutsProvider*
portal_global_shortcuts_provider_construct (GType object_type)
{
	PortalGlobalShortcutsProvider * self = NULL;
	self = (PortalGlobalShortcutsProvider*) ft_provider_construct (object_type);
	return self;
}

PortalGlobalShortcutsProvider*
portal_global_shortcuts_provider_new (void)
{
	return portal_global_shortcuts_provider_construct (PORTAL_TYPE_GLOBAL_SHORTCUTS_PROVIDER);
}

static void
portal_global_shortcuts_provider_class_init (PortalGlobalShortcutsProviderClass * klass,
                                             gpointer klass_data)
{
	portal_global_shortcuts_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PortalGlobalShortcutsProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) portal_global_shortcuts_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_global_shortcuts_provider_initialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) portal_global_shortcuts_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_global_shortcuts_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) portal_global_shortcuts_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_global_shortcuts_provider_disable_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) portal_global_shortcuts_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_global_shortcuts_provider_uninitialize_finish;
	G_OBJECT_CLASS (klass)->finalize = portal_global_shortcuts_provider_finalize;
}

static void
portal_global_shortcuts_provider_ft_global_shortcuts_provider_interface_init (FtGlobalShortcutsProviderIface * iface,
                                                                              gpointer iface_data)
{
	portal_global_shortcuts_provider_ft_global_shortcuts_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_shortcut = (void (*) (FtGlobalShortcutsProvider*, const gchar*, const gchar*, const gchar*)) portal_global_shortcuts_provider_real_add_shortcut;
	iface->lookup_accelerator = (gchar* (*) (FtGlobalShortcutsProvider*, const gchar*)) portal_global_shortcuts_provider_real_lookup_accelerator;
	iface->open_edit_dialog = (void (*) (FtGlobalShortcutsProvider*, const gchar*, GAsyncReadyCallback, gpointer)) portal_global_shortcuts_provider_real_open_edit_dialog;
	iface->open_edit_dialog_finish = (void (*) (FtGlobalShortcutsProvider*, GAsyncResult*, GError**)) portal_global_shortcuts_provider_open_edit_dialog_finish;
}

static void
portal_global_shortcuts_provider_instance_init (PortalGlobalShortcutsProvider * self,
                                                gpointer klass)
{
	self->priv = portal_global_shortcuts_provider_get_instance_private (self);
	self->priv->connection = NULL;
	self->priv->proxy = NULL;
	self->priv->shortcuts = NULL;
	self->priv->shortcuts_length1 = 0;
	self->priv->_shortcuts_size_ = self->priv->shortcuts_length1;
	self->priv->cancellable = NULL;
	self->priv->session_handle = NULL;
	self->priv->accelerators = NULL;
	self->priv->dbus_watcher_id = 0U;
	self->priv->bind_shortcuts_idle_id = 0U;
	self->priv->is_configured = FALSE;
	self->priv->bound_shortcuts = FALSE;
	self->priv->shortcuts_changed_id = (gulong) 0;
}

static void
portal_global_shortcuts_provider_finalize (GObject * obj)
{
	PortalGlobalShortcutsProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PORTAL_TYPE_GLOBAL_SHORTCUTS_PROVIDER, PortalGlobalShortcutsProvider);
	_g_object_unref0 (self->priv->connection);
	_g_object_unref0 (self->priv->proxy);
	self->priv->shortcuts = (_vala_PortalShortcut_array_free (self->priv->shortcuts, self->priv->shortcuts_length1), NULL);
	_g_object_unref0 (self->priv->cancellable);
	_g_free0 (self->priv->session_handle);
	_g_hash_table_unref0 (self->priv->accelerators);
	G_OBJECT_CLASS (portal_global_shortcuts_provider_parent_class)->finalize (obj);
}

GType
portal_global_shortcuts_provider_get_type (void)
{
	return portal_global_shortcuts_provider_type_id;
}

GType
portal_global_shortcuts_provider_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (PortalGlobalShortcutsProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) portal_global_shortcuts_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PortalGlobalShortcutsProvider), 0, (GInstanceInitFunc) portal_global_shortcuts_provider_instance_init, NULL };
	static const GInterfaceInfo ft_global_shortcuts_provider_info = { (GInterfaceInitFunc) portal_global_shortcuts_provider_ft_global_shortcuts_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	portal_global_shortcuts_provider_type_id = g_type_module_register_type (module, FT_TYPE_PROVIDER, "PortalGlobalShortcutsProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, portal_global_shortcuts_provider_type_id, FT_TYPE_GLOBAL_SHORTCUTS_PROVIDER, &ft_global_shortcuts_provider_info);
	PortalGlobalShortcutsProvider_private_offset = sizeof (PortalGlobalShortcutsProviderPrivate);
	return portal_global_shortcuts_provider_type_id;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

