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

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io)
 */

#include "applications.h"
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <granite-7.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>

#define PERMISSIONS_PERMISSION_STORE_DBUS_NAME "org.freedesktop.impl.portal.PermissionStore"
#define PERMISSIONS_PERMISSION_STORE_DBUS_PATH "/org/freedesktop/impl/portal/PermissionStore"
#define PERMISSIONS_PERMISSION_STORE_RECONNECT_TIMEOUT 5000U
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	PERMISSION_STORE_DBUS_CHANGED_SIGNAL,
	PERMISSION_STORE_DBUS_NUM_SIGNALS
};
static guint permission_store_dbus_signals[PERMISSION_STORE_DBUS_NUM_SIGNALS] = {0};
typedef GDBusProxy PermissionStoreDBusProxy;
typedef GDBusProxyClass PermissionStoreDBusProxyClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _PermissionStoreDbusSetPermissionReadyData PermissionStoreDbusSetPermissionReadyData;
typedef struct _PermissionStoreDbusGetPermissionReadyData PermissionStoreDbusGetPermissionReadyData;
enum  {
	PERMISSIONS_PERMISSION_STORE_0_PROPERTY,
	PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY,
	PERMISSIONS_PERMISSION_STORE_NUM_PROPERTIES
};
static GParamSpec* permissions_permission_store_properties[PERMISSIONS_PERMISSION_STORE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _PermissionsPermissionStoreGetPermissionData PermissionsPermissionStoreGetPermissionData;
enum  {
	PERMISSIONS_PERMISSION_STORE_CHANGED_SIGNAL,
	PERMISSIONS_PERMISSION_STORE_NUM_SIGNALS
};
static guint permissions_permission_store_signals[PERMISSIONS_PERMISSION_STORE_NUM_SIGNALS] = {0};

struct _PermissionStoreDbusSetPermissionReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar* table;
	gboolean create;
	gchar* id;
	gchar* app;
	gchar** permissions;
	gint permissions_length1;
};

struct _PermissionStoreDbusGetPermissionReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar* table;
	gchar* id;
	gchar* app;
};

struct _PermissionsPermissionStorePrivate {
	PermissionStoreDBus* _dbus;
};

struct _PermissionsPermissionStoreGetPermissionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PermissionsPermissionStore* self;
	gchar* table;
	gchar* id;
	gchar* app;
	gchar** result;
	gint result_length1;
	gchar** _tmp0_;
	PermissionStoreDBus* _tmp1_;
	gint _tmp2_;
	gchar** _tmp3_;
	gint _tmp0__length1;
	gint __tmp0__size_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar** _tmp5_;
	gint _tmp5__length1;
	GError* e;
	GError* _tmp6_;
	const gchar* _tmp7_;
	gchar** _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	GError* _inner_error0_;
};

static gint PermissionsPermissionStore_private_offset;
static gpointer permissions_permission_store_parent_class = NULL;
static PermissionsPermissionStore* permissions_permission_store_instance;
static PermissionsPermissionStore* permissions_permission_store_instance = NULL;

static void g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT (GClosure * closure,
                                                                          GValue * return_value,
                                                                          guint n_param_values,
                                                                          const GValue * param_values,
                                                                          gpointer invocation_hint,
                                                                          gpointer marshal_data);
static GType permission_store_dbus_get_type_once (void);
static void permission_store_dbus_proxy_g_signal (GDBusProxy* proxy,
                                           const gchar* sender_name,
                                           const gchar* signal_name,
                                           GVariant* parameters);
static void _dbus_handle_permission_store_dbus_changed (PermissionStoreDBus* self,
                                                 GVariant* parameters);
static void _vala_g_async_ready_callback (GObject *source_object,
                                   GAsyncResult *res,
                                   void *user_data);
static void permission_store_dbus_proxy_set_permission_async (PermissionStoreDBus* self,
                                                       const gchar* table,
                                                       gboolean create,
                                                       const gchar* id,
                                                       const gchar* app,
                                                       gchar** permissions,
                                                       gint permissions_length1,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static void permission_store_dbus_proxy_set_permission_finish (PermissionStoreDBus* self,
                                                        GAsyncResult* _res_,
                                                        GError** error);
static void permission_store_dbus_proxy_get_permission_async (PermissionStoreDBus* self,
                                                       const gchar* table,
                                                       const gchar* id,
                                                       const gchar* app,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gchar** permission_store_dbus_proxy_get_permission_finish (PermissionStoreDBus* self,
                                                           GAsyncResult* _res_,
                                                           gint* result_length1,
                                                           GError** error);
static void permission_store_dbus_proxy_permission_store_dbus_interface_init (PermissionStoreDBusIface* iface);
static void _dbus_permission_store_dbus_set_permission (PermissionStoreDBus* self,
                                                 GVariant* _parameters_,
                                                 GDBusMethodInvocation* invocation);
static void _dbus_permission_store_dbus_set_permission_ready (GObject * source_object,
                                                       GAsyncResult * _res_,
                                                       gpointer _user_data_);
static void _dbus_permission_store_dbus_get_permission (PermissionStoreDBus* self,
                                                 GVariant* _parameters_,
                                                 GDBusMethodInvocation* invocation);
static void _dbus_permission_store_dbus_get_permission_ready (GObject * source_object,
                                                       GAsyncResult * _res_,
                                                       gpointer _user_data_);
static void permission_store_dbus_dbus_interface_method_call (GDBusConnection* connection,
                                                       const gchar* sender,
                                                       const gchar* object_path,
                                                       const gchar* interface_name,
                                                       const gchar* method_name,
                                                       GVariant* parameters,
                                                       GDBusMethodInvocation* invocation,
                                                       gpointer user_data);
static GVariant* permission_store_dbus_dbus_interface_get_property (GDBusConnection* connection,
                                                             const gchar* sender,
                                                             const gchar* object_path,
                                                             const gchar* interface_name,
                                                             const gchar* property_name,
                                                             GError** error,
                                                             gpointer user_data);
static gboolean permission_store_dbus_dbus_interface_set_property (GDBusConnection* connection,
                                                            const gchar* sender,
                                                            const gchar* object_path,
                                                            const gchar* interface_name,
                                                            const gchar* property_name,
                                                            GVariant* value,
                                                            GError** error,
                                                            gpointer user_data);
static void _dbus_permission_store_dbus_changed (GObject* _sender,
                                          const gchar* table,
                                          const gchar* id,
                                          gboolean deleted,
                                          GVariant* data,
                                          GVariant* permissions,
                                          gpointer* _data);
static void _permission_store_dbus_unregister_object (gpointer user_data);
static PermissionsPermissionStore* permissions_permission_store_new (void);
static PermissionsPermissionStore* permissions_permission_store_construct (GType object_type);
static void permissions_permission_store_try_connect (PermissionsPermissionStore* self);
static void __lambda8_ (PermissionsPermissionStore* self,
                 GObject* obj,
                 GAsyncResult* res);
static void permissions_permission_store_set_dbus (PermissionsPermissionStore* self,
                                            PermissionStoreDBus* value);
static void ___lambda9_ (PermissionsPermissionStore* self);
static void ____lambda9__permission_store_dbus_changed (PermissionStoreDBus* _sender,
                                                 const gchar* table,
                                                 const gchar* id,
                                                 gboolean deleted,
                                                 GVariant* data,
                                                 GVariant* permissions,
                                                 gpointer self);
static gboolean ___lambda10_ (PermissionsPermissionStore* self);
static gboolean ____lambda10__gsource_func (gpointer self);
static void ___lambda8__gasync_ready_callback (GObject* source_object,
                                        GAsyncResult* res,
                                        gpointer self);
static void permissions_permission_store_name_vanished_callback (PermissionsPermissionStore* self,
                                                          GDBusConnection* connection,
                                                          const gchar* name);
static void __lambda11_ (PermissionsPermissionStore* self,
                  GObject* obj,
                  GAsyncResult* res);
static void _gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                              gint response_id,
                                              gpointer self);
static void ___lambda11__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void permissions_permission_store_get_permission_data_free (gpointer _data);
static gboolean permissions_permission_store_get_permission_co (PermissionsPermissionStoreGetPermissionData* _data_);
static void permissions_permission_store_get_permission_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static GObject * permissions_permission_store_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties);
static void _permissions_permission_store___lambda12_ (PermissionsPermissionStore* self);
static void __permissions_permission_store___lambda12__gbus_name_appeared_callback (GDBusConnection* connection,
                                                                             const gchar* name,
                                                                             const gchar* name_owner,
                                                                             gpointer self);
static void _permissions_permission_store_name_vanished_callback_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                       const gchar* name,
                                                                                       gpointer self);
static void permissions_permission_store_finalize (GObject * obj);
static GType permissions_permission_store_get_type_once (void);
static void _vala_permissions_permission_store_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_permissions_permission_store_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_set_permission_table = {-1, "table", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_set_permission_create = {-1, "create", "b", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_set_permission_id = {-1, "id", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_set_permission_app = {-1, "app", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_set_permission_permissions = {-1, "permissions", "as", NULL};
static const GDBusArgInfo * const _permission_store_dbus_dbus_arg_info_set_permission_in[] = {&_permission_store_dbus_dbus_arg_info_set_permission_table, &_permission_store_dbus_dbus_arg_info_set_permission_create, &_permission_store_dbus_dbus_arg_info_set_permission_id, &_permission_store_dbus_dbus_arg_info_set_permission_app, &_permission_store_dbus_dbus_arg_info_set_permission_permissions, NULL};
static const GDBusArgInfo * const _permission_store_dbus_dbus_arg_info_set_permission_out[] = {NULL};
static const GDBusMethodInfo _permission_store_dbus_dbus_method_info_set_permission = {-1, "SetPermission", (GDBusArgInfo **) (&_permission_store_dbus_dbus_arg_info_set_permission_in), (GDBusArgInfo **) (&_permission_store_dbus_dbus_arg_info_set_permission_out), NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_get_permission_table = {-1, "table", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_get_permission_id = {-1, "id", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_get_permission_app = {-1, "app", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_get_permission_result = {-1, "result", "as", NULL};
static const GDBusArgInfo * const _permission_store_dbus_dbus_arg_info_get_permission_in[] = {&_permission_store_dbus_dbus_arg_info_get_permission_table, &_permission_store_dbus_dbus_arg_info_get_permission_id, &_permission_store_dbus_dbus_arg_info_get_permission_app, NULL};
static const GDBusArgInfo * const _permission_store_dbus_dbus_arg_info_get_permission_out[] = {&_permission_store_dbus_dbus_arg_info_get_permission_result, NULL};
static const GDBusMethodInfo _permission_store_dbus_dbus_method_info_get_permission = {-1, "GetPermission", (GDBusArgInfo **) (&_permission_store_dbus_dbus_arg_info_get_permission_in), (GDBusArgInfo **) (&_permission_store_dbus_dbus_arg_info_get_permission_out), NULL};
static const GDBusMethodInfo * const _permission_store_dbus_dbus_method_info[] = {&_permission_store_dbus_dbus_method_info_set_permission, &_permission_store_dbus_dbus_method_info_get_permission, NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_changed_table = {-1, "table", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_changed_id = {-1, "id", "s", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_changed_deleted = {-1, "deleted", "b", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_changed_data = {-1, "data", "v", NULL};
static const GDBusArgInfo _permission_store_dbus_dbus_arg_info_changed_permissions = {-1, "permissions", "a{sas}", NULL};
static const GDBusArgInfo * const _permission_store_dbus_dbus_arg_info_changed[] = {&_permission_store_dbus_dbus_arg_info_changed_table, &_permission_store_dbus_dbus_arg_info_changed_id, &_permission_store_dbus_dbus_arg_info_changed_deleted, &_permission_store_dbus_dbus_arg_info_changed_data, &_permission_store_dbus_dbus_arg_info_changed_permissions, NULL};
static const GDBusSignalInfo _permission_store_dbus_dbus_signal_info_changed = {-1, "Changed", (GDBusArgInfo **) (&_permission_store_dbus_dbus_arg_info_changed), NULL};
static const GDBusSignalInfo * const _permission_store_dbus_dbus_signal_info[] = {&_permission_store_dbus_dbus_signal_info_changed, NULL};
static const GDBusPropertyInfo * const _permission_store_dbus_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _permission_store_dbus_dbus_interface_info = {-1, "org.freedesktop.impl.portal.PermissionStore", (GDBusMethodInfo **) (&_permission_store_dbus_dbus_method_info), (GDBusSignalInfo **) (&_permission_store_dbus_dbus_signal_info), (GDBusPropertyInfo **) (&_permission_store_dbus_dbus_property_info), NULL};
static const GDBusInterfaceVTable _permission_store_dbus_dbus_interface_vtable = {permission_store_dbus_dbus_interface_method_call, permission_store_dbus_dbus_interface_get_property, permission_store_dbus_dbus_interface_set_property};

void
permission_store_dbus_set_permission (PermissionStoreDBus* self,
                                      const gchar* table,
                                      gboolean create,
                                      const gchar* id,
                                      const gchar* app,
                                      gchar** permissions,
                                      gint permissions_length1,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	PermissionStoreDBusIface* _iface_;
	_iface_ = PERMISSION_STORE_DBUS_GET_INTERFACE (self);
	if (_iface_->set_permission) {
		_iface_->set_permission (self, table, create, id, app, permissions, permissions_length1, _callback_, _user_data_);
	}
}

void
permission_store_dbus_set_permission_finish (PermissionStoreDBus* self,
                                             GAsyncResult* _res_,
                                             GError** error)
{
	PermissionStoreDBusIface* _iface_;
	_iface_ = PERMISSION_STORE_DBUS_GET_INTERFACE (self);
	if (_iface_->set_permission_finish) {
		_iface_->set_permission_finish (self, _res_, error);
	}
}

void
permission_store_dbus_get_permission (PermissionStoreDBus* self,
                                      const gchar* table,
                                      const gchar* id,
                                      const gchar* app,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	PermissionStoreDBusIface* _iface_;
	_iface_ = PERMISSION_STORE_DBUS_GET_INTERFACE (self);
	if (_iface_->get_permission) {
		_iface_->get_permission (self, table, id, app, _callback_, _user_data_);
	}
}

gchar**
permission_store_dbus_get_permission_finish (PermissionStoreDBus* self,
                                             GAsyncResult* _res_,
                                             gint* result_length1,
                                             GError** error)
{
	PermissionStoreDBusIface* _iface_;
	_iface_ = PERMISSION_STORE_DBUS_GET_INTERFACE (self);
	if (_iface_->get_permission_finish) {
		return _iface_->get_permission_finish (self, _res_, result_length1, error);
	}
	return NULL;
}

static void
g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT (GClosure * closure,
                                                                     GValue * return_value,
                                                                     guint n_param_values,
                                                                     const GValue * param_values,
                                                                     gpointer invocation_hint,
                                                                     gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT) (gpointer data1, const char* arg_1, const char* arg_2, gboolean arg_3, gpointer arg_4, gpointer arg_5, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 6);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_boolean (param_values + 3), g_value_get_variant (param_values + 4), g_value_get_variant (param_values + 5), data2);
}

static void
permission_store_dbus_default_init (PermissionStoreDBusIface * iface,
                                    gpointer iface_data)
{
	permission_store_dbus_signals[PERMISSION_STORE_DBUS_CHANGED_SIGNAL] = g_signal_new ("changed", TYPE_PERMISSION_STORE_DBUS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN_VARIANT_VARIANT, G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_VARIANT, G_TYPE_VARIANT);
}

static GType
permission_store_dbus_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PermissionStoreDBusIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) permission_store_dbus_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType permission_store_dbus_type_id;
	permission_store_dbus_type_id = g_type_register_static (G_TYPE_INTERFACE, "PermissionStoreDBus", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (permission_store_dbus_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (permission_store_dbus_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) permission_store_dbus_proxy_get_type);
	g_type_set_qdata (permission_store_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.impl.portal.PermissionStore");
	g_type_set_qdata (permission_store_dbus_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_permission_store_dbus_dbus_interface_info));
	g_type_set_qdata (permission_store_dbus_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) permission_store_dbus_register_object);
	return permission_store_dbus_type_id;
}

GType
permission_store_dbus_get_type (void)
{
	static volatile gsize permission_store_dbus_type_id__once = 0;
	if (g_once_init_enter (&permission_store_dbus_type_id__once)) {
		GType permission_store_dbus_type_id;
		permission_store_dbus_type_id = permission_store_dbus_get_type_once ();
		g_once_init_leave (&permission_store_dbus_type_id__once, permission_store_dbus_type_id);
	}
	return permission_store_dbus_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (PermissionStoreDBusProxy, permission_store_dbus_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_PERMISSION_STORE_DBUS, permission_store_dbus_proxy_permission_store_dbus_interface_init) )
static void
permission_store_dbus_proxy_class_init (PermissionStoreDBusProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = permission_store_dbus_proxy_g_signal;
}

static void
_dbus_handle_permission_store_dbus_changed (PermissionStoreDBus* self,
                                            GVariant* parameters)
{
	GVariantIter _arguments_iter;
	gchar* table = NULL;
	GVariant* _tmp0_;
	gchar* id = NULL;
	GVariant* _tmp1_;
	gboolean deleted = FALSE;
	GVariant* _tmp2_;
	GVariant* data = NULL;
	GVariant* _tmp3_;
	GVariant* permissions = NULL;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	table = g_variant_dup_string (_tmp0_, NULL);
	g_variant_unref (_tmp0_);
	_tmp1_ = g_variant_iter_next_value (&_arguments_iter);
	id = g_variant_dup_string (_tmp1_, NULL);
	g_variant_unref (_tmp1_);
	_tmp2_ = g_variant_iter_next_value (&_arguments_iter);
	deleted = g_variant_get_boolean (_tmp2_);
	g_variant_unref (_tmp2_);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	data = g_variant_get_variant (_tmp3_);
	g_variant_unref (_tmp3_);
	permissions = g_variant_iter_next_value (&_arguments_iter);
	g_signal_emit_by_name (self, "changed", table, id, deleted, data, permissions);
	_g_free0 (table);
	_g_free0 (id);
	_g_variant_unref0 (data);
	_g_variant_unref0 (permissions);
}

static void
permission_store_dbus_proxy_g_signal (GDBusProxy* proxy,
                                      const gchar* sender_name,
                                      const gchar* signal_name,
                                      GVariant* parameters)
{
	if (strcmp (signal_name, "Changed") == 0) {
		_dbus_handle_permission_store_dbus_changed ((PermissionStoreDBus*) proxy, parameters);
	}
}

static void
permission_store_dbus_proxy_init (PermissionStoreDBusProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_permission_store_dbus_dbus_interface_info));
}

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

static void
permission_store_dbus_proxy_set_permission_async (PermissionStoreDBus* self,
                                                  const gchar* table,
                                                  gboolean create,
                                                  const gchar* id,
                                                  const gchar* app,
                                                  gchar** permissions,
                                                  gint permissions_length1,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	gchar** _tmp4_;
	GVariantBuilder _tmp5_;
	gint _tmp6_;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.impl.portal.PermissionStore", "SetPermission");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (table));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (create));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (id));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (app));
	_tmp4_ = permissions;
	g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
	for (_tmp6_ = 0; _tmp6_ < permissions_length1; _tmp6_++) {
		g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
		_tmp4_++;
	}
	g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp5_));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static void
permission_store_dbus_proxy_set_permission_finish (PermissionStoreDBus* self,
                                                   GAsyncResult* _res_,
                                                   GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return;
	}
	g_object_unref (_reply_message);
}

static void
permission_store_dbus_proxy_get_permission_async (PermissionStoreDBus* self,
                                                  const gchar* table,
                                                  const gchar* id,
                                                  const gchar* app,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	GDBusMessage *_message;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	G_DBUS_ERROR;
	G_IO_ERROR;
	_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.impl.portal.PermissionStore", "GetPermission");
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (table));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (id));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (app));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_message_set_body (_message, _arguments);
	if (_callback_ != NULL) {
		g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_task_new ((GObject *) self, NULL, _callback_, _user_data_));
	} else {
		g_dbus_message_set_flags (_message, G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED);
		g_dbus_connection_send_message (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	}
	g_object_unref (_message);
}

static gchar**
permission_store_dbus_proxy_get_permission_finish (PermissionStoreDBus* self,
                                                   GAsyncResult* _res_,
                                                   gint* result_length1,
                                                   GError** error)
{
	GAsyncResult *_inner_res;
	GDBusMessage *_reply_message;
	GVariant *_reply;
	GVariantIter _reply_iter;
	gchar** _result = NULL;
	gint _result_length1;
	GVariant* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length;
	gint _tmp8__size;
	gint _tmp8__length1;
	GVariantIter _tmp9_;
	GVariant* _tmp10_;
	_inner_res = g_task_propagate_pointer ((GTask *) _res_, NULL);
	_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), _inner_res, error);
	g_object_unref (_inner_res);
	if (!_reply_message) {
		return NULL;
	}
	if (g_dbus_message_to_gerror (_reply_message, error)) {
		g_object_unref (_reply_message);
		return NULL;
	}
	_reply = g_dbus_message_get_body (_reply_message);
	g_variant_iter_init (&_reply_iter, _reply);
	_result_length1 = 0;
	_tmp7_ = g_variant_iter_next_value (&_reply_iter);
	_tmp8_ = g_new (gchar*, 5);
	_tmp8__length = 0;
	_tmp8__size = 4;
	_tmp8__length1 = 0;
	g_variant_iter_init (&_tmp9_, _tmp7_);
	for (; (_tmp10_ = g_variant_iter_next_value (&_tmp9_)) != NULL; _tmp8__length1++) {
		if (_tmp8__size == _tmp8__length) {
			_tmp8__size = 2 * _tmp8__size;
			_tmp8_ = g_renew (gchar*, _tmp8_, _tmp8__size + 1);
		}
		_tmp8_[_tmp8__length++] = g_variant_dup_string (_tmp10_, NULL);
		g_variant_unref (_tmp10_);
	}
	_result_length1 = _tmp8__length1;
	_tmp8_[_tmp8__length] = NULL;
	_result = _tmp8_;
	g_variant_unref (_tmp7_);
	*result_length1 = _result_length1;
	g_object_unref (_reply_message);
	return _result;
}

static void
permission_store_dbus_proxy_permission_store_dbus_interface_init (PermissionStoreDBusIface* iface)
{
	iface->set_permission = permission_store_dbus_proxy_set_permission_async;
	iface->set_permission_finish = permission_store_dbus_proxy_set_permission_finish;
	iface->get_permission = permission_store_dbus_proxy_get_permission_async;
	iface->get_permission_finish = permission_store_dbus_proxy_get_permission_finish;
}

static void
_dbus_permission_store_dbus_set_permission (PermissionStoreDBus* self,
                                            GVariant* _parameters_,
                                            GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	PermissionStoreDbusSetPermissionReadyData* _ready_data;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	GVariant* _tmp14_;
	GVariant* _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length;
	gint _tmp16__size;
	gint _tmp16__length1;
	GVariantIter _tmp17_;
	GVariant* _tmp18_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (PermissionStoreDbusSetPermissionReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp11_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->table = g_variant_dup_string (_tmp11_, NULL);
	g_variant_unref (_tmp11_);
	_tmp12_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->create = g_variant_get_boolean (_tmp12_);
	g_variant_unref (_tmp12_);
	_tmp13_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->id = g_variant_dup_string (_tmp13_, NULL);
	g_variant_unref (_tmp13_);
	_tmp14_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->app = g_variant_dup_string (_tmp14_, NULL);
	g_variant_unref (_tmp14_);
	_tmp15_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp16_ = g_new (gchar*, 5);
	_tmp16__length = 0;
	_tmp16__size = 4;
	_tmp16__length1 = 0;
	g_variant_iter_init (&_tmp17_, _tmp15_);
	for (; (_tmp18_ = g_variant_iter_next_value (&_tmp17_)) != NULL; _tmp16__length1++) {
		if (_tmp16__size == _tmp16__length) {
			_tmp16__size = 2 * _tmp16__size;
			_tmp16_ = g_renew (gchar*, _tmp16_, _tmp16__size + 1);
		}
		_tmp16_[_tmp16__length++] = g_variant_dup_string (_tmp18_, NULL);
		g_variant_unref (_tmp18_);
	}
	_ready_data->permissions_length1 = _tmp16__length1;
	_tmp16_[_tmp16__length] = NULL;
	_ready_data->permissions = _tmp16_;
	g_variant_unref (_tmp15_);
	permission_store_dbus_set_permission (self, _ready_data->table, _ready_data->create, _ready_data->id, _ready_data->app, _ready_data->permissions, _ready_data->permissions_length1, (GAsyncReadyCallback) _dbus_permission_store_dbus_set_permission_ready, _ready_data);
	_error:
	;
}

static void
_dbus_permission_store_dbus_set_permission_ready (GObject * source_object,
                                                  GAsyncResult * _res_,
                                                  gpointer _user_data_)
{
	PermissionStoreDbusSetPermissionReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	permission_store_dbus_set_permission_finish ((PermissionStoreDBus*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (_ready_data->table);
	_g_free0 (_ready_data->id);
	_g_free0 (_ready_data->app);
	_ready_data->permissions = (_vala_array_free (_ready_data->permissions, _ready_data->permissions_length1, (GDestroyNotify) g_free), NULL);
	g_slice_free (PermissionStoreDbusSetPermissionReadyData, _ready_data);
}

static void
_dbus_permission_store_dbus_get_permission (PermissionStoreDBus* self,
                                            GVariant* _parameters_,
                                            GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	PermissionStoreDbusGetPermissionReadyData* _ready_data;
	GVariant* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (PermissionStoreDbusGetPermissionReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp19_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->table = g_variant_dup_string (_tmp19_, NULL);
	g_variant_unref (_tmp19_);
	_tmp20_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->id = g_variant_dup_string (_tmp20_, NULL);
	g_variant_unref (_tmp20_);
	_tmp21_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->app = g_variant_dup_string (_tmp21_, NULL);
	g_variant_unref (_tmp21_);
	permission_store_dbus_get_permission (self, _ready_data->table, _ready_data->id, _ready_data->app, (GAsyncReadyCallback) _dbus_permission_store_dbus_get_permission_ready, _ready_data);
	_error:
	;
}

static void
_dbus_permission_store_dbus_get_permission_ready (GObject * source_object,
                                                  GAsyncResult * _res_,
                                                  gpointer _user_data_)
{
	PermissionStoreDbusGetPermissionReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	gint result_length1 = 0;
	gchar** _tmp22_;
	GVariantBuilder _tmp23_;
	gint _tmp24_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = permission_store_dbus_get_permission_finish ((PermissionStoreDBus*) source_object, _res_, &result_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_tmp22_ = result;
	g_variant_builder_init (&_tmp23_, G_VARIANT_TYPE ("as"));
	for (_tmp24_ = 0; _tmp24_ < result_length1; _tmp24_++) {
		g_variant_builder_add_value (&_tmp23_, g_variant_new_string (*_tmp22_));
		_tmp22_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp23_));
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (_ready_data->table);
	_g_free0 (_ready_data->id);
	_g_free0 (_ready_data->app);
	g_slice_free (PermissionStoreDbusGetPermissionReadyData, _ready_data);
}

static void
permission_store_dbus_dbus_interface_method_call (GDBusConnection* connection,
                                                  const gchar* sender,
                                                  const gchar* object_path,
                                                  const gchar* interface_name,
                                                  const gchar* method_name,
                                                  GVariant* parameters,
                                                  GDBusMethodInvocation* invocation,
                                                  gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "SetPermission") == 0) {
		_dbus_permission_store_dbus_set_permission (object, parameters, invocation);
	} else if (strcmp (method_name, "GetPermission") == 0) {
		_dbus_permission_store_dbus_get_permission (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

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

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

static void
_dbus_permission_store_dbus_changed (GObject* _sender,
                                     const gchar* table,
                                     const gchar* id,
                                     gboolean deleted,
                                     GVariant* data,
                                     GVariant* permissions,
                                     gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (table));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (id));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (deleted));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_variant (data));
	g_variant_builder_add_value (&_arguments_builder, permissions);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.impl.portal.PermissionStore", "Changed", _arguments, NULL);
}

guint
permission_store_dbus_register_object (gpointer object,
                                       GDBusConnection* connection,
                                       const gchar* path,
                                       GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_permission_store_dbus_dbus_interface_info), &_permission_store_dbus_dbus_interface_vtable, data, _permission_store_dbus_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "changed", (GCallback) _dbus_permission_store_dbus_changed, data);
	return result;
}

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

static inline gpointer
permissions_permission_store_get_instance_private (PermissionsPermissionStore* self)
{
	return G_STRUCT_MEMBER_P (self, PermissionsPermissionStore_private_offset);
}

PermissionsPermissionStore*
permissions_permission_store_get_default (void)
{
	PermissionsPermissionStore* _tmp0_;
	PermissionsPermissionStore* _tmp2_;
	PermissionsPermissionStore* result;
	_tmp0_ = permissions_permission_store_instance;
	if (_tmp0_ == NULL) {
		PermissionsPermissionStore* _tmp1_;
		_tmp1_ = permissions_permission_store_new ();
		_g_object_unref0 (permissions_permission_store_instance);
		permissions_permission_store_instance = _tmp1_;
	}
	_tmp2_ = permissions_permission_store_instance;
	result = _tmp2_;
	return result;
}

static PermissionsPermissionStore*
permissions_permission_store_construct (GType object_type)
{
	PermissionsPermissionStore * self = NULL;
	self = (PermissionsPermissionStore*) g_object_new (object_type, NULL);
	return self;
}

static PermissionsPermissionStore*
permissions_permission_store_new (void)
{
	return permissions_permission_store_construct (PERMISSIONS_TYPE_PERMISSION_STORE);
}

static void
___lambda9_ (PermissionsPermissionStore* self)
{
	g_signal_emit (self, permissions_permission_store_signals[PERMISSIONS_PERMISSION_STORE_CHANGED_SIGNAL], 0);
}

static void
____lambda9__permission_store_dbus_changed (PermissionStoreDBus* _sender,
                                            const gchar* table,
                                            const gchar* id,
                                            gboolean deleted,
                                            GVariant* data,
                                            GVariant* permissions,
                                            gpointer self)
{
	___lambda9_ ((PermissionsPermissionStore*) self);
}

static gboolean
___lambda10_ (PermissionsPermissionStore* self)
{
	gboolean result;
	permissions_permission_store_try_connect (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
____lambda10__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda10_ ((PermissionsPermissionStore*) self);
	return result;
}

static void
__lambda8_ (PermissionsPermissionStore* self,
            GObject* obj,
            GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		PermissionStoreDBus* _tmp0_ = NULL;
		PermissionStoreDBus* _tmp1_;
		PermissionStoreDBus* _tmp2_;
		PermissionStoreDBus* _tmp3_;
		_tmp1_ = g_async_result_get_source_object (res);
		_tmp2_ = (PermissionStoreDBus*) g_async_initable_new_finish ((GAsyncInitable *) _tmp1_, res, &_inner_error0_);
		g_object_unref (_tmp1_);
		_tmp0_ = (PermissionStoreDBus*) _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		permissions_permission_store_set_dbus (self, _tmp0_);
		_tmp3_ = self->priv->_dbus;
		g_signal_connect_object (_tmp3_, "changed", (GCallback) ____lambda9__permission_store_dbus_changed, self, 0);
		_g_object_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		g_critical ("PermissionStore.vala:46: %s", _tmp5_);
		g_timeout_add_full (G_PRIORITY_DEFAULT, PERMISSIONS_PERMISSION_STORE_RECONNECT_TIMEOUT, ____lambda10__gsource_func, g_object_ref (self), g_object_unref);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda8__gasync_ready_callback (GObject* source_object,
                                   GAsyncResult* res,
                                   gpointer self)
{
	__lambda8_ ((PermissionsPermissionStore*) self, source_object, res);
	g_object_unref (self);
}

static void
permissions_permission_store_try_connect (PermissionsPermissionStore* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_async_initable_new_async (TYPE_PERMISSION_STORE_DBUS_PROXY, 0, NULL, ___lambda8__gasync_ready_callback, g_object_ref (self), "g-flags", 0, "g-name", PERMISSIONS_PERMISSION_STORE_DBUS_NAME, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", PERMISSIONS_PERMISSION_STORE_DBUS_PATH, "g-interface-name", "org.freedesktop.impl.portal.PermissionStore", NULL);
}

static void
permissions_permission_store_name_vanished_callback (PermissionsPermissionStore* self,
                                                     GDBusConnection* connection,
                                                     const gchar* name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (connection != NULL);
	g_return_if_fail (name != NULL);
	permissions_permission_store_set_dbus (self, NULL);
}

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

static void
_gtk_window_destroy_gtk_dialog_response (GtkDialog* _sender,
                                         gint response_id,
                                         gpointer self)
{
	gtk_window_destroy ((GtkWindow*) self);
}

static void
__lambda11_ (PermissionsPermissionStore* self,
             GObject* obj,
             GAsyncResult* res)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (res != NULL);
	{
		PermissionStoreDBus* _tmp0_;
		_tmp0_ = self->priv->_dbus;
		permission_store_dbus_set_permission_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		GraniteMessageDialog* dialog = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		GThemedIcon* _tmp5_;
		GThemedIcon* _tmp6_;
		GThemedIcon* _tmp7_;
		GApplication* _tmp8_;
		GtkWindow* _tmp9_;
		GtkWindow* _tmp10_;
		GtkWindow* _tmp11_;
		GraniteMessageDialog* _tmp12_ = NULL;
		GraniteMessageDialog* _tmp13_;
		GraniteMessageDialog* _tmp14_;
		GraniteMessageDialog* _tmp15_;
		GraniteMessageDialog* _tmp16_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_critical ("PermissionStore.vala:64: %s", _tmp2_);
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		_tmp5_ = (GThemedIcon*) g_themed_icon_new ("preferences-system");
		_tmp6_ = _tmp5_;
		_tmp7_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
		_tmp8_ = g_application_get_default ();
		_tmp9_ = gtk_application_get_active_window (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, gtk_application_get_type (), GtkApplication));
		_tmp10_ = _tmp9_;
		_tmp11_ = _g_object_ref0 (_tmp10_);
		_tmp12_ = granite_message_dialog_new (_ ("Couldn't set permission"), _tmp4_, (GIcon*) _tmp6_, GTK_BUTTONS_CLOSE);
		granite_message_dialog_set_badge_icon (_tmp12_, (GIcon*) _tmp7_);
		_g_object_unref0 (_tmp7_);
		gtk_window_set_modal ((GtkWindow*) _tmp12_, TRUE);
		gtk_window_set_transient_for ((GtkWindow*) _tmp12_, _tmp11_);
		_g_object_unref0 (_tmp11_);
		g_object_ref_sink (_tmp12_);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (_tmp6_);
		dialog = _tmp13_;
		_tmp14_ = dialog;
		gtk_window_present ((GtkWindow*) _tmp14_);
		_tmp15_ = dialog;
		_tmp16_ = dialog;
		g_signal_connect_object ((GtkDialog*) _tmp15_, "response", (GCallback) _gtk_window_destroy_gtk_dialog_response, (GtkWindow*) _tmp16_, 0);
		_g_object_unref0 (dialog);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda11__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	__lambda11_ ((PermissionsPermissionStore*) self, source_object, res);
	g_object_unref (self);
}

void
permissions_permission_store_set_permission (PermissionsPermissionStore* self,
                                             const gchar* table,
                                             const gchar* id,
                                             const gchar* app,
                                             gchar** permissions,
                                             gint permissions_length1)
{
	PermissionStoreDBus* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (table != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (app != NULL);
	_tmp0_ = self->priv->_dbus;
	permission_store_dbus_set_permission (_tmp0_, table, FALSE, id, app, permissions, (gint) permissions_length1, ___lambda11__gasync_ready_callback, g_object_ref (self));
}

static void
permissions_permission_store_get_permission_data_free (gpointer _data)
{
	PermissionsPermissionStoreGetPermissionData* _data_;
	_data_ = _data;
	_g_free0 (_data_->table);
	_g_free0 (_data_->id);
	_g_free0 (_data_->app);
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (PermissionsPermissionStoreGetPermissionData, _data_);
}

void
permissions_permission_store_get_permission (PermissionsPermissionStore* self,
                                             const gchar* table,
                                             const gchar* id,
                                             const gchar* app,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	PermissionsPermissionStoreGetPermissionData* _data_;
	PermissionsPermissionStore* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (table != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (app != NULL);
	_data_ = g_slice_new0 (PermissionsPermissionStoreGetPermissionData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, permissions_permission_store_get_permission_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (table);
	_g_free0 (_data_->table);
	_data_->table = _tmp1_;
	_tmp2_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp2_;
	_tmp3_ = g_strdup (app);
	_g_free0 (_data_->app);
	_data_->app = _tmp3_;
	permissions_permission_store_get_permission_co (_data_);
}

gchar**
permissions_permission_store_get_permission_finish (PermissionsPermissionStore* self,
                                                    GAsyncResult* _res_,
                                                    gint* result_length1)
{
	gchar** result;
	PermissionsPermissionStoreGetPermissionData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}

static void
permissions_permission_store_get_permission_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	PermissionsPermissionStoreGetPermissionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	permissions_permission_store_get_permission_co (_data_);
}

static gboolean
permissions_permission_store_get_permission_co (PermissionsPermissionStoreGetPermissionData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp1_ = _data_->self->priv->_dbus;
		_data_->_tmp2_ = 0;
		_data_->_state_ = 1;
		permission_store_dbus_get_permission (_data_->_tmp1_, _data_->table, _data_->id, _data_->app, permissions_permission_store_get_permission_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp3_ = permission_store_dbus_get_permission_finish (_data_->_tmp1_, _data_->_res_, &_data_->_tmp2_, &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp3_;
		_data_->_tmp0__length1 = _data_->_tmp2_;
		_data_->__tmp0__size_ = _data_->_tmp0__length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->_tmp0_;
		_data_->_tmp4__length1 = _data_->_tmp0__length1;
		_data_->_tmp0_ = NULL;
		_data_->_tmp0__length1 = 0;
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp5__length1 = _data_->_tmp4__length1;
		_data_->result_length1 = _data_->_tmp5__length1;
		_data_->result = _data_->_tmp5_;
		_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_free), 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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp6_ = _data_->e;
		_data_->_tmp7_ = _data_->_tmp6_->message;
		g_debug ("PermissionStore.vala:85: %s", _data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != 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_->_tmp8_ = g_new0 (gchar*, 1 + 1);
	_data_->_tmp8_[0] = NULL;
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp9__length1 = 1;
	_data_->result_length1 = _data_->_tmp9__length1;
	_data_->result = _data_->_tmp9_;
	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;
}

PermissionStoreDBus*
permissions_permission_store_get_dbus (PermissionsPermissionStore* self)
{
	PermissionStoreDBus* result;
	PermissionStoreDBus* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_dbus;
	result = _tmp0_;
	return result;
}

static void
permissions_permission_store_set_dbus (PermissionsPermissionStore* self,
                                       PermissionStoreDBus* value)
{
	PermissionStoreDBus* old_value;
	g_return_if_fail (self != NULL);
	old_value = permissions_permission_store_get_dbus (self);
	if (old_value != value) {
		PermissionStoreDBus* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_dbus);
		self->priv->_dbus = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, permissions_permission_store_properties[PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY]);
	}
}

static void
_permissions_permission_store___lambda12_ (PermissionsPermissionStore* self)
{
	permissions_permission_store_try_connect (self);
}

static void
__permissions_permission_store___lambda12__gbus_name_appeared_callback (GDBusConnection* connection,
                                                                        const gchar* name,
                                                                        const gchar* name_owner,
                                                                        gpointer self)
{
	_permissions_permission_store___lambda12_ ((PermissionsPermissionStore*) self);
}

static void
_permissions_permission_store_name_vanished_callback_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                  const gchar* name,
                                                                                  gpointer self)
{
	permissions_permission_store_name_vanished_callback ((PermissionsPermissionStore*) self, connection, name);
}

static GObject *
permissions_permission_store_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PermissionsPermissionStore * self;
	parent_class = G_OBJECT_CLASS (permissions_permission_store_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PERMISSIONS_TYPE_PERMISSION_STORE, PermissionsPermissionStore);
	g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, PERMISSIONS_PERMISSION_STORE_DBUS_NAME, G_BUS_NAME_WATCHER_FLAGS_AUTO_START, (GClosure*) ((__permissions_permission_store___lambda12__gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) __permissions_permission_store___lambda12__gbus_name_appeared_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((_permissions_permission_store_name_vanished_callback_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _permissions_permission_store_name_vanished_callback_gbus_name_vanished_callback, g_object_ref (self), (GClosureNotify) g_object_unref)));
	return obj;
}

static void
permissions_permission_store_class_init (PermissionsPermissionStoreClass * klass,
                                         gpointer klass_data)
{
	permissions_permission_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PermissionsPermissionStore_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_permissions_permission_store_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_permissions_permission_store_set_property;
	G_OBJECT_CLASS (klass)->constructor = permissions_permission_store_constructor;
	G_OBJECT_CLASS (klass)->finalize = permissions_permission_store_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY, permissions_permission_store_properties[PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY] = g_param_spec_object ("dbus", "dbus", "dbus", TYPE_PERMISSION_STORE_DBUS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	permissions_permission_store_signals[PERMISSIONS_PERMISSION_STORE_CHANGED_SIGNAL] = g_signal_new ("changed", PERMISSIONS_TYPE_PERMISSION_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
permissions_permission_store_instance_init (PermissionsPermissionStore * self,
                                            gpointer klass)
{
	self->priv = permissions_permission_store_get_instance_private (self);
	self->priv->_dbus = NULL;
}

static void
permissions_permission_store_finalize (GObject * obj)
{
	PermissionsPermissionStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PERMISSIONS_TYPE_PERMISSION_STORE, PermissionsPermissionStore);
	_g_object_unref0 (self->priv->_dbus);
	G_OBJECT_CLASS (permissions_permission_store_parent_class)->finalize (obj);
}

static GType
permissions_permission_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PermissionsPermissionStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) permissions_permission_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PermissionsPermissionStore), 0, (GInstanceInitFunc) permissions_permission_store_instance_init, NULL };
	GType permissions_permission_store_type_id;
	permissions_permission_store_type_id = g_type_register_static (G_TYPE_OBJECT, "PermissionsPermissionStore", &g_define_type_info, 0);
	PermissionsPermissionStore_private_offset = g_type_add_instance_private (permissions_permission_store_type_id, sizeof (PermissionsPermissionStorePrivate));
	return permissions_permission_store_type_id;
}

GType
permissions_permission_store_get_type (void)
{
	static volatile gsize permissions_permission_store_type_id__once = 0;
	if (g_once_init_enter (&permissions_permission_store_type_id__once)) {
		GType permissions_permission_store_type_id;
		permissions_permission_store_type_id = permissions_permission_store_get_type_once ();
		g_once_init_leave (&permissions_permission_store_type_id__once, permissions_permission_store_type_id);
	}
	return permissions_permission_store_type_id__once;
}

static void
_vala_permissions_permission_store_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	PermissionsPermissionStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PERMISSIONS_TYPE_PERMISSION_STORE, PermissionsPermissionStore);
	switch (property_id) {
		case PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY:
		g_value_set_object (value, permissions_permission_store_get_dbus (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_permissions_permission_store_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	PermissionsPermissionStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PERMISSIONS_TYPE_PERMISSION_STORE, PermissionsPermissionStore);
	switch (property_id) {
		case PERMISSIONS_PERMISSION_STORE_DBUS_PROPERTY:
		permissions_permission_store_set_dbus (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

