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

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

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <flatpak.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>

#define SIDELOAD_FLATPAK_REF_FILE_REF_GROUP "Flatpak Ref"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define SIDELOAD_TYPE_FLATPAK_FILE (sideload_flatpak_file_get_type ())
#define SIDELOAD_FLATPAK_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFile))
#define SIDELOAD_FLATPAK_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFileClass))
#define SIDELOAD_IS_FLATPAK_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_FLATPAK_FILE))
#define SIDELOAD_IS_FLATPAK_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_FLATPAK_FILE))
#define SIDELOAD_FLATPAK_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_FLATPAK_FILE, SideloadFlatpakFileClass))

typedef struct _SideloadFlatpakFile SideloadFlatpakFile;
typedef struct _SideloadFlatpakFileClass SideloadFlatpakFileClass;
typedef struct _SideloadFlatpakFilePrivate SideloadFlatpakFilePrivate;

#define SIDELOAD_TYPE_FLATPAK_REF_FILE (sideload_flatpak_ref_file_get_type ())
#define SIDELOAD_FLATPAK_REF_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFile))
#define SIDELOAD_FLATPAK_REF_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFileClass))
#define SIDELOAD_IS_FLATPAK_REF_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE))
#define SIDELOAD_IS_FLATPAK_REF_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SIDELOAD_TYPE_FLATPAK_REF_FILE))
#define SIDELOAD_FLATPAK_REF_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFileClass))

typedef struct _SideloadFlatpakRefFile SideloadFlatpakRefFile;
typedef struct _SideloadFlatpakRefFileClass SideloadFlatpakRefFileClass;
typedef struct _SideloadFlatpakRefFilePrivate SideloadFlatpakRefFilePrivate;

#define TYPE_ASYNC_MUTEX (async_mutex_get_type ())
#define ASYNC_MUTEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ASYNC_MUTEX, AsyncMutex))
#define ASYNC_MUTEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ASYNC_MUTEX, AsyncMutexClass))
#define IS_ASYNC_MUTEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ASYNC_MUTEX))
#define IS_ASYNC_MUTEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ASYNC_MUTEX))
#define ASYNC_MUTEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ASYNC_MUTEX, AsyncMutexClass))

typedef struct _AsyncMutex AsyncMutex;
typedef struct _AsyncMutexClass AsyncMutexClass;
enum  {
	SIDELOAD_FLATPAK_REF_FILE_0_PROPERTY,
	SIDELOAD_FLATPAK_REF_FILE_NUM_PROPERTIES
};
static GParamSpec* sideload_flatpak_ref_file_properties[SIDELOAD_FLATPAK_REF_FILE_NUM_PROPERTIES];
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
#define _async_mutex_unref0(var) ((var == NULL) ? NULL : (var = (async_mutex_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _SideloadFlatpakRefFileGetBytesData SideloadFlatpakRefFileGetBytesData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _SideloadFlatpakRefFileLoadKeyFileData SideloadFlatpakRefFileLoadKeyFileData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _SideloadFlatpakRefFileGetIdData SideloadFlatpakRefFileGetIdData;
typedef struct _SideloadFlatpakRefFileGetNameData SideloadFlatpakRefFileGetNameData;
typedef struct _SideloadFlatpakRefFileGetBranchData SideloadFlatpakRefFileGetBranchData;
typedef struct _Block6Data Block6Data;
typedef struct _Block7Data Block7Data;
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
typedef struct _SideloadFlatpakRefFileDryRunData SideloadFlatpakRefFileDryRunData;
typedef struct _SideloadFlatpakRefFileGetDetailsData SideloadFlatpakRefFileGetDetailsData;
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
typedef struct _SideloadFlatpakRefFileInstallData SideloadFlatpakRefFileInstallData;
typedef struct _Block10Data Block10Data;
typedef struct _SideloadFlatpakRefFileLaunchData SideloadFlatpakRefFileLaunchData;
typedef enum  {
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DEVICES = 1 << 0,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_FULL = 1 << 1,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_READ = 1 << 2,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_ESCAPE_SANDBOX = 1 << 3,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_FULL = 1 << 4,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_OTHER = 1 << 5,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_READ = 1 << 6,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL = 1 << 7,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_READ = 1 << 8,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_NETWORK = 1 << 9,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_NONE = 1 << 10,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SESSION_BUS = 1 << 11,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SETTINGS = 1 << 12,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SYSTEM_BUS = 1 << 13,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_UNKNOWN = 1 << 14,
	SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_X11 = 1 << 15
} SideloadFlatpakFilePermissionsFlags;

#define SIDELOAD_FLATPAK_FILE_TYPE_PERMISSIONS_FLAGS (sideload_flatpak_file_permissions_flags_get_type ())

#define SIDELOAD_FLATPAK_REF_FILE_TYPE_FILESYSTEMS_ACCESS (sideload_flatpak_ref_file_filesystems_access_get_type ())
typedef struct _SideloadFlatpakRefFileFilesystemsAccess SideloadFlatpakRefFileFilesystemsAccess;

struct _SideloadFlatpakFile {
	GObject parent_instance;
	SideloadFlatpakFilePrivate * priv;
	gchar* appdata_name;
	gint error_code;
	gchar* error_message;
};

struct _SideloadFlatpakFileClass {
	GObjectClass parent_class;
	void (*get_id) (SideloadFlatpakFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gchar* (*get_id_finish) (SideloadFlatpakFile* self, GAsyncResult* _res_);
	void (*get_name) (SideloadFlatpakFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gchar* (*get_name_finish) (SideloadFlatpakFile* self, GAsyncResult* _res_);
	void (*get_details) (SideloadFlatpakFile* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*get_details_finish) (SideloadFlatpakFile* self, GAsyncResult* _res_);
	void (*install) (SideloadFlatpakFile* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*install_finish) (SideloadFlatpakFile* self, GAsyncResult* _res_, GError** error);
	void (*launch) (SideloadFlatpakFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*launch_finish) (SideloadFlatpakFile* self, GAsyncResult* _res_);
};

struct _SideloadFlatpakRefFile {
	SideloadFlatpakFile parent_instance;
	SideloadFlatpakRefFilePrivate * priv;
};

struct _SideloadFlatpakRefFileClass {
	SideloadFlatpakFileClass parent_class;
};

struct _SideloadFlatpakRefFilePrivate {
	GBytes* bytes;
	GKeyFile* key_file;
	guint total_operations;
	gint current_operation;
	AsyncMutex* keyfile_mutex;
};

struct _SideloadFlatpakRefFileGetBytesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	GBytes* result;
	GBytes* _tmp0_;
	GBytes* _tmp1_;
	GBytes* _tmp2_;
	GBytes* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	GBytes* _tmp6_;
	GBytes* _tmp7_;
	GBytes* _tmp8_;
	GBytes* _tmp9_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileLoadKeyFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	gboolean result;
	AsyncMutex* _tmp0_;
	gboolean _result_;
	GKeyFile* _tmp1_;
	GKeyFile* _tmp2_;
	GBytes* _tmp3_;
	GBytes* _tmp4_;
	gboolean _tmp5_;
	GKeyFile* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	AsyncMutex* _tmp9_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileGetIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	gchar* result;
	gchar* _tmp0_;
	GKeyFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileGetNameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	gchar* result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* name;
	gchar* _tmp3_;
	GKeyFile* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	gboolean _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileGetBranchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	gchar* result;
	gchar* _tmp0_;
	GKeyFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	GError* _inner_error0_;
};

struct _Block6Data {
	int _ref_count_;
	SideloadFlatpakRefFile* self;
	GeeArrayList* added_remotes;
	GCancellable* cancellable;
	gpointer _async_data_;
};

struct _Block7Data {
	int _ref_count_;
	Block6Data * _data6_;
	guint64 total_download_size;
	gchar* flatpakref_id;
	FlatpakTransaction* transaction;
	GError* transaction_error;
};

struct _SideloadFlatpakRefFileDryRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	GCancellable* cancellable;
	Block6Data* _data6_;
	FlatpakInstallation* _tmp0_;
	GError* _tmp1_;
	GeeArrayList* _tmp2_;
	Block7Data* _data7_;
	gchar* _tmp3_;
	GBytes* bytes;
	GBytes* _tmp4_;
	FlatpakInstallation* _tmp5_;
	FlatpakTransaction* _tmp6_;
	FlatpakTransaction* _tmp7_;
	FlatpakTransaction* _tmp8_;
	GBytes* _tmp9_;
	FlatpakTransaction* _tmp10_;
	FlatpakTransaction* _tmp11_;
	GThread* _tmp12_;
	GThread* _tmp13_;
	GPtrArray* _tmp14_;
	FlatpakInstallation* _tmp15_;
	GPtrArray* _tmp16_;
	GError* _tmp17_;
	GError* _tmp18_;
	GError* _tmp19_;
	GError* e;
	GError* _tmp20_;
	GError* _tmp21_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileGetDetailsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	GCancellable* cancellable;
	GError* e;
	GError* _tmp0_;
	GError* _tmp1_;
	GError* _tmp2_;
	const gchar* _tmp3_;
	GError* _inner_error1_;
	GError* _inner_error0_;
};

struct _Block8Data {
	int _ref_count_;
	SideloadFlatpakRefFile* self;
	GCancellable* cancellable;
	gpointer _async_data_;
};

struct _Block9Data {
	int _ref_count_;
	Block8Data * _data8_;
	FlatpakTransaction* transaction;
};

struct _SideloadFlatpakRefFileInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	GCancellable* cancellable;
	Block8Data* _data8_;
	FlatpakInstallation* _tmp0_;
	GError* _tmp1_;
	Block9Data* _data9_;
	GBytes* bytes;
	GBytes* _tmp2_;
	FlatpakInstallation* _tmp3_;
	FlatpakTransaction* _tmp4_;
	FlatpakTransaction* _tmp5_;
	FlatpakTransaction* _tmp6_;
	GBytes* _tmp7_;
	FlatpakTransaction* _tmp8_;
	FlatpakTransaction* _tmp9_;
	FlatpakTransaction* _tmp10_;
	FlatpakTransaction* _tmp11_;
	FlatpakTransaction* _tmp12_;
	FlatpakTransaction* _tmp13_;
	GError* e;
	GError* _tmp14_;
	GError* _tmp15_;
	GError* _inner_error0_;
};

struct _Block10Data {
	int _ref_count_;
	SideloadFlatpakRefFile* self;
	FlatpakTransactionProgress* progress;
	GCancellable* cancellable;
};

struct _SideloadFlatpakRefFileLaunchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SideloadFlatpakRefFile* self;
	FlatpakInstallation* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* e;
	GError* _tmp5_;
	const gchar* _tmp6_;
	GError* _inner_error0_;
};

struct _SideloadFlatpakRefFileFilesystemsAccess {
	gchar* key;
	SideloadFlatpakFilePermissionsFlags permission;
};

static gint SideloadFlatpakRefFile_private_offset;
static gpointer sideload_flatpak_ref_file_parent_class = NULL;
VALA_EXTERN FlatpakInstallation* sideload_flatpak_file_installation;

VALA_EXTERN GType sideload_flatpak_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadFlatpakFile, g_object_unref)
VALA_EXTERN GType sideload_flatpak_ref_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SideloadFlatpakRefFile, g_object_unref)
VALA_EXTERN gpointer async_mutex_ref (gpointer instance);
VALA_EXTERN void async_mutex_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_async_mutex (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags);
VALA_EXTERN void value_set_async_mutex (GValue* value,
                            gpointer v_object);
VALA_EXTERN void value_take_async_mutex (GValue* value,
                             gpointer v_object);
VALA_EXTERN gpointer value_get_async_mutex (const GValue* value);
VALA_EXTERN GType async_mutex_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AsyncMutex, async_mutex_unref)
VALA_EXTERN void sideload_flatpak_file_get_id (SideloadFlatpakFile* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN gchar* sideload_flatpak_file_get_id_finish (SideloadFlatpakFile* self,
                                            GAsyncResult* _res_);
VALA_EXTERN void sideload_flatpak_file_get_name (SideloadFlatpakFile* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN gchar* sideload_flatpak_file_get_name_finish (SideloadFlatpakFile* self,
                                              GAsyncResult* _res_);
VALA_EXTERN void sideload_flatpak_file_get_details (SideloadFlatpakFile* self,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_get_details_finish (SideloadFlatpakFile* self,
                                               GAsyncResult* _res_);
VALA_EXTERN void sideload_flatpak_file_install (SideloadFlatpakFile* self,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_install_finish (SideloadFlatpakFile* self,
                                           GAsyncResult* _res_,
                                           GError** error);
VALA_EXTERN void sideload_flatpak_file_launch (SideloadFlatpakFile* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_launch_finish (SideloadFlatpakFile* self,
                                          GAsyncResult* _res_);
VALA_EXTERN AsyncMutex* async_mutex_new (void);
VALA_EXTERN AsyncMutex* async_mutex_construct (GType object_type);
VALA_EXTERN SideloadFlatpakRefFile* sideload_flatpak_ref_file_new (GFile* file);
VALA_EXTERN SideloadFlatpakRefFile* sideload_flatpak_ref_file_construct (GType object_type,
                                                             GFile* file);
static void sideload_flatpak_ref_file_get_bytes_data_free (gpointer _data);
static void sideload_flatpak_ref_file_get_bytes (SideloadFlatpakRefFile* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static GBytes* sideload_flatpak_ref_file_get_bytes_finish (SideloadFlatpakRefFile* self,
                                                    GAsyncResult* _res_,
                                                    GError** error);
static gboolean sideload_flatpak_ref_file_get_bytes_co (SideloadFlatpakRefFileGetBytesData* _data_);
VALA_EXTERN GFile* sideload_flatpak_file_get_file (SideloadFlatpakFile* self);
static void sideload_flatpak_ref_file_get_bytes_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void sideload_flatpak_ref_file_load_key_file_data_free (gpointer _data);
static void sideload_flatpak_ref_file_load_key_file (SideloadFlatpakRefFile* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_load_key_file_finish (SideloadFlatpakRefFile* self,
                                                         GAsyncResult* _res_);
static gboolean sideload_flatpak_ref_file_load_key_file_co (SideloadFlatpakRefFileLoadKeyFileData* _data_);
VALA_EXTERN void async_mutex_lock (AsyncMutex* self,
                       GAsyncReadyCallback _callback_,
                       gpointer _user_data_);
VALA_EXTERN void async_mutex_lock_finish (AsyncMutex* self,
                              GAsyncResult* _res_);
static void sideload_flatpak_ref_file_load_key_file_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
VALA_EXTERN void async_mutex_unlock (AsyncMutex* self);
static void sideload_flatpak_ref_file_real_get_id_data_free (gpointer _data);
static void sideload_flatpak_ref_file_real_get_id (SideloadFlatpakFile* base,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_real_get_id_co (SideloadFlatpakRefFileGetIdData* _data_);
static void sideload_flatpak_ref_file_get_id_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static void sideload_flatpak_ref_file_real_get_name_data_free (gpointer _data);
static void sideload_flatpak_ref_file_real_get_name (SideloadFlatpakFile* base,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_real_get_name_co (SideloadFlatpakRefFileGetNameData* _data_);
static void sideload_flatpak_ref_file_get_name_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void sideload_flatpak_ref_file_get_branch_data_free (gpointer _data);
static void sideload_flatpak_ref_file_get_branch (SideloadFlatpakRefFile* self,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static gchar* sideload_flatpak_ref_file_get_branch_finish (SideloadFlatpakRefFile* self,
                                                    GAsyncResult* _res_);
static gboolean sideload_flatpak_ref_file_get_branch_co (SideloadFlatpakRefFileGetBranchData* _data_);
static void sideload_flatpak_ref_file_get_branch_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void sideload_flatpak_ref_file_dry_run_data_free (gpointer _data);
static void sideload_flatpak_ref_file_dry_run (SideloadFlatpakRefFile* self,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static void sideload_flatpak_ref_file_dry_run_finish (SideloadFlatpakRefFile* self,
                                               GAsyncResult* _res_,
                                               GError** error);
static gboolean sideload_flatpak_ref_file_dry_run_co (SideloadFlatpakRefFileDryRunData* _data_);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void sideload_flatpak_ref_file_dry_run_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static gboolean ___lambda7_ (Block7Data* _data7_,
                      FlatpakTransactionRemoteReason reason,
                      const gchar* from_id,
                      const gchar* remote_name,
                      const gchar* url);
VALA_EXTERN void sideload_flatpak_file_set_extra_remotes_needed (SideloadFlatpakFile* self,
                                                     gboolean value);
static gboolean ____lambda7__flatpak_transaction_add_new_remote (FlatpakTransaction* _sender,
                                                          FlatpakTransactionRemoteReason reason,
                                                          const gchar* from_id,
                                                          const gchar* remote_name,
                                                          const gchar* url,
                                                          gpointer self);
static gboolean ___lambda8_ (Block7Data* _data7_);
static void __lambda9_ (Block7Data* _data7_,
                 FlatpakTransactionOperation* entry);
VALA_EXTERN gboolean sideload_flatpak_file_parse_xml (SideloadFlatpakFile* self,
                                          GFile* appstream_file,
                                          const gchar* id);
static void sideload_flatpak_ref_file_set_permissionflags_from_metadata (SideloadFlatpakRefFile* self,
                                                                  GKeyFile* keyfile);
static void ___lambda9__gfunc (gconstpointer data,
                        gpointer self);
VALA_EXTERN void sideload_flatpak_file_set_size (SideloadFlatpakFile* self,
                                     const gchar* value);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gboolean ____lambda8__flatpak_transaction_ready (FlatpakTransaction* _sender,
                                                 gpointer self);
static void* ___lambda10_ (Block7Data* _data7_);
static gboolean _sideload_flatpak_ref_file_dry_run_co_gsource_func (gpointer self);
static gpointer ____lambda10__gthread_func (gpointer self);
static void ___lambda11_ (Block7Data* _data7_,
                   FlatpakRemote* remote);
static void ____lambda11__gfunc (gconstpointer data,
                          gpointer self);
static void sideload_flatpak_ref_file_real_get_details_data_free (gpointer _data);
static void sideload_flatpak_ref_file_real_get_details (SideloadFlatpakFile* base,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_real_get_details_co (SideloadFlatpakRefFileGetDetailsData* _data_);
static void sideload_flatpak_ref_file_get_details_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_set_already_installed (SideloadFlatpakFile* self,
                                                  gboolean value);
static void sideload_flatpak_ref_file_real_install_data_free (gpointer _data);
static void sideload_flatpak_ref_file_real_install (SideloadFlatpakFile* base,
                                             GCancellable* cancellable,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_real_install_co (SideloadFlatpakRefFileInstallData* _data_);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void sideload_flatpak_ref_file_install_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void ___lambda12_ (Block9Data* _data9_,
                   FlatpakTransactionOperation* operation,
                   FlatpakTransactionProgress* progress);
static void sideload_flatpak_ref_file_on_new_operation (SideloadFlatpakRefFile* self,
                                                 FlatpakTransactionOperation* operation,
                                                 FlatpakTransactionProgress* progress,
                                                 GCancellable* cancellable);
static void ____lambda12__flatpak_transaction_new_operation (FlatpakTransaction* _sender,
                                                      FlatpakTransactionOperation* operation,
                                                      FlatpakTransactionProgress* progress,
                                                      gpointer self);
static gboolean ___lambda15_ (SideloadFlatpakRefFile* self,
                       FlatpakTransactionRemoteReason reason,
                       const gchar* from,
                       const gchar* name,
                       const gchar* url);
static gboolean ____lambda15__flatpak_transaction_add_new_remote (FlatpakTransaction* _sender,
                                                           FlatpakTransactionRemoteReason reason,
                                                           const gchar* from_id,
                                                           const gchar* remote_name,
                                                           const gchar* url,
                                                           gpointer self);
VALA_EXTERN gboolean sideload_flatpak_file_on_operation_error (SideloadFlatpakFile* self,
                                                   FlatpakTransactionOperation* op,
                                                   GError* e,
                                                   FlatpakTransactionErrorDetails details);
static gboolean _sideload_flatpak_file_on_operation_error_flatpak_transaction_operation_error (FlatpakTransaction* _sender,
                                                                                        FlatpakTransactionOperation* operation,
                                                                                        GError* _error_,
                                                                                        FlatpakTransactionErrorDetails detail,
                                                                                        gpointer self);
static gint ___lambda16_ (SideloadFlatpakRefFile* self,
                   const gchar* ref,
                   const gchar* runtime_ref,
                   gchar** remotes);
static gint ____lambda16__flatpak_transaction_choose_remote_for_ref (FlatpakTransaction* _sender,
                                                              const gchar* for_ref,
                                                              const gchar* runtime_ref,
                                                              gchar** remotes,
                                                              gpointer self);
static gboolean ___lambda17_ (Block9Data* _data9_);
static gboolean ____lambda17__flatpak_transaction_ready (FlatpakTransaction* _sender,
                                                  gpointer self);
VALA_EXTERN void sideload_flatpak_file_run_transaction_async (SideloadFlatpakFile* self,
                                                  FlatpakTransaction* transaction,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN void sideload_flatpak_file_run_transaction_finish (SideloadFlatpakFile* self,
                                                   GAsyncResult* _res_);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void __lambda13_ (Block10Data* _data10_);
static gboolean __lambda14_ (Block10Data* _data10_);
static gboolean ___lambda14__gsource_func (gpointer self);
static void ___lambda13__flatpak_transaction_progress_changed (FlatpakTransactionProgress* _sender,
                                                        gpointer self);
static void sideload_flatpak_ref_file_real_launch_data_free (gpointer _data);
static void sideload_flatpak_ref_file_real_launch (SideloadFlatpakFile* base,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean sideload_flatpak_ref_file_real_launch_co (SideloadFlatpakRefFileLaunchData* _data_);
static void sideload_flatpak_ref_file_launch_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
VALA_EXTERN GType sideload_flatpak_file_permissions_flags_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SideloadFlatpakFilePermissionsFlags sideload_flatpak_file_get_permissions_flags (SideloadFlatpakFile* self);
VALA_EXTERN void sideload_flatpak_file_set_permissions_flags (SideloadFlatpakFile* self,
                                                  SideloadFlatpakFilePermissionsFlags value);
static GType sideload_flatpak_ref_file_filesystems_access_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static SideloadFlatpakRefFileFilesystemsAccess* sideload_flatpak_ref_file_filesystems_access_dup (const SideloadFlatpakRefFileFilesystemsAccess* self);
static void sideload_flatpak_ref_file_filesystems_access_free (SideloadFlatpakRefFileFilesystemsAccess* self);
static void sideload_flatpak_ref_file_filesystems_access_copy (const SideloadFlatpakRefFileFilesystemsAccess* self,
                                                        SideloadFlatpakRefFileFilesystemsAccess* dest);
static void sideload_flatpak_ref_file_filesystems_access_destroy (SideloadFlatpakRefFileFilesystemsAccess* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SideloadFlatpakRefFileFilesystemsAccess, sideload_flatpak_ref_file_filesystems_access_destroy)
static void _vala_SideloadFlatpakRefFileFilesystemsAccess_array_destroy (SideloadFlatpakRefFileFilesystemsAccess * array,
                                                                  gssize array_length);
static void sideload_flatpak_ref_file_finalize (GObject * obj);
static GType sideload_flatpak_ref_file_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
sideload_flatpak_ref_file_get_instance_private (SideloadFlatpakRefFile* self)
{
	return G_STRUCT_MEMBER_P (self, SideloadFlatpakRefFile_private_offset);
}

SideloadFlatpakRefFile*
sideload_flatpak_ref_file_construct (GType object_type,
                                     GFile* file)
{
	SideloadFlatpakRefFile * self = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (SideloadFlatpakRefFile*) g_object_new (object_type, "file", file, NULL);
	return self;
}

SideloadFlatpakRefFile*
sideload_flatpak_ref_file_new (GFile* file)
{
	return sideload_flatpak_ref_file_construct (SIDELOAD_TYPE_FLATPAK_REF_FILE, file);
}

static void
sideload_flatpak_ref_file_get_bytes_data_free (gpointer _data)
{
	SideloadFlatpakRefFileGetBytesData* _data_;
	_data_ = _data;
	_g_bytes_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileGetBytesData, _data_);
}

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

static void
sideload_flatpak_ref_file_get_bytes (SideloadFlatpakRefFile* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	SideloadFlatpakRefFileGetBytesData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SideloadFlatpakRefFileGetBytesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_get_bytes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_get_bytes_co (_data_);
}

static GBytes*
sideload_flatpak_ref_file_get_bytes_finish (SideloadFlatpakRefFile* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	GBytes* result;
	SideloadFlatpakRefFileGetBytesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gpointer
_g_bytes_ref0 (gpointer self)
{
	return self ? g_bytes_ref (self) : NULL;
}

static void
sideload_flatpak_ref_file_get_bytes_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	SideloadFlatpakRefFileGetBytesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_get_bytes_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_get_bytes_co (SideloadFlatpakRefFileGetBytesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->bytes;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = _data_->self->priv->bytes;
		_data_->_tmp2_ = _g_bytes_ref0 (_data_->_tmp1_);
		_data_->result = _data_->_tmp2_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = sideload_flatpak_file_get_file ((SideloadFlatpakFile*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_state_ = 1;
	g_file_load_bytes_async (_data_->_tmp5_, NULL, sideload_flatpak_ref_file_get_bytes_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = g_file_load_bytes_finish (_data_->_tmp5_, _data_->_res_, NULL, &_data_->_inner_error0_);
	_data_->_tmp3_ = _data_->_tmp6_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = _data_->_tmp3_;
	_data_->_tmp3_ = NULL;
	_g_bytes_unref0 (_data_->self->priv->bytes);
	_data_->self->priv->bytes = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->self->priv->bytes;
	_data_->_tmp9_ = _g_bytes_ref0 (_data_->_tmp8_);
	_data_->result = _data_->_tmp9_;
	_g_bytes_unref0 (_data_->_tmp3_);
	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
sideload_flatpak_ref_file_load_key_file_data_free (gpointer _data)
{
	SideloadFlatpakRefFileLoadKeyFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileLoadKeyFileData, _data_);
}

static void
sideload_flatpak_ref_file_load_key_file (SideloadFlatpakRefFile* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	SideloadFlatpakRefFileLoadKeyFileData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SideloadFlatpakRefFileLoadKeyFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_load_key_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_load_key_file_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_load_key_file_finish (SideloadFlatpakRefFile* self,
                                                GAsyncResult* _res_)
{
	gboolean result;
	SideloadFlatpakRefFileLoadKeyFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
sideload_flatpak_ref_file_load_key_file_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	SideloadFlatpakRefFileLoadKeyFileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_load_key_file_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_load_key_file_co (SideloadFlatpakRefFileLoadKeyFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->keyfile_mutex;
	_data_->_state_ = 1;
	async_mutex_lock (_data_->_tmp0_, sideload_flatpak_ref_file_load_key_file_ready, _data_);
	return FALSE;
	_state_1:
	async_mutex_lock_finish (_data_->_tmp0_, _data_->_res_);
	_data_->_result_ = FALSE;
	_data_->_tmp1_ = _data_->self->priv->key_file;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = g_key_file_new ();
		_g_key_file_unref0 (_data_->self->priv->key_file);
		_data_->self->priv->key_file = _data_->_tmp2_;
		{
			_data_->_state_ = 2;
			sideload_flatpak_ref_file_get_bytes (_data_->self, sideload_flatpak_ref_file_load_key_file_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp4_ = sideload_flatpak_ref_file_get_bytes_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp3_ = _data_->_tmp4_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_data_->_tmp6_ = _data_->self->priv->key_file;
			_data_->_tmp5_ = g_key_file_load_from_bytes (_data_->_tmp6_, _data_->_tmp3_, G_KEY_FILE_NONE, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_bytes_unref0 (_data_->_tmp3_);
				goto __catch0_g_error;
			}
			_data_->_result_ = _data_->_tmp5_;
			_g_bytes_unref0 (_data_->_tmp3_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp7_ = _data_->e;
			_data_->_tmp8_ = _data_->_tmp7_->message;
			g_warning ("FlatpakRefFile.vala:58: %s", _data_->_tmp8_);
			_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;
		}
	} else {
		_data_->_result_ = TRUE;
	}
	_data_->_tmp9_ = _data_->self->priv->keyfile_mutex;
	async_mutex_unlock (_data_->_tmp9_);
	_data_->result = _data_->_result_;
	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
sideload_flatpak_ref_file_real_get_id_data_free (gpointer _data)
{
	SideloadFlatpakRefFileGetIdData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileGetIdData, _data_);
}

static void
sideload_flatpak_ref_file_real_get_id (SideloadFlatpakFile* base,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	SideloadFlatpakRefFile * self;
	SideloadFlatpakRefFileGetIdData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	self = (SideloadFlatpakRefFile*) base;
	_data_ = g_slice_new0 (SideloadFlatpakRefFileGetIdData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_real_get_id_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_real_get_id_co (_data_);
}

static gchar*
sideload_flatpak_ref_file_get_id_finish (SideloadFlatpakFile* base,
                                         GAsyncResult* _res_)
{
	gchar* result;
	SideloadFlatpakRefFileGetIdData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
sideload_flatpak_ref_file_get_id_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	SideloadFlatpakRefFileGetIdData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_real_get_id_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_real_get_id_co (SideloadFlatpakRefFileGetIdData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	sideload_flatpak_ref_file_load_key_file (_data_->self, sideload_flatpak_ref_file_get_id_ready, _data_);
	return FALSE;
	_state_1:
	if (!sideload_flatpak_ref_file_load_key_file_finish (_data_->self, _data_->_res_)) {
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp1_ = _data_->self->priv->key_file;
		_data_->_tmp2_ = g_key_file_get_string (_data_->_tmp1_, SIDELOAD_FLATPAK_REF_FILE_REF_GROUP, "Name", &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_data_->result = _data_->_tmp3_;
		_g_free0 (_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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		g_warning ("FlatpakRefFile.vala:76: %s", _data_->_tmp5_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	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;
}

static void
sideload_flatpak_ref_file_real_get_name_data_free (gpointer _data)
{
	SideloadFlatpakRefFileGetNameData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileGetNameData, _data_);
}

static void
sideload_flatpak_ref_file_real_get_name (SideloadFlatpakFile* base,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	SideloadFlatpakRefFile * self;
	SideloadFlatpakRefFileGetNameData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	self = (SideloadFlatpakRefFile*) base;
	_data_ = g_slice_new0 (SideloadFlatpakRefFileGetNameData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_real_get_name_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_real_get_name_co (_data_);
}

static gchar*
sideload_flatpak_ref_file_get_name_finish (SideloadFlatpakFile* base,
                                           GAsyncResult* _res_)
{
	gchar* result;
	SideloadFlatpakRefFileGetNameData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
sideload_flatpak_ref_file_get_name_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	SideloadFlatpakRefFileGetNameData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_real_get_name_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_real_get_name_co (SideloadFlatpakRefFileGetNameData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((SideloadFlatpakFile*) _data_->self)->appdata_name;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = ((SideloadFlatpakFile*) _data_->self)->appdata_name;
		_data_->_tmp2_ = g_strdup (_data_->_tmp1_);
		_data_->result = _data_->_tmp2_;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 1;
	sideload_flatpak_ref_file_load_key_file (_data_->self, sideload_flatpak_ref_file_get_name_ready, _data_);
	return FALSE;
	_state_1:
	if (!sideload_flatpak_ref_file_load_key_file_finish (_data_->self, _data_->_res_)) {
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->name = NULL;
	{
		_data_->_tmp4_ = _data_->self->priv->key_file;
		_data_->_tmp5_ = g_key_file_get_string (_data_->_tmp4_, SIDELOAD_FLATPAK_REF_FILE_REF_GROUP, "Title", &_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_->name);
		_data_->name = _data_->_tmp6_;
		_g_free0 (_data_->_tmp3_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("FlatpakRefFile.vala:99: %s", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_free0 (_data_->name);
		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_->name;
	if (_data_->_tmp10_ != NULL) {
		_data_->_tmp11_ = _data_->name;
		_data_->_tmp9_ = g_strcmp0 (_data_->_tmp11_, "") != 0;
	} else {
		_data_->_tmp9_ = FALSE;
	}
	if (_data_->_tmp9_) {
		_data_->result = _data_->name;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 2;
	sideload_flatpak_file_get_id ((SideloadFlatpakFile*) _data_->self, sideload_flatpak_ref_file_get_name_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp12_ = sideload_flatpak_file_get_id_finish ((SideloadFlatpakFile*) _data_->self, _data_->_res_);
	_data_->result = _data_->_tmp12_;
	_g_free0 (_data_->name);
	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
sideload_flatpak_ref_file_get_branch_data_free (gpointer _data)
{
	SideloadFlatpakRefFileGetBranchData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileGetBranchData, _data_);
}

static void
sideload_flatpak_ref_file_get_branch (SideloadFlatpakRefFile* self,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	SideloadFlatpakRefFileGetBranchData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SideloadFlatpakRefFileGetBranchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_get_branch_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_get_branch_co (_data_);
}

static gchar*
sideload_flatpak_ref_file_get_branch_finish (SideloadFlatpakRefFile* self,
                                             GAsyncResult* _res_)
{
	gchar* result;
	SideloadFlatpakRefFileGetBranchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
sideload_flatpak_ref_file_get_branch_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	SideloadFlatpakRefFileGetBranchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_get_branch_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_get_branch_co (SideloadFlatpakRefFileGetBranchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	sideload_flatpak_ref_file_load_key_file (_data_->self, sideload_flatpak_ref_file_get_branch_ready, _data_);
	return FALSE;
	_state_1:
	if (!sideload_flatpak_ref_file_load_key_file_finish (_data_->self, _data_->_res_)) {
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp1_ = _data_->self->priv->key_file;
		_data_->_tmp2_ = g_key_file_get_string (_data_->_tmp1_, SIDELOAD_FLATPAK_REF_FILE_REF_GROUP, "Branch", &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_data_->result = _data_->_tmp3_;
		_g_free0 (_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;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		g_warning ("FlatpakRefFile.vala:118: %s", _data_->_tmp5_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		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;
	}
	__finally0:
	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;
}

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

static void
sideload_flatpak_ref_file_dry_run (SideloadFlatpakRefFile* self,
                                   GCancellable* cancellable,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	SideloadFlatpakRefFileDryRunData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SideloadFlatpakRefFileDryRunData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_dry_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	sideload_flatpak_ref_file_dry_run_co (_data_);
}

static void
sideload_flatpak_ref_file_dry_run_finish (SideloadFlatpakRefFile* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	SideloadFlatpakRefFileDryRunData* _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_)) {
		SideloadFlatpakRefFile* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->added_remotes);
		_g_object_unref0 (_data6_->cancellable);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		SideloadFlatpakRefFile* self;
		self = _data7_->_data6_->self;
		_g_error_free0 (_data7_->transaction_error);
		_g_object_unref0 (_data7_->transaction);
		_g_free0 (_data7_->flatpakref_id);
		block6_data_unref (_data7_->_data6_);
		_data7_->_data6_ = NULL;
		g_slice_free (Block7Data, _data7_);
	}
}

static void
sideload_flatpak_ref_file_dry_run_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	SideloadFlatpakRefFileDryRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_dry_run_co (_data_);
}

static gboolean
___lambda7_ (Block7Data* _data7_,
             FlatpakTransactionRemoteReason reason,
             const gchar* from_id,
             const gchar* remote_name,
             const gchar* url)
{
	Block6Data* _data6_;
	SideloadFlatpakRefFile* self;
	gboolean result;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	g_return_val_if_fail (from_id != NULL, FALSE);
	g_return_val_if_fail (remote_name != NULL, FALSE);
	g_return_val_if_fail (url != NULL, FALSE);
	if (reason == FLATPAK_TRANSACTION_REMOTE_RUNTIME_DEPS) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _data6_->added_remotes;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, url);
		sideload_flatpak_file_set_extra_remotes_needed ((SideloadFlatpakFile*) self, TRUE);
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
____lambda7__flatpak_transaction_add_new_remote (FlatpakTransaction* _sender,
                                                 FlatpakTransactionRemoteReason reason,
                                                 const gchar* from_id,
                                                 const gchar* remote_name,
                                                 const gchar* url,
                                                 gpointer self)
{
	gboolean result;
	result = ___lambda7_ (self, reason, from_id, remote_name, url);
	return result;
}

static void
__lambda9_ (Block7Data* _data7_,
            FlatpakTransactionOperation* entry)
{
	Block6Data* _data6_;
	SideloadFlatpakRefFile* self;
	GError* _inner_error0_ = NULL;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	g_return_if_fail (entry != NULL);
	{
		FlatpakRef* ref = NULL;
		const gchar* _tmp0_;
		FlatpakRef* _tmp1_;
		gchar* remote_name = NULL;
		const gchar* _tmp2_;
		gchar* _tmp3_;
		FlatpakRefKind kind = 0;
		FlatpakRef* _tmp4_;
		FlatpakRefKind _tmp5_;
		FlatpakRefKind _tmp6_;
		gchar* name = NULL;
		FlatpakRef* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* arch = NULL;
		FlatpakRef* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* branch = NULL;
		FlatpakRef* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		FlatpakRef* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		FlatpakRemoteRef* remote_ref = NULL;
		FlatpakInstallation* _tmp40_;
		const gchar* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		const gchar* _tmp44_;
		FlatpakRemoteRef* _tmp45_;
		GBytes* remote_metadata = NULL;
		FlatpakInstallation* _tmp46_;
		const gchar* _tmp47_;
		FlatpakRemoteRef* _tmp48_;
		GBytes* _tmp49_;
		GBytes* _tmp50_;
		_tmp0_ = flatpak_transaction_operation_get_ref (entry);
		_tmp1_ = flatpak_ref_parse (_tmp0_, &_inner_error0_);
		ref = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = flatpak_transaction_operation_get_remote (entry);
		_tmp3_ = g_strdup (_tmp2_);
		remote_name = _tmp3_;
		_tmp4_ = ref;
		_tmp5_ = flatpak_ref_get_kind (_tmp4_);
		_tmp6_ = _tmp5_;
		kind = _tmp6_;
		_tmp7_ = ref;
		_tmp8_ = flatpak_ref_get_name (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strdup (_tmp9_);
		name = _tmp10_;
		_tmp11_ = ref;
		_tmp12_ = flatpak_ref_get_arch (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = g_strdup (_tmp13_);
		arch = _tmp14_;
		_tmp15_ = ref;
		_tmp16_ = flatpak_ref_get_branch (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = g_strdup (_tmp17_);
		branch = _tmp18_;
		_tmp19_ = ref;
		_tmp20_ = flatpak_ref_get_name (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = _data7_->flatpakref_id;
		if (g_strcmp0 (_tmp21_, _tmp22_) == 0) {
			FlatpakInstallation* _tmp23_;
			const gchar* _tmp24_;
			const gchar* _tmp25_;
			FlatpakRemote* remote = NULL;
			FlatpakInstallation* _tmp26_;
			const gchar* _tmp27_;
			FlatpakRemote* _tmp28_;
			GFile* appstream_dir = NULL;
			FlatpakRemote* _tmp29_;
			const gchar* _tmp30_;
			GFile* _tmp31_;
			GFile* appstream_file = NULL;
			GFile* _tmp32_;
			GFile* _tmp33_;
			GFile* _tmp34_;
			const gchar* _tmp35_;
			_tmp23_ = sideload_flatpak_file_installation;
			_tmp24_ = remote_name;
			_tmp25_ = arch;
			flatpak_installation_update_appstream_sync (_tmp23_, _tmp24_, _tmp25_, NULL, _data6_->cancellable, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (branch);
				_g_free0 (arch);
				_g_free0 (name);
				_g_free0 (remote_name);
				_g_object_unref0 (ref);
				goto __catch0_g_error;
			}
			_tmp26_ = sideload_flatpak_file_installation;
			_tmp27_ = remote_name;
			_tmp28_ = flatpak_installation_get_remote_by_name (_tmp26_, _tmp27_, NULL, &_inner_error0_);
			remote = _tmp28_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (branch);
				_g_free0 (arch);
				_g_free0 (name);
				_g_free0 (remote_name);
				_g_object_unref0 (ref);
				goto __catch0_g_error;
			}
			_tmp29_ = remote;
			_tmp30_ = arch;
			_tmp31_ = flatpak_remote_get_appstream_dir (_tmp29_, _tmp30_);
			appstream_dir = _tmp31_;
			_tmp32_ = appstream_dir;
			_tmp33_ = g_file_get_child (_tmp32_, "appstream.xml.gz");
			appstream_file = _tmp33_;
			_tmp34_ = appstream_file;
			_tmp35_ = _data7_->flatpakref_id;
			if (!sideload_flatpak_file_parse_xml ((SideloadFlatpakFile*) self, _tmp34_, _tmp35_)) {
				GFile* _tmp36_;
				const gchar* _tmp37_;
				gchar* _tmp38_;
				gchar* _tmp39_;
				_tmp36_ = appstream_file;
				_tmp37_ = _data7_->flatpakref_id;
				_tmp38_ = g_strconcat (_tmp37_, ".desktop", NULL);
				_tmp39_ = _tmp38_;
				sideload_flatpak_file_parse_xml ((SideloadFlatpakFile*) self, _tmp36_, _tmp39_);
				_g_free0 (_tmp39_);
			}
			_g_object_unref0 (appstream_file);
			_g_object_unref0 (appstream_dir);
			_g_object_unref0 (remote);
		}
		_tmp40_ = sideload_flatpak_file_installation;
		_tmp41_ = remote_name;
		_tmp42_ = name;
		_tmp43_ = arch;
		_tmp44_ = branch;
		_tmp45_ = flatpak_installation_fetch_remote_ref_sync (_tmp40_, _tmp41_, kind, _tmp42_, _tmp43_, _tmp44_, _data6_->cancellable, &_inner_error0_);
		remote_ref = _tmp45_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (branch);
			_g_free0 (arch);
			_g_free0 (name);
			_g_free0 (remote_name);
			_g_object_unref0 (ref);
			goto __catch0_g_error;
		}
		_tmp46_ = sideload_flatpak_file_installation;
		_tmp47_ = remote_name;
		_tmp48_ = remote_ref;
		_tmp49_ = flatpak_installation_fetch_remote_metadata_sync (_tmp46_, _tmp47_, (FlatpakRef*) _tmp48_, _data6_->cancellable, &_inner_error0_);
		remote_metadata = _tmp49_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (remote_ref);
			_g_free0 (branch);
			_g_free0 (arch);
			_g_free0 (name);
			_g_free0 (remote_name);
			_g_object_unref0 (ref);
			goto __catch0_g_error;
		}
		_tmp50_ = remote_metadata;
		if (_tmp50_ != NULL) {
			GKeyFile* metadata = NULL;
			GKeyFile* _tmp51_;
			GKeyFile* _tmp52_;
			GBytes* _tmp53_;
			GKeyFile* _tmp54_;
			_tmp51_ = g_key_file_new ();
			metadata = _tmp51_;
			_tmp52_ = metadata;
			_tmp53_ = remote_metadata;
			g_key_file_load_from_bytes (_tmp52_, _tmp53_, G_KEY_FILE_NONE, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_key_file_unref0 (metadata);
				_g_bytes_unref0 (remote_metadata);
				_g_object_unref0 (remote_ref);
				_g_free0 (branch);
				_g_free0 (arch);
				_g_free0 (name);
				_g_free0 (remote_name);
				_g_object_unref0 (ref);
				goto __catch0_g_error;
			}
			_tmp54_ = metadata;
			sideload_flatpak_ref_file_set_permissionflags_from_metadata (self, _tmp54_);
			_g_key_file_unref0 (metadata);
		}
		_data7_->total_download_size += flatpak_transaction_operation_get_download_size (entry);
		_g_bytes_unref0 (remote_metadata);
		_g_object_unref0 (remote_ref);
		_g_free0 (branch);
		_g_free0 (arch);
		_g_free0 (name);
		_g_free0 (remote_name);
		_g_object_unref0 (ref);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp55_;
		const gchar* _tmp56_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp55_ = e;
		_tmp56_ = _tmp55_->message;
		g_warning ("FlatpakRefFile.vala:181: Error calculating download size: %s", _tmp56_);
		_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
___lambda9__gfunc (gconstpointer data,
                   gpointer self)
{
	__lambda9_ (self, (FlatpakTransactionOperation*) data);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static gboolean
___lambda8_ (Block7Data* _data7_)
{
	Block6Data* _data6_;
	SideloadFlatpakRefFile* self;
	GList* operations = NULL;
	FlatpakTransaction* _tmp0_;
	GList* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean result;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	_tmp0_ = _data7_->transaction;
	_tmp1_ = flatpak_transaction_get_operations (_tmp0_);
	operations = _tmp1_;
	g_list_foreach (operations, ___lambda9__gfunc, _data7_);
	_tmp2_ = g_format_size_full (_data7_->total_download_size, G_FORMAT_SIZE_DEFAULT);
	_tmp3_ = _tmp2_;
	sideload_flatpak_file_set_size ((SideloadFlatpakFile*) self, _tmp3_);
	_g_free0 (_tmp3_);
	result = FALSE;
	(operations == NULL) ? NULL : (operations = (_g_list_free__g_object_unref0_ (operations), NULL));
	return result;
}

static gboolean
____lambda8__flatpak_transaction_ready (FlatpakTransaction* _sender,
                                        gpointer self)
{
	gboolean result;
	result = ___lambda8_ (self);
	return result;
}

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

static gboolean
_sideload_flatpak_ref_file_dry_run_co_gsource_func (gpointer self)
{
	gboolean result;
	result = sideload_flatpak_ref_file_dry_run_co (self);
	return result;
}

static void*
___lambda10_ (Block7Data* _data7_)
{
	Block6Data* _data6_;
	SideloadFlatpakRefFile* self;
	GError* _inner_error0_ = NULL;
	void* result;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	{
		FlatpakTransaction* _tmp0_;
		_tmp0_ = _data7_->transaction;
		flatpak_transaction_run (_tmp0_, _data6_->cancellable, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		GError* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _g_error_copy0 (_tmp1_);
		_g_error_free0 (_data7_->transaction_error);
		_data7_->transaction_error = _tmp2_;
		_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 NULL;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _sideload_flatpak_ref_file_dry_run_co_gsource_func, _data6_->_async_data_, NULL);
	result = NULL;
	return result;
}

static gpointer
____lambda10__gthread_func (gpointer self)
{
	gpointer result;
	result = ___lambda10_ (self);
	block7_data_unref (self);
	return result;
}

static void
___lambda11_ (Block7Data* _data7_,
              FlatpakRemote* remote)
{
	Block6Data* _data6_;
	SideloadFlatpakRefFile* self;
	GeeArrayList* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	GError* _inner_error0_ = NULL;
	_data6_ = _data7_->_data6_;
	self = _data6_->self;
	g_return_if_fail (remote != NULL);
	_tmp0_ = _data6_->added_remotes;
	_tmp1_ = flatpak_remote_get_url (remote);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, _tmp2_);
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		{
			FlatpakInstallation* _tmp4_;
			const gchar* _tmp5_;
			_tmp4_ = sideload_flatpak_file_installation;
			_tmp5_ = flatpak_remote_get_name (remote);
			flatpak_installation_remove_remote (_tmp4_, _tmp5_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp6_;
			const gchar* _tmp7_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp6_ = e;
			_tmp7_ = _tmp6_->message;
			g_warning ("FlatpakRefFile.vala:211: Error while removing dry run remote: %s", _tmp7_);
			_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__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda11_ (self, (FlatpakRemote*) data);
}

static gboolean
sideload_flatpak_ref_file_dry_run_co (SideloadFlatpakRefFileDryRunData* _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_->_data6_ = g_slice_new0 (Block6Data);
	_data_->_data6_->_ref_count_ = 1;
	_data_->_data6_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data6_->cancellable);
	_data_->_data6_->cancellable = _data_->cancellable;
	_data_->_data6_->_async_data_ = _data_;
	_data_->_tmp0_ = sideload_flatpak_file_installation;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _ ("Did not find suitable Flatpak installation."));
		_data_->_inner_error0_ = _data_->_tmp1_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block6_data_unref (_data_->_data6_);
		_data_->_data6_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL);
	_data_->_data6_->added_remotes = _data_->_tmp2_;
	{
		_data_->_data7_ = g_slice_new0 (Block7Data);
		_data_->_data7_->_ref_count_ = 1;
		_data_->_data7_->_data6_ = block6_data_ref (_data_->_data6_);
		_data_->_data7_->total_download_size = (guint64) -1;
		_data_->_state_ = 1;
		sideload_flatpak_file_get_id ((SideloadFlatpakFile*) _data_->self, sideload_flatpak_ref_file_dry_run_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp3_ = sideload_flatpak_file_get_id_finish ((SideloadFlatpakFile*) _data_->self, _data_->_res_);
		_data_->_data7_->flatpakref_id = _data_->_tmp3_;
		_data_->_state_ = 2;
		sideload_flatpak_ref_file_get_bytes (_data_->self, sideload_flatpak_ref_file_dry_run_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp4_ = sideload_flatpak_ref_file_get_bytes_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->bytes = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = sideload_flatpak_file_installation;
		_data_->_tmp6_ = flatpak_transaction_new_for_installation (_data_->_tmp5_, _data_->_data6_->cancellable, &_data_->_inner_error0_);
		_data_->_data7_->transaction = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->bytes);
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp7_ = _data_->_data7_->transaction;
		flatpak_transaction_add_default_dependency_sources (_data_->_tmp7_);
		_data_->_tmp8_ = _data_->_data7_->transaction;
		_data_->_tmp9_ = _data_->bytes;
		flatpak_transaction_add_install_flatpakref (_data_->_tmp8_, _data_->_tmp9_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->bytes);
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp10_ = _data_->_data7_->transaction;
		g_signal_connect_data (_data_->_tmp10_, "add-new-remote", (GCallback) ____lambda7__flatpak_transaction_add_new_remote, block7_data_ref (_data_->_data7_), (GClosureNotify) block7_data_unref, 0);
		_data_->_tmp11_ = _data_->_data7_->transaction;
		g_signal_connect_data (_data_->_tmp11_, "ready", (GCallback) ____lambda8__flatpak_transaction_ready, block7_data_ref (_data_->_data7_), (GClosureNotify) block7_data_unref, 0);
		_data_->_data7_->transaction_error = NULL;
		_data_->_tmp12_ = g_thread_new ("install-ref", ____lambda10__gthread_func, block7_data_ref (_data_->_data7_));
		_data_->_tmp13_ = _data_->_tmp12_;
		_g_thread_unref0 (_data_->_tmp13_);
		_data_->_state_ = 3;
		return FALSE;
		_state_3:
		;
		_data_->_tmp15_ = sideload_flatpak_file_installation;
		_data_->_tmp16_ = flatpak_installation_list_remotes (_data_->_tmp15_, NULL, &_data_->_inner_error0_);
		_data_->_tmp14_ = _data_->_tmp16_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->bytes);
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
			goto __catch0_g_error;
		}
		g_ptr_array_foreach (_data_->_tmp14_, ____lambda11__gfunc, _data_->_data7_);
		_data_->_tmp17_ = _data_->_data7_->transaction_error;
		if (_data_->_tmp17_ != NULL) {
			_data_->_tmp18_ = _data_->_data7_->transaction_error;
			_data_->_tmp19_ = _g_error_copy0 (_data_->_tmp18_);
			_data_->_inner_error0_ = _data_->_tmp19_;
			_g_ptr_array_unref0 (_data_->_tmp14_);
			_g_bytes_unref0 (_data_->bytes);
			block7_data_unref (_data_->_data7_);
			_data_->_data7_ = NULL;
			goto __catch0_g_error;
		}
		_g_ptr_array_unref0 (_data_->_tmp14_);
		_g_bytes_unref0 (_data_->bytes);
		block7_data_unref (_data_->_data7_);
		_data_->_data7_ = NULL;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp20_ = _data_->e;
		_data_->_tmp21_ = _g_error_copy0 (_data_->_tmp20_);
		_data_->_inner_error0_ = _data_->_tmp21_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block6_data_unref (_data_->_data6_);
		_data_->_data6_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	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
sideload_flatpak_ref_file_real_get_details_data_free (gpointer _data)
{
	SideloadFlatpakRefFileGetDetailsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileGetDetailsData, _data_);
}

static void
sideload_flatpak_ref_file_real_get_details (SideloadFlatpakFile* base,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	SideloadFlatpakRefFile * self;
	SideloadFlatpakRefFileGetDetailsData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	GCancellable* _tmp1_;
	self = (SideloadFlatpakRefFile*) base;
	_data_ = g_slice_new0 (SideloadFlatpakRefFileGetDetailsData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_real_get_details_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	sideload_flatpak_ref_file_real_get_details_co (_data_);
}

static void
sideload_flatpak_ref_file_get_details_finish (SideloadFlatpakFile* base,
                                              GAsyncResult* _res_)
{
	SideloadFlatpakRefFileGetDetailsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static void
sideload_flatpak_ref_file_get_details_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	SideloadFlatpakRefFileGetDetailsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_real_get_details_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_real_get_details_co (SideloadFlatpakRefFileGetDetailsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_state_ = 1;
		sideload_flatpak_ref_file_dry_run (_data_->self, _data_->cancellable, sideload_flatpak_ref_file_get_details_ready, _data_);
		return FALSE;
		_state_1:
		sideload_flatpak_ref_file_dry_run_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp0_ = _data_->e;
		if (g_error_matches (_data_->_tmp0_, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED)) {
			sideload_flatpak_file_set_already_installed ((SideloadFlatpakFile*) _data_->self, TRUE);
		} else {
			_data_->_tmp1_ = _data_->e;
			if (!g_error_matches (_data_->_tmp1_, FLATPAK_ERROR, FLATPAK_ERROR_ABORTED)) {
				_data_->_tmp2_ = _data_->e;
				_data_->_tmp3_ = _data_->_tmp2_->message;
				g_warning ("FlatpakRefFile.vala:231: Error during dry run: %s", _data_->_tmp3_);
			}
		}
		_g_error_free0 (_data_->e);
	}
	__finally0:
	{
		g_signal_emit_by_name ((SideloadFlatpakFile*) _data_->self, "details-ready");
	}
	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;
	}
	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
sideload_flatpak_ref_file_real_install_data_free (gpointer _data)
{
	SideloadFlatpakRefFileInstallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SideloadFlatpakRefFileInstallData, _data_);
}

static void
sideload_flatpak_ref_file_real_install (SideloadFlatpakFile* base,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	SideloadFlatpakRefFile * self;
	SideloadFlatpakRefFileInstallData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (cancellable != NULL);
	self = (SideloadFlatpakRefFile*) base;
	_data_ = g_slice_new0 (SideloadFlatpakRefFileInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_real_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	sideload_flatpak_ref_file_real_install_co (_data_);
}

static void
sideload_flatpak_ref_file_install_finish (SideloadFlatpakFile* base,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	SideloadFlatpakRefFileInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		SideloadFlatpakRefFile* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->cancellable);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		SideloadFlatpakRefFile* self;
		self = _data9_->_data8_->self;
		_g_object_unref0 (_data9_->transaction);
		block8_data_unref (_data9_->_data8_);
		_data9_->_data8_ = NULL;
		g_slice_free (Block9Data, _data9_);
	}
}

static void
sideload_flatpak_ref_file_install_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	SideloadFlatpakRefFileInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_real_install_co (_data_);
}

static void
___lambda12_ (Block9Data* _data9_,
              FlatpakTransactionOperation* operation,
              FlatpakTransactionProgress* progress)
{
	Block8Data* _data8_;
	SideloadFlatpakRefFile* self;
	_data8_ = _data9_->_data8_;
	self = _data8_->self;
	g_return_if_fail (operation != NULL);
	g_return_if_fail (progress != NULL);
	sideload_flatpak_ref_file_on_new_operation (self, operation, progress, _data8_->cancellable);
}

static void
____lambda12__flatpak_transaction_new_operation (FlatpakTransaction* _sender,
                                                 FlatpakTransactionOperation* operation,
                                                 FlatpakTransactionProgress* progress,
                                                 gpointer self)
{
	___lambda12_ (self, operation, progress);
}

static gboolean
___lambda15_ (SideloadFlatpakRefFile* self,
              FlatpakTransactionRemoteReason reason,
              const gchar* from,
              const gchar* name,
              const gchar* url)
{
	gboolean result;
	g_return_val_if_fail (from != NULL, FALSE);
	g_return_val_if_fail (name != NULL, FALSE);
	g_return_val_if_fail (url != NULL, FALSE);
	if (reason == FLATPAK_TRANSACTION_REMOTE_RUNTIME_DEPS) {
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
____lambda15__flatpak_transaction_add_new_remote (FlatpakTransaction* _sender,
                                                  FlatpakTransactionRemoteReason reason,
                                                  const gchar* from_id,
                                                  const gchar* remote_name,
                                                  const gchar* url,
                                                  gpointer self)
{
	gboolean result;
	result = ___lambda15_ ((SideloadFlatpakRefFile*) self, reason, from_id, remote_name, url);
	return result;
}

static gboolean
_sideload_flatpak_file_on_operation_error_flatpak_transaction_operation_error (FlatpakTransaction* _sender,
                                                                               FlatpakTransactionOperation* operation,
                                                                               GError* _error_,
                                                                               FlatpakTransactionErrorDetails detail,
                                                                               gpointer self)
{
	gboolean result;
	result = sideload_flatpak_file_on_operation_error ((SideloadFlatpakFile*) self, operation, _error_, detail);
	return result;
}

static gint
___lambda16_ (SideloadFlatpakRefFile* self,
              const gchar* ref,
              const gchar* runtime_ref,
              gchar** remotes)
{
	gint result;
	g_return_val_if_fail (ref != NULL, 0);
	g_return_val_if_fail (runtime_ref != NULL, 0);
	if (_vala_array_length (remotes) > 0) {
		result = 0;
		return result;
	} else {
		result = -1;
		return result;
	}
}

static gint
____lambda16__flatpak_transaction_choose_remote_for_ref (FlatpakTransaction* _sender,
                                                         const gchar* for_ref,
                                                         const gchar* runtime_ref,
                                                         gchar** remotes,
                                                         gpointer self)
{
	gint result;
	result = ___lambda16_ ((SideloadFlatpakRefFile*) self, for_ref, runtime_ref, remotes);
	return result;
}

static gboolean
___lambda17_ (Block9Data* _data9_)
{
	Block8Data* _data8_;
	SideloadFlatpakRefFile* self;
	FlatpakTransaction* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	gboolean result;
	_data8_ = _data9_->_data8_;
	self = _data8_->self;
	_tmp0_ = _data9_->transaction;
	_tmp1_ = flatpak_transaction_get_operations (_tmp0_);
	_tmp2_ = _tmp1_;
	self->priv->total_operations = g_list_length (_tmp2_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (_g_list_free__g_object_unref0_ (_tmp2_), NULL));
	result = TRUE;
	return result;
}

static gboolean
____lambda17__flatpak_transaction_ready (FlatpakTransaction* _sender,
                                         gpointer self)
{
	gboolean result;
	result = ___lambda17_ (self);
	return result;
}

static gboolean
sideload_flatpak_ref_file_real_install_co (SideloadFlatpakRefFileInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data8_ = g_slice_new0 (Block8Data);
	_data_->_data8_->_ref_count_ = 1;
	_data_->_data8_->self = g_object_ref (_data_->self);
	_g_object_unref0 (_data_->_data8_->cancellable);
	_data_->_data8_->cancellable = _data_->cancellable;
	_data_->_data8_->_async_data_ = _data_;
	_data_->_tmp0_ = sideload_flatpak_file_installation;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _ ("Did not find suitable Flatpak installation."));
		_data_->_inner_error0_ = _data_->_tmp1_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block8_data_unref (_data_->_data8_);
		_data_->_data8_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_data9_ = g_slice_new0 (Block9Data);
		_data_->_data9_->_ref_count_ = 1;
		_data_->_data9_->_data8_ = block8_data_ref (_data_->_data8_);
		_data_->_state_ = 1;
		sideload_flatpak_ref_file_get_bytes (_data_->self, sideload_flatpak_ref_file_install_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = sideload_flatpak_ref_file_get_bytes_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->bytes = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			block9_data_unref (_data_->_data9_);
			_data_->_data9_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = sideload_flatpak_file_installation;
		_data_->_tmp4_ = flatpak_transaction_new_for_installation (_data_->_tmp3_, _data_->_data8_->cancellable, &_data_->_inner_error0_);
		_data_->_data9_->transaction = _data_->_tmp4_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->bytes);
			block9_data_unref (_data_->_data9_);
			_data_->_data9_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp5_ = _data_->_data9_->transaction;
		flatpak_transaction_add_default_dependency_sources (_data_->_tmp5_);
		_data_->_tmp6_ = _data_->_data9_->transaction;
		_data_->_tmp7_ = _data_->bytes;
		flatpak_transaction_add_install_flatpakref (_data_->_tmp6_, _data_->_tmp7_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_bytes_unref0 (_data_->bytes);
			block9_data_unref (_data_->_data9_);
			_data_->_data9_ = NULL;
			goto __catch0_g_error;
		}
		_data_->_tmp8_ = _data_->_data9_->transaction;
		g_signal_connect_data (_data_->_tmp8_, "new-operation", (GCallback) ____lambda12__flatpak_transaction_new_operation, block9_data_ref (_data_->_data9_), (GClosureNotify) block9_data_unref, 0);
		_data_->_tmp9_ = _data_->_data9_->transaction;
		g_signal_connect_object (_data_->_tmp9_, "add-new-remote", (GCallback) ____lambda15__flatpak_transaction_add_new_remote, _data_->self, 0);
		_data_->_tmp10_ = _data_->_data9_->transaction;
		g_signal_connect_object (_data_->_tmp10_, "operation-error", (GCallback) _sideload_flatpak_file_on_operation_error_flatpak_transaction_operation_error, (SideloadFlatpakFile*) _data_->self, 0);
		_data_->_tmp11_ = _data_->_data9_->transaction;
		g_signal_connect_object (_data_->_tmp11_, "choose-remote-for-ref", (GCallback) ____lambda16__flatpak_transaction_choose_remote_for_ref, _data_->self, 0);
		_data_->_tmp12_ = _data_->_data9_->transaction;
		g_signal_connect_data (_data_->_tmp12_, "ready", (GCallback) ____lambda17__flatpak_transaction_ready, block9_data_ref (_data_->_data9_), (GClosureNotify) block9_data_unref, 0);
		_data_->self->priv->current_operation = 0;
		_data_->_tmp13_ = _data_->_data9_->transaction;
		_data_->_state_ = 2;
		sideload_flatpak_file_run_transaction_async ((SideloadFlatpakFile*) _data_->self, _data_->_tmp13_, _data_->_data8_->cancellable, sideload_flatpak_ref_file_install_ready, _data_);
		return FALSE;
		_state_2:
		sideload_flatpak_file_run_transaction_finish ((SideloadFlatpakFile*) _data_->self, _data_->_res_);
		_g_bytes_unref0 (_data_->bytes);
		block9_data_unref (_data_->_data9_);
		_data_->_data9_ = NULL;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp14_ = _data_->e;
		_data_->_tmp15_ = _g_error_copy0 (_data_->_tmp14_);
		_data_->_inner_error0_ = _data_->_tmp15_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block8_data_unref (_data_->_data8_);
		_data_->_data8_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	block8_data_unref (_data_->_data8_);
	_data_->_data8_ = 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 Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		SideloadFlatpakRefFile* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->progress);
		_g_object_unref0 (_data10_->cancellable);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static gboolean
__lambda14_ (Block10Data* _data10_)
{
	SideloadFlatpakRefFile* self;
	gdouble existing_progress = 0.0;
	gdouble this_op_progress = 0.0;
	const gchar* _tmp0_;
	gboolean result;
	self = _data10_->self;
	existing_progress = ((gdouble) (self->priv->current_operation - 1)) / ((gdouble) self->priv->total_operations);
	this_op_progress = (((gdouble) flatpak_transaction_progress_get_progress (_data10_->progress)) / 100.0f) / ((gdouble) self->priv->total_operations);
	_tmp0_ = flatpak_transaction_progress_get_status (_data10_->progress);
	g_signal_emit_by_name ((SideloadFlatpakFile*) self, "progress-changed", _tmp0_, existing_progress + this_op_progress);
	result = FALSE;
	return result;
}

static gboolean
___lambda14__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda14_ (self);
	return result;
}

static void
__lambda13_ (Block10Data* _data10_)
{
	SideloadFlatpakRefFile* self;
	self = _data10_->self;
	if (g_cancellable_is_cancelled (_data10_->cancellable)) {
		return;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda14__gsource_func, block10_data_ref (_data10_), block10_data_unref);
}

static void
___lambda13__flatpak_transaction_progress_changed (FlatpakTransactionProgress* _sender,
                                                   gpointer self)
{
	__lambda13_ (self);
}

static void
sideload_flatpak_ref_file_on_new_operation (SideloadFlatpakRefFile* self,
                                            FlatpakTransactionOperation* operation,
                                            FlatpakTransactionProgress* progress,
                                            GCancellable* cancellable)
{
	Block10Data* _data10_;
	FlatpakTransactionProgress* _tmp0_;
	GCancellable* _tmp1_;
	gint _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (operation != NULL);
	g_return_if_fail (progress != NULL);
	g_return_if_fail (cancellable != NULL);
	_data10_ = g_slice_new0 (Block10Data);
	_data10_->_ref_count_ = 1;
	_data10_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data10_->progress);
	_data10_->progress = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data10_->cancellable);
	_data10_->cancellable = _tmp1_;
	_tmp2_ = self->priv->current_operation;
	self->priv->current_operation = _tmp2_ + 1;
	g_signal_connect_data (_data10_->progress, "changed", (GCallback) ___lambda13__flatpak_transaction_progress_changed, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
	block10_data_unref (_data10_);
	_data10_ = NULL;
}

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

static void
sideload_flatpak_ref_file_real_launch (SideloadFlatpakFile* base,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	SideloadFlatpakRefFile * self;
	SideloadFlatpakRefFileLaunchData* _data_;
	SideloadFlatpakRefFile* _tmp0_;
	self = (SideloadFlatpakRefFile*) base;
	_data_ = g_slice_new0 (SideloadFlatpakRefFileLaunchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sideload_flatpak_ref_file_real_launch_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sideload_flatpak_ref_file_real_launch_co (_data_);
}

static void
sideload_flatpak_ref_file_launch_finish (SideloadFlatpakFile* base,
                                         GAsyncResult* _res_)
{
	SideloadFlatpakRefFileLaunchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
sideload_flatpak_ref_file_launch_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	SideloadFlatpakRefFileLaunchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	sideload_flatpak_ref_file_real_launch_co (_data_);
}

static gboolean
sideload_flatpak_ref_file_real_launch_co (SideloadFlatpakRefFileLaunchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = sideload_flatpak_file_installation;
		_data_->_state_ = 1;
		sideload_flatpak_file_get_id ((SideloadFlatpakFile*) _data_->self, sideload_flatpak_ref_file_launch_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = sideload_flatpak_file_get_id_finish ((SideloadFlatpakFile*) _data_->self, _data_->_res_);
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_state_ = 2;
		sideload_flatpak_ref_file_get_branch (_data_->self, sideload_flatpak_ref_file_launch_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp3_ = sideload_flatpak_ref_file_get_branch_finish (_data_->self, _data_->_res_);
		_data_->_tmp4_ = _data_->_tmp3_;
		flatpak_installation_launch (_data_->_tmp0_, _data_->_tmp2_, NULL, _data_->_tmp4_, NULL, NULL, &_data_->_inner_error0_);
		_g_free0 (_data_->_tmp4_);
		_g_free0 (_data_->_tmp2_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		g_warning ("FlatpakRefFile.vala:304: Error launching app: %s", _data_->_tmp6_);
		_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;
	}
	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 gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
_vala_SideloadFlatpakRefFileFilesystemsAccess_array_destroy (SideloadFlatpakRefFileFilesystemsAccess * array,
                                                             gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			sideload_flatpak_ref_file_filesystems_access_destroy (&array[i]);
		}
	}
}

static void
sideload_flatpak_ref_file_set_permissionflags_from_metadata (SideloadFlatpakRefFile* self,
                                                             GKeyFile* keyfile)
{
	SideloadFlatpakFilePermissionsFlags _tmp102_;
	SideloadFlatpakFilePermissionsFlags _tmp103_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (keyfile != NULL);
	{
		if (g_key_file_has_group (keyfile, "Context")) {
			gchar** sockets_context = NULL;
			gsize _tmp0_ = 0;
			gchar** _tmp1_;
			gint sockets_context_length1;
			gint _sockets_context_size_;
			gchar** _tmp2_;
			gint _tmp2__length1;
			gchar** devices_context = NULL;
			gsize _tmp14_ = 0;
			gchar** _tmp15_;
			gint devices_context_length1;
			gint _devices_context_size_;
			gboolean _tmp16_ = FALSE;
			gchar** _tmp17_;
			gint _tmp17__length1;
			gchar** shared_context = NULL;
			gsize _tmp21_ = 0;
			gchar** _tmp22_;
			gint shared_context_length1;
			gint _shared_context_size_;
			gboolean _tmp23_ = FALSE;
			gchar** _tmp24_;
			gint _tmp24__length1;
			gchar** filesystems_context = NULL;
			gsize _tmp28_ = 0;
			gchar** _tmp29_;
			gint filesystems_context_length1;
			gint _filesystems_context_size_;
			gchar** _tmp30_;
			gint _tmp30__length1;
			_tmp1_ = g_key_file_get_string_list (keyfile, "Context", "sockets", &_tmp0_, &_inner_error0_);
			sockets_context = _tmp1_;
			sockets_context_length1 = _tmp0_;
			_sockets_context_size_ = sockets_context_length1;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp2_ = sockets_context;
			_tmp2__length1 = sockets_context_length1;
			if (_tmp2_ != NULL) {
				gchar** _tmp3_;
				gint _tmp3__length1;
				gchar** _tmp6_;
				gint _tmp6__length1;
				gboolean _tmp9_ = FALSE;
				gchar** _tmp10_;
				gint _tmp10__length1;
				_tmp3_ = sockets_context;
				_tmp3__length1 = sockets_context_length1;
				if (_vala_string_array_contains (_tmp3_, _tmp3__length1, "system-bus")) {
					SideloadFlatpakFilePermissionsFlags _tmp4_;
					SideloadFlatpakFilePermissionsFlags _tmp5_;
					_tmp4_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp5_ = _tmp4_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp5_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SYSTEM_BUS);
				}
				_tmp6_ = sockets_context;
				_tmp6__length1 = sockets_context_length1;
				if (_vala_string_array_contains (_tmp6_, _tmp6__length1, "session-bus")) {
					SideloadFlatpakFilePermissionsFlags _tmp7_;
					SideloadFlatpakFilePermissionsFlags _tmp8_;
					_tmp7_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp8_ = _tmp7_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp8_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SESSION_BUS);
				}
				_tmp10_ = sockets_context;
				_tmp10__length1 = sockets_context_length1;
				if (!_vala_string_array_contains (_tmp10_, _tmp10__length1, "fallback-x11")) {
					gchar** _tmp11_;
					gint _tmp11__length1;
					_tmp11_ = sockets_context;
					_tmp11__length1 = sockets_context_length1;
					_tmp9_ = _vala_string_array_contains (_tmp11_, _tmp11__length1, "x11");
				} else {
					_tmp9_ = FALSE;
				}
				if (_tmp9_) {
					SideloadFlatpakFilePermissionsFlags _tmp12_;
					SideloadFlatpakFilePermissionsFlags _tmp13_;
					_tmp12_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp13_ = _tmp12_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp13_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_X11);
				}
			}
			_tmp15_ = g_key_file_get_string_list (keyfile, "Context", "devices", &_tmp14_, &_inner_error0_);
			devices_context = _tmp15_;
			devices_context_length1 = _tmp14_;
			_devices_context_size_ = devices_context_length1;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				sockets_context = (_vala_array_free (sockets_context, sockets_context_length1, (GDestroyNotify) g_free), NULL);
				goto __catch0_g_error;
			}
			_tmp17_ = devices_context;
			_tmp17__length1 = devices_context_length1;
			if (_tmp17_ != NULL) {
				gchar** _tmp18_;
				gint _tmp18__length1;
				_tmp18_ = devices_context;
				_tmp18__length1 = devices_context_length1;
				_tmp16_ = _vala_string_array_contains (_tmp18_, _tmp18__length1, "all");
			} else {
				_tmp16_ = FALSE;
			}
			if (_tmp16_) {
				SideloadFlatpakFilePermissionsFlags _tmp19_;
				SideloadFlatpakFilePermissionsFlags _tmp20_;
				_tmp19_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp20_ = _tmp19_;
				sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp20_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DEVICES);
			}
			_tmp22_ = g_key_file_get_string_list (keyfile, "Context", "shared", &_tmp21_, &_inner_error0_);
			shared_context = _tmp22_;
			shared_context_length1 = _tmp21_;
			_shared_context_size_ = shared_context_length1;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				devices_context = (_vala_array_free (devices_context, devices_context_length1, (GDestroyNotify) g_free), NULL);
				sockets_context = (_vala_array_free (sockets_context, sockets_context_length1, (GDestroyNotify) g_free), NULL);
				goto __catch0_g_error;
			}
			_tmp24_ = shared_context;
			_tmp24__length1 = shared_context_length1;
			if (_tmp24_ != NULL) {
				gchar** _tmp25_;
				gint _tmp25__length1;
				_tmp25_ = shared_context;
				_tmp25__length1 = shared_context_length1;
				_tmp23_ = _vala_string_array_contains (_tmp25_, _tmp25__length1, "network");
			} else {
				_tmp23_ = FALSE;
			}
			if (_tmp23_) {
				SideloadFlatpakFilePermissionsFlags _tmp26_;
				SideloadFlatpakFilePermissionsFlags _tmp27_;
				_tmp26_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp27_ = _tmp26_;
				sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp27_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_NETWORK);
			}
			_tmp29_ = g_key_file_get_string_list (keyfile, "Context", "filesystems", &_tmp28_, &_inner_error0_);
			filesystems_context = _tmp29_;
			filesystems_context_length1 = _tmp28_;
			_filesystems_context_size_ = filesystems_context_length1;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				shared_context = (_vala_array_free (shared_context, shared_context_length1, (GDestroyNotify) g_free), NULL);
				devices_context = (_vala_array_free (devices_context, devices_context_length1, (GDestroyNotify) g_free), NULL);
				sockets_context = (_vala_array_free (sockets_context, sockets_context_length1, (GDestroyNotify) g_free), NULL);
				goto __catch0_g_error;
			}
			_tmp30_ = filesystems_context;
			_tmp30__length1 = filesystems_context_length1;
			if (_tmp30_ != NULL) {
				SideloadFlatpakRefFileFilesystemsAccess filesystems_access[13] = {0};
				gchar* _tmp31_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp32_ = {0};
				gchar* _tmp33_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp34_ = {0};
				gchar* _tmp35_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp36_ = {0};
				gchar* _tmp37_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp38_ = {0};
				gchar* _tmp39_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp40_ = {0};
				gchar* _tmp41_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp42_ = {0};
				gchar* _tmp43_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp44_ = {0};
				gchar* _tmp45_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp46_ = {0};
				gchar* _tmp47_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp48_ = {0};
				gchar* _tmp49_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp50_ = {0};
				gchar* _tmp51_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp52_ = {0};
				gchar* _tmp53_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp54_ = {0};
				gchar* _tmp55_;
				SideloadFlatpakRefFileFilesystemsAccess _tmp56_ = {0};
				SideloadFlatpakRefFileFilesystemsAccess _tmp57_[13] = {0};
				gint filesystems_hits = 0;
				gchar** _tmp67_;
				gint _tmp67__length1;
				SideloadFlatpakFilePermissionsFlags _tmp70_;
				SideloadFlatpakFilePermissionsFlags _tmp71_;
				SideloadFlatpakFilePermissionsFlags _tmp74_;
				SideloadFlatpakFilePermissionsFlags _tmp75_;
				SideloadFlatpakFilePermissionsFlags _tmp78_;
				SideloadFlatpakFilePermissionsFlags _tmp79_;
				_tmp31_ = g_strdup ("home");
				memset (&_tmp32_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp32_.key);
				_tmp32_.key = _tmp31_;
				_tmp32_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL;
				_tmp33_ = g_strdup ("home:rw");
				memset (&_tmp34_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp34_.key);
				_tmp34_.key = _tmp33_;
				_tmp34_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL;
				_tmp35_ = g_strdup ("home:ro");
				memset (&_tmp36_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp36_.key);
				_tmp36_.key = _tmp35_;
				_tmp36_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_READ;
				_tmp37_ = g_strdup ("~");
				memset (&_tmp38_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp38_.key);
				_tmp38_.key = _tmp37_;
				_tmp38_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL;
				_tmp39_ = g_strdup ("~:rw");
				memset (&_tmp40_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp40_.key);
				_tmp40_.key = _tmp39_;
				_tmp40_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL;
				_tmp41_ = g_strdup ("~:ro");
				memset (&_tmp42_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp42_.key);
				_tmp42_.key = _tmp41_;
				_tmp42_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_READ;
				_tmp43_ = g_strdup ("host");
				memset (&_tmp44_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp44_.key);
				_tmp44_.key = _tmp43_;
				_tmp44_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_FULL;
				_tmp45_ = g_strdup ("host:rw");
				memset (&_tmp46_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp46_.key);
				_tmp46_.key = _tmp45_;
				_tmp46_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_FULL;
				_tmp47_ = g_strdup ("host:ro");
				memset (&_tmp48_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp48_.key);
				_tmp48_.key = _tmp47_;
				_tmp48_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_READ;
				_tmp49_ = g_strdup ("xdg-download");
				memset (&_tmp50_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp50_.key);
				_tmp50_.key = _tmp49_;
				_tmp50_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_FULL;
				_tmp51_ = g_strdup ("xdg-download:rw");
				memset (&_tmp52_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp52_.key);
				_tmp52_.key = _tmp51_;
				_tmp52_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_FULL;
				_tmp53_ = g_strdup ("xdg-download:ro");
				memset (&_tmp54_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp54_.key);
				_tmp54_.key = _tmp53_;
				_tmp54_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_READ;
				_tmp55_ = g_strdup ("xdg-data/flatpak/overrides:create");
				memset (&_tmp56_, 0, sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				_g_free0 (_tmp56_.key);
				_tmp56_.key = _tmp55_;
				_tmp56_.permission = SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_ESCAPE_SANDBOX;
				_tmp57_[0] = _tmp32_;
				_tmp57_[1] = _tmp34_;
				_tmp57_[2] = _tmp36_;
				_tmp57_[3] = _tmp38_;
				_tmp57_[4] = _tmp40_;
				_tmp57_[5] = _tmp42_;
				_tmp57_[6] = _tmp44_;
				_tmp57_[7] = _tmp46_;
				_tmp57_[8] = _tmp48_;
				_tmp57_[9] = _tmp50_;
				_tmp57_[10] = _tmp52_;
				_tmp57_[11] = _tmp54_;
				_tmp57_[12] = _tmp56_;
				memcpy (filesystems_access, _tmp57_, 13 * sizeof (SideloadFlatpakRefFileFilesystemsAccess));
				filesystems_hits = 0;
				{
					gint i = 0;
					i = 0;
					{
						gboolean _tmp58_ = FALSE;
						_tmp58_ = TRUE;
						while (TRUE) {
							SideloadFlatpakRefFileFilesystemsAccess _tmp60_;
							const gchar* _tmp61_;
							gchar** _tmp62_;
							gint _tmp62__length1;
							if (!_tmp58_) {
								gint _tmp59_;
								_tmp59_ = i;
								i = _tmp59_ + 1;
							}
							_tmp58_ = FALSE;
							if (!(i < 13)) {
								break;
							}
							_tmp60_ = filesystems_access[i];
							_tmp61_ = _tmp60_.key;
							_tmp62_ = filesystems_context;
							_tmp62__length1 = filesystems_context_length1;
							if (_vala_string_array_contains (_tmp62_, _tmp62__length1, _tmp61_)) {
								SideloadFlatpakFilePermissionsFlags _tmp63_;
								SideloadFlatpakFilePermissionsFlags _tmp64_;
								SideloadFlatpakRefFileFilesystemsAccess _tmp65_;
								gint _tmp66_;
								_tmp63_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
								_tmp64_ = _tmp63_;
								_tmp65_ = filesystems_access[i];
								sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp64_ | _tmp65_.permission);
								_tmp66_ = filesystems_hits;
								filesystems_hits = _tmp66_ + 1;
							}
						}
					}
				}
				_tmp67_ = filesystems_context;
				_tmp67__length1 = filesystems_context_length1;
				if (_tmp67__length1 > filesystems_hits) {
					SideloadFlatpakFilePermissionsFlags _tmp68_;
					SideloadFlatpakFilePermissionsFlags _tmp69_;
					_tmp68_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp69_ = _tmp68_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp69_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_OTHER);
				}
				_tmp70_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp71_ = _tmp70_;
				if ((_tmp71_ & SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_FULL) != 0) {
					SideloadFlatpakFilePermissionsFlags _tmp72_;
					SideloadFlatpakFilePermissionsFlags _tmp73_;
					_tmp72_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp73_ = _tmp72_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp73_ & (~SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_HOME_READ));
				}
				_tmp74_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp75_ = _tmp74_;
				if ((_tmp75_ & SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_FULL) != 0) {
					SideloadFlatpakFilePermissionsFlags _tmp76_;
					SideloadFlatpakFilePermissionsFlags _tmp77_;
					_tmp76_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp77_ = _tmp76_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp77_ & (~SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_FILESYSTEM_READ));
				}
				_tmp78_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp79_ = _tmp78_;
				if ((_tmp79_ & SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_FULL) != 0) {
					SideloadFlatpakFilePermissionsFlags _tmp80_;
					SideloadFlatpakFilePermissionsFlags _tmp81_;
					_tmp80_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp81_ = _tmp80_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp81_ & (~SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_DOWNLOADS_READ));
				}
				_vala_SideloadFlatpakRefFileFilesystemsAccess_array_destroy (filesystems_access, 13);
			}
			filesystems_context = (_vala_array_free (filesystems_context, filesystems_context_length1, (GDestroyNotify) g_free), NULL);
			shared_context = (_vala_array_free (shared_context, shared_context_length1, (GDestroyNotify) g_free), NULL);
			devices_context = (_vala_array_free (devices_context, devices_context_length1, (GDestroyNotify) g_free), NULL);
			sockets_context = (_vala_array_free (sockets_context, sockets_context_length1, (GDestroyNotify) g_free), NULL);
		}
		if (g_key_file_has_group (keyfile, "Session Bus Policy")) {
			gchar* dconf_policy = NULL;
			gchar* _tmp82_;
			gboolean _tmp83_ = FALSE;
			const gchar* _tmp84_;
			gchar* flatpak_policy = NULL;
			gchar* _tmp88_;
			gboolean _tmp89_ = FALSE;
			const gchar* _tmp90_;
			_tmp82_ = g_key_file_get_string (keyfile, "Session Bus Policy", "ca.desrt.dconf", &_inner_error0_);
			dconf_policy = _tmp82_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp84_ = dconf_policy;
			if (_tmp84_ != NULL) {
				const gchar* _tmp85_;
				_tmp85_ = dconf_policy;
				_tmp83_ = g_strcmp0 (_tmp85_, "talk") == 0;
			} else {
				_tmp83_ = FALSE;
			}
			if (_tmp83_) {
				SideloadFlatpakFilePermissionsFlags _tmp86_;
				SideloadFlatpakFilePermissionsFlags _tmp87_;
				_tmp86_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp87_ = _tmp86_;
				sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp87_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_SETTINGS);
			}
			_tmp88_ = g_key_file_get_string (keyfile, "Session Bus Policy", "org.freedesktop.Flatpak", &_inner_error0_);
			flatpak_policy = _tmp88_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_free0 (dconf_policy);
				goto __catch0_g_error;
			}
			_tmp90_ = flatpak_policy;
			if (_tmp90_ != NULL) {
				const gchar* _tmp91_;
				_tmp91_ = flatpak_policy;
				_tmp89_ = g_strcmp0 (_tmp91_, "talk") == 0;
			} else {
				_tmp89_ = FALSE;
			}
			if (_tmp89_) {
				SideloadFlatpakFilePermissionsFlags _tmp92_;
				SideloadFlatpakFilePermissionsFlags _tmp93_;
				_tmp92_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
				_tmp93_ = _tmp92_;
				sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp93_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_ESCAPE_SANDBOX);
			} else {
				gchar* portal_policy = NULL;
				gchar* _tmp94_;
				gboolean _tmp95_ = FALSE;
				const gchar* _tmp96_;
				_tmp94_ = g_key_file_get_string (keyfile, "Session Bus Policy", "org.freedesktop.impl.portal.PermissionStore", &_inner_error0_);
				portal_policy = _tmp94_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_g_free0 (flatpak_policy);
					_g_free0 (dconf_policy);
					goto __catch0_g_error;
				}
				_tmp96_ = portal_policy;
				if (_tmp96_ != NULL) {
					const gchar* _tmp97_;
					_tmp97_ = portal_policy;
					_tmp95_ = g_strcmp0 (_tmp97_, "talk") == 0;
				} else {
					_tmp95_ = FALSE;
				}
				if (_tmp95_) {
					SideloadFlatpakFilePermissionsFlags _tmp98_;
					SideloadFlatpakFilePermissionsFlags _tmp99_;
					_tmp98_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
					_tmp99_ = _tmp98_;
					sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, _tmp99_ | SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_ESCAPE_SANDBOX);
				}
				_g_free0 (portal_policy);
			}
			_g_free0 (flatpak_policy);
			_g_free0 (dconf_policy);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp100_;
		const gchar* _tmp101_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp100_ = e;
		_tmp101_ = _tmp100_->message;
		g_debug ("FlatpakRefFile.vala:402: Error getting Flatpak permissions: %s", _tmp101_);
		_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;
	}
	_tmp102_ = sideload_flatpak_file_get_permissions_flags ((SideloadFlatpakFile*) self);
	_tmp103_ = _tmp102_;
	if (_tmp103_ == SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_UNKNOWN) {
		sideload_flatpak_file_set_permissions_flags ((SideloadFlatpakFile*) self, SIDELOAD_FLATPAK_FILE_PERMISSIONS_FLAGS_NONE);
	}
}

static void
sideload_flatpak_ref_file_filesystems_access_copy (const SideloadFlatpakRefFileFilesystemsAccess* self,
                                                   SideloadFlatpakRefFileFilesystemsAccess* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	_tmp0_ = (*self).key;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).key);
	(*dest).key = _tmp1_;
	(*dest).permission = (*self).permission;
}

static void
sideload_flatpak_ref_file_filesystems_access_destroy (SideloadFlatpakRefFileFilesystemsAccess* self)
{
	_g_free0 ((*self).key);
}

static SideloadFlatpakRefFileFilesystemsAccess*
sideload_flatpak_ref_file_filesystems_access_dup (const SideloadFlatpakRefFileFilesystemsAccess* self)
{
	SideloadFlatpakRefFileFilesystemsAccess* dup;
	dup = g_new0 (SideloadFlatpakRefFileFilesystemsAccess, 1);
	sideload_flatpak_ref_file_filesystems_access_copy (self, dup);
	return dup;
}

static void
sideload_flatpak_ref_file_filesystems_access_free (SideloadFlatpakRefFileFilesystemsAccess* self)
{
	sideload_flatpak_ref_file_filesystems_access_destroy (self);
	g_free (self);
}

static GType
sideload_flatpak_ref_file_filesystems_access_get_type_once (void)
{
	GType sideload_flatpak_ref_file_filesystems_access_type_id;
	sideload_flatpak_ref_file_filesystems_access_type_id = g_boxed_type_register_static ("SideloadFlatpakRefFileFilesystemsAccess", (GBoxedCopyFunc) sideload_flatpak_ref_file_filesystems_access_dup, (GBoxedFreeFunc) sideload_flatpak_ref_file_filesystems_access_free);
	return sideload_flatpak_ref_file_filesystems_access_type_id;
}

static GType
sideload_flatpak_ref_file_filesystems_access_get_type (void)
{
	static volatile gsize sideload_flatpak_ref_file_filesystems_access_type_id__once = 0;
	if (g_once_init_enter (&sideload_flatpak_ref_file_filesystems_access_type_id__once)) {
		GType sideload_flatpak_ref_file_filesystems_access_type_id;
		sideload_flatpak_ref_file_filesystems_access_type_id = sideload_flatpak_ref_file_filesystems_access_get_type_once ();
		g_once_init_leave (&sideload_flatpak_ref_file_filesystems_access_type_id__once, sideload_flatpak_ref_file_filesystems_access_type_id);
	}
	return sideload_flatpak_ref_file_filesystems_access_type_id__once;
}

static void
sideload_flatpak_ref_file_class_init (SideloadFlatpakRefFileClass * klass,
                                      gpointer klass_data)
{
	sideload_flatpak_ref_file_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SideloadFlatpakRefFile_private_offset);
	((SideloadFlatpakFileClass *) klass)->get_id = (void (*) (SideloadFlatpakFile*, GAsyncReadyCallback, gpointer)) sideload_flatpak_ref_file_real_get_id;
	((SideloadFlatpakFileClass *) klass)->get_id_finish = (gchar* (*) (SideloadFlatpakFile*, GAsyncResult*)) sideload_flatpak_ref_file_get_id_finish;
	((SideloadFlatpakFileClass *) klass)->get_name = (void (*) (SideloadFlatpakFile*, GAsyncReadyCallback, gpointer)) sideload_flatpak_ref_file_real_get_name;
	((SideloadFlatpakFileClass *) klass)->get_name_finish = (gchar* (*) (SideloadFlatpakFile*, GAsyncResult*)) sideload_flatpak_ref_file_get_name_finish;
	((SideloadFlatpakFileClass *) klass)->get_details = (void (*) (SideloadFlatpakFile*, GCancellable*, GAsyncReadyCallback, gpointer)) sideload_flatpak_ref_file_real_get_details;
	((SideloadFlatpakFileClass *) klass)->get_details_finish = (void (*) (SideloadFlatpakFile*, GAsyncResult*)) sideload_flatpak_ref_file_get_details_finish;
	((SideloadFlatpakFileClass *) klass)->install = (void (*) (SideloadFlatpakFile*, GCancellable*, GAsyncReadyCallback, gpointer)) sideload_flatpak_ref_file_real_install;
	((SideloadFlatpakFileClass *) klass)->install_finish = (void (*) (SideloadFlatpakFile*, GAsyncResult*, GError**)) sideload_flatpak_ref_file_install_finish;
	((SideloadFlatpakFileClass *) klass)->launch = (void (*) (SideloadFlatpakFile*, GAsyncReadyCallback, gpointer)) sideload_flatpak_ref_file_real_launch;
	((SideloadFlatpakFileClass *) klass)->launch_finish = (void (*) (SideloadFlatpakFile*, GAsyncResult*)) sideload_flatpak_ref_file_launch_finish;
	G_OBJECT_CLASS (klass)->finalize = sideload_flatpak_ref_file_finalize;
}

static void
sideload_flatpak_ref_file_instance_init (SideloadFlatpakRefFile * self,
                                         gpointer klass)
{
	AsyncMutex* _tmp0_;
	self->priv = sideload_flatpak_ref_file_get_instance_private (self);
	self->priv->bytes = NULL;
	self->priv->key_file = NULL;
	_tmp0_ = async_mutex_new ();
	self->priv->keyfile_mutex = _tmp0_;
}

static void
sideload_flatpak_ref_file_finalize (GObject * obj)
{
	SideloadFlatpakRefFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SIDELOAD_TYPE_FLATPAK_REF_FILE, SideloadFlatpakRefFile);
	_g_bytes_unref0 (self->priv->bytes);
	_g_key_file_unref0 (self->priv->key_file);
	_async_mutex_unref0 (self->priv->keyfile_mutex);
	G_OBJECT_CLASS (sideload_flatpak_ref_file_parent_class)->finalize (obj);
}

static GType
sideload_flatpak_ref_file_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SideloadFlatpakRefFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sideload_flatpak_ref_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SideloadFlatpakRefFile), 0, (GInstanceInitFunc) sideload_flatpak_ref_file_instance_init, NULL };
	GType sideload_flatpak_ref_file_type_id;
	sideload_flatpak_ref_file_type_id = g_type_register_static (SIDELOAD_TYPE_FLATPAK_FILE, "SideloadFlatpakRefFile", &g_define_type_info, 0);
	SideloadFlatpakRefFile_private_offset = g_type_add_instance_private (sideload_flatpak_ref_file_type_id, sizeof (SideloadFlatpakRefFilePrivate));
	return sideload_flatpak_ref_file_type_id;
}

GType
sideload_flatpak_ref_file_get_type (void)
{
	static volatile gsize sideload_flatpak_ref_file_type_id__once = 0;
	if (g_once_init_enter (&sideload_flatpak_ref_file_type_id__once)) {
		GType sideload_flatpak_ref_file_type_id;
		sideload_flatpak_ref_file_type_id = sideload_flatpak_ref_file_get_type_once ();
		g_once_init_leave (&sideload_flatpak_ref_file_type_id__once, sideload_flatpak_ref_file_type_id);
	}
	return sideload_flatpak_ref_file_type_id__once;
}

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

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

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

