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

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <glib-object.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <gio/gio.h>
#include "common.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <osinfo/osinfo.h>
#include <gudev/gudev.h>
#include <stdio.h>

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

#define BOXES_TYPE_INSTALLER_MEDIA (boxes_installer_media_get_type ())
#define BOXES_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia))
#define BOXES_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))
#define BOXES_IS_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_IS_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_INSTALLER_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))

typedef struct _BoxesInstallerMedia BoxesInstallerMedia;
typedef struct _BoxesInstallerMediaClass BoxesInstallerMediaClass;
typedef struct _BoxesInstallerMediaPrivate BoxesInstallerMediaPrivate;

#define BOXES_TYPE_VM_CREATOR (boxes_vm_creator_get_type ())
#define BOXES_VM_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_VM_CREATOR, BoxesVMCreator))
#define BOXES_VM_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_VM_CREATOR, BoxesVMCreatorClass))
#define BOXES_IS_VM_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_VM_CREATOR))
#define BOXES_IS_VM_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_VM_CREATOR))
#define BOXES_VM_CREATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_VM_CREATOR, BoxesVMCreatorClass))

typedef struct _BoxesVMCreator BoxesVMCreator;
typedef struct _BoxesVMCreatorClass BoxesVMCreatorClass;
enum  {
	BOXES_INSTALLER_MEDIA_0_PROPERTY,
	BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_EXPRESS_INSTALL_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTED_DEVICES_PROPERTY,
	BOXES_INSTALLER_MEDIA_INSTALLED_SIZE_PROPERTY,
	BOXES_INSTALLER_MEDIA_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_DISK_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_DISK_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_NET_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_NET_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_GPU_PROPERTY,
	BOXES_INSTALLER_MEDIA_SUPPORTS_EFI_PROPERTY,
	BOXES_INSTALLER_MEDIA_REQUIRES_EFI_PROPERTY,
	BOXES_INSTALLER_MEDIA_PREFERS_Q35_PROPERTY,
	BOXES_INSTALLER_MEDIA_PREFERS_ICH9_PROPERTY,
	BOXES_INSTALLER_MEDIA_LIVE_PROPERTY,
	BOXES_INSTALLER_MEDIA_EJECT_AFTER_INSTALL_PROPERTY,
	BOXES_INSTALLER_MEDIA_ARCHITECTURE_PROPERTY,
	BOXES_INSTALLER_MEDIA_NUM_PROPERTIES
};
static GParamSpec* boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define BOXES_TYPE_MEDIA_MANAGER (boxes_media_manager_get_type ())
#define BOXES_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManager))
#define BOXES_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManagerClass))
#define BOXES_IS_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MEDIA_MANAGER))
#define BOXES_IS_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MEDIA_MANAGER))
#define BOXES_MEDIA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManagerClass))

typedef struct _BoxesMediaManager BoxesMediaManager;
typedef struct _BoxesMediaManagerClass BoxesMediaManagerClass;

#define BOXES_TYPE_OS_DATABASE (boxes_os_database_get_type ())
#define BOXES_OS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_OS_DATABASE, BoxesOSDatabase))
#define BOXES_OS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_OS_DATABASE, BoxesOSDatabaseClass))
#define BOXES_IS_OS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_OS_DATABASE))
#define BOXES_IS_OS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_OS_DATABASE))
#define BOXES_OS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_OS_DATABASE, BoxesOSDatabaseClass))

typedef struct _BoxesOSDatabase BoxesOSDatabase;
typedef struct _BoxesOSDatabaseClass BoxesOSDatabaseClass;
typedef struct _BoxesInstallerMediaNewForPathData BoxesInstallerMediaNewForPathData;
typedef struct _BoxesInstallerMediaPrepareData BoxesInstallerMediaPrepareData;
typedef struct _BoxesInstallerMediaPrepareForInstallationData BoxesInstallerMediaPrepareForInstallationData;
typedef enum  {
	BOXES_CPU_ARCH_COMPATIBILITY_INCOMPATIBLE = -1,
	BOXES_CPU_ARCH_COMPATIBILITY_IDENTICAL = 0,
	BOXES_CPU_ARCH_COMPATIBILITY_COMPATIBLE = 1,
	BOXES_CPU_ARCH_COMPATIBILITY_COMPATIBLE_DIFF_WORDSIZE = 2
} BoxesCPUArchCompatibility;

#define BOXES_TYPE_CPU_ARCH_COMPATIBILITY (boxes_cpu_arch_compatibility_get_type ())
typedef struct _BoxesInstallerMediaGetDeviceFileFromPathData BoxesInstallerMediaGetDeviceFileFromPathData;
typedef struct _BoxesInstallerMediaGetDeviceFromDeviceFileData BoxesInstallerMediaGetDeviceFromDeviceFileData;

#define BOXES_TYPE_OS_DATABASE_ERROR (boxes_os_database_error_get_type ())
typedef struct _BoxesInstallerMediaGetMediaInfoFromDeviceData BoxesInstallerMediaGetMediaInfoFromDeviceData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	BOXES_INSTALLER_MEDIA_USER_WANTS_TO_CREATE_SIGNAL,
	BOXES_INSTALLER_MEDIA_NUM_SIGNALS
};
static guint boxes_installer_media_signals[BOXES_INSTALLER_MEDIA_NUM_SIGNALS] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _BoxesInstallerMedia {
	GObject parent_instance;
	BoxesInstallerMediaPrivate * priv;
	OsinfoOs* os;
	OsinfoResources* resources;
	OsinfoMedia* os_media;
	gchar* label;
	gchar* device_file;
	gchar* mount_point;
	gboolean from_image;
};

struct _BoxesInstallerMediaClass {
	GObjectClass parent_class;
	void (*set_direct_boot_params) (BoxesInstallerMedia* self, GVirConfigDomainOs* os);
	void (*prepare) (BoxesInstallerMedia* self, BoxesActivityProgress* progress, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gboolean (*prepare_finish) (BoxesInstallerMedia* self, GAsyncResult* _res_);
	void (*prepare_for_installation) (BoxesInstallerMedia* self, const gchar* vm_name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*prepare_for_installation_finish) (BoxesInstallerMedia* self, GAsyncResult* _res_);
	void (*prepare_to_continue_installation) (BoxesInstallerMedia* self, const gchar* vm_name);
	void (*clean_up) (BoxesInstallerMedia* self);
	void (*clean_up_preparation_cache) (BoxesInstallerMedia* self);
	void (*setup_domain_config) (BoxesInstallerMedia* self, GVirConfigDomain* domain);
	void (*setup_post_install_domain_config) (BoxesInstallerMedia* self, GVirConfigDomain* domain);
	BoxesVMCreator* (*get_vm_creator) (BoxesInstallerMedia* self);
	OsinfoDeviceList* (*get_supported_devices) (BoxesInstallerMedia* self);
	guint64 (*get_installed_size) (BoxesInstallerMedia* self);
	gboolean (*get_need_user_input_for_vm_creation) (BoxesInstallerMedia* self);
	gboolean (*get_prefers_q35) (BoxesInstallerMedia* self);
	gboolean (*get_prefers_ich9) (BoxesInstallerMedia* self);
	gboolean (*get_live) (BoxesInstallerMedia* self);
	gboolean (*get_eject_after_install) (BoxesInstallerMedia* self);
	gchar* (*get_architecture) (BoxesInstallerMedia* self);
};

struct _BoxesInstallerMediaPrivate {
	gboolean _skip_import;
};

struct _BoxesInstallerMediaNewForPathData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GType object_type;
	BoxesInstallerMedia* self;
	gchar* path;
	GCancellable* cancellable;
	gchar* device_file;
	gchar* _tmp0_;
	BoxesMediaManager* media_manager;
	BoxesMediaManager* _tmp1_;
	GUdevDevice* device;
	const gchar* _tmp2_;
	BoxesMediaManager* _tmp3_;
	GUdevClient* _tmp4_;
	GUdevClient* _tmp5_;
	GUdevDevice* _tmp6_;
	GUdevDevice* _tmp7_;
	GUdevDevice* _tmp8_;
	BoxesMediaManager* _tmp9_;
	BoxesOSDatabase* _tmp10_;
	BoxesOSDatabase* _tmp11_;
	OsinfoMedia* _tmp12_;
	BoxesMediaManager* _tmp13_;
	BoxesOSDatabase* _tmp14_;
	BoxesOSDatabase* _tmp15_;
	const gchar* _tmp16_;
	OsinfoMedia* _tmp17_;
	OsinfoMedia* _tmp18_;
	OsinfoMedia* _tmp19_;
	OsinfoMedia* _tmp20_;
	OsinfoOs* _tmp21_;
	OsinfoOs* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* architecture;
	gchar* _tmp27_;
	BoxesMediaManager* _tmp28_;
	BoxesOSDatabase* _tmp29_;
	BoxesOSDatabase* _tmp30_;
	OsinfoOs* _tmp31_;
	const gchar* _tmp32_;
	OsinfoResources* _tmp33_;
	gint64 _tmp34_;
	gboolean _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	OsinfoResources* _tmp38_;
	gint64 _tmp39_;
	gint64 _tmp40_;
	OsinfoResources* _tmp41_;
	gint64 _tmp42_;
	gint64 _tmp43_;
	OsinfoResources* _tmp44_;
	GError* _inner_error0_;
};

struct _BoxesInstallerMediaPrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesInstallerMedia* self;
	BoxesActivityProgress* progress;
	GCancellable* cancellable;
	gboolean result;
};

struct _BoxesInstallerMediaPrepareForInstallationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesInstallerMedia* self;
	gchar* vm_name;
	GCancellable* cancellable;
};

struct _BoxesInstallerMediaGetDeviceFileFromPathData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesInstallerMedia* self;
	gchar* path;
	GCancellable* cancellable;
	gchar* result;
	GFile* mount_dir;
	GFile* _tmp0_;
	GMount* mount;
	GMount* _tmp1_;
	GFile* root_dir;
	GFile* _tmp2_;
	GFile* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gboolean _tmp8_;
	GVolume* volume;
	GVolume* _tmp9_;
	GVolume* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	GError* _inner_error0_;
};

struct _BoxesInstallerMediaGetDeviceFromDeviceFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesInstallerMedia* self;
	gchar* device_file;
	GUdevClient* client;
	GUdevDevice* result;
	GUdevDevice* _tmp0_;
};

typedef enum  {
	BOXES_OS_DATABASE_ERROR_NON_BOOTABLE,
	BOXES_OS_DATABASE_ERROR_DB_LOADING_FAILED,
	BOXES_OS_DATABASE_ERROR_UNKNOWN_OS_ID,
	BOXES_OS_DATABASE_ERROR_UNKNOWN_MEDIA_ID
} BoxesOSDatabaseError;
#define BOXES_OS_DATABASE_ERROR boxes_os_database_error_quark ()

struct _BoxesInstallerMediaGetMediaInfoFromDeviceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesInstallerMedia* self;
	GUdevDevice* device;
	BoxesOSDatabase* os_db;
	gboolean _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	GError* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* os_id;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	OsinfoOs* _tmp10_;
	const gchar* _tmp11_;
	OsinfoOs* _tmp12_;
	OsinfoOs* _tmp13_;
	gchar* media_id;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	OsinfoMedia* _tmp17_;
	OsinfoOs* _tmp18_;
	const gchar* _tmp19_;
	OsinfoMedia* _tmp20_;
	OsinfoMedia* _tmp21_;
	OsinfoMedia* media;
	const gchar* _tmp22_;
	OsinfoMedia* _tmp23_;
	OsinfoMedia* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar** _tmp29_;
	gchar** _tmp30_;
	gint _tmp30__length1;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar** _tmp34_;
	gchar** _tmp35_;
	gint _tmp35__length1;
	OsinfoMedia* _tmp36_;
	OsinfoMedia* _tmp37_;
	OsinfoMedia* _tmp38_;
	OsinfoMedia* _tmp39_;
	OsinfoMedia* _tmp40_;
	OsinfoMedia* _tmp41_;
	OsinfoMedia* _tmp42_;
	OsinfoOs* _tmp43_;
	OsinfoOs* _tmp44_;
	GError* _inner_error0_;
};

static gint BoxesInstallerMedia_private_offset;
static gpointer boxes_installer_media_parent_class = NULL;

VALA_EXTERN GType boxes_installer_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesInstallerMedia, g_object_unref)
VALA_EXTERN GType boxes_vm_creator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesVMCreator, g_object_unref)
VALA_EXTERN void boxes_installer_media_set_direct_boot_params (BoxesInstallerMedia* self,
                                                   GVirConfigDomainOs* os);
VALA_EXTERN void boxes_installer_media_prepare (BoxesInstallerMedia* self,
                                    BoxesActivityProgress* progress,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gboolean boxes_installer_media_prepare_finish (BoxesInstallerMedia* self,
                                               GAsyncResult* _res_);
VALA_EXTERN void boxes_installer_media_prepare_for_installation (BoxesInstallerMedia* self,
                                                     const gchar* vm_name,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN void boxes_installer_media_prepare_for_installation_finish (BoxesInstallerMedia* self,
                                                            GAsyncResult* _res_);
VALA_EXTERN void boxes_installer_media_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                             const gchar* vm_name);
VALA_EXTERN void boxes_installer_media_clean_up (BoxesInstallerMedia* self);
VALA_EXTERN void boxes_installer_media_clean_up_preparation_cache (BoxesInstallerMedia* self);
VALA_EXTERN void boxes_installer_media_setup_domain_config (BoxesInstallerMedia* self,
                                                GVirConfigDomain* domain);
VALA_EXTERN void boxes_installer_media_setup_post_install_domain_config (BoxesInstallerMedia* self,
                                                             GVirConfigDomain* domain);
VALA_EXTERN BoxesVMCreator* boxes_installer_media_get_vm_creator (BoxesInstallerMedia* self);
VALA_EXTERN OsinfoDeviceList* boxes_installer_media_get_supported_devices (BoxesInstallerMedia* self);
VALA_EXTERN guint64 boxes_installer_media_get_installed_size (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_need_user_input_for_vm_creation (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_prefers_q35 (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_prefers_ich9 (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_live (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_eject_after_install (BoxesInstallerMedia* self);
VALA_EXTERN gchar* boxes_installer_media_get_architecture (BoxesInstallerMedia* self);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_new_from_iso_info (const gchar* path,
                                                              const gchar* label,
                                                              OsinfoOs* os,
                                                              OsinfoMedia* media,
                                                              OsinfoResources* resources);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_construct_from_iso_info (GType object_type,
                                                                    const gchar* path,
                                                                    const gchar* label,
                                                                    OsinfoOs* os,
                                                                    OsinfoMedia* media,
                                                                    OsinfoResources* resources);
VALA_EXTERN void boxes_installer_media_label_setup (BoxesInstallerMedia* self,
                                        const gchar* label);
static void boxes_installer_media_construct_for_path_data_free (gpointer _data);
VALA_EXTERN void boxes_installer_media_new_for_path (const gchar* path,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_new_for_path_finish (GAsyncResult* _res_,
                                                                GError** error);
VALA_EXTERN void boxes_installer_media_construct_for_path (GType object_type,
                                               const gchar* path,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_construct_for_path_finish (GAsyncResult* _res_,
                                                                      GError** error);
static gboolean boxes_installer_media_construct_for_path_co (BoxesInstallerMediaNewForPathData* _data_);
static void boxes_installer_media_get_device_file_from_path (BoxesInstallerMedia* self,
                                                      const gchar* path,
                                                      GCancellable* cancellable,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static gchar* boxes_installer_media_get_device_file_from_path_finish (BoxesInstallerMedia* self,
                                                               GAsyncResult* _res_);
static void boxes_installer_media_new_for_path_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN GType boxes_media_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMediaManager, g_object_unref)
VALA_EXTERN BoxesMediaManager* boxes_media_manager_get_default (void);
static void boxes_installer_media_get_device_from_device_file (BoxesInstallerMedia* self,
                                                        const gchar* device_file,
                                                        GUdevClient* client,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static GUdevDevice* boxes_installer_media_get_device_from_device_file_finish (BoxesInstallerMedia* self,
                                                                       GAsyncResult* _res_);
VALA_EXTERN GUdevClient* boxes_media_manager_get_client (BoxesMediaManager* self);
VALA_EXTERN GType boxes_os_database_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesOSDatabase, g_object_unref)
static void boxes_installer_media_get_media_info_from_device (BoxesInstallerMedia* self,
                                                       GUdevDevice* device,
                                                       BoxesOSDatabase* os_db,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static void boxes_installer_media_get_media_info_from_device_finish (BoxesInstallerMedia* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
VALA_EXTERN BoxesOSDatabase* boxes_media_manager_get_os_db (BoxesMediaManager* self);
VALA_EXTERN void boxes_os_database_guess_os_from_install_media_path (BoxesOSDatabase* self,
                                                         const gchar* media_path,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
VALA_EXTERN OsinfoMedia* boxes_os_database_guess_os_from_install_media_path_finish (BoxesOSDatabase* self,
                                                                        GAsyncResult* _res_,
                                                                        GError** error);
VALA_EXTERN OsinfoResources* boxes_os_database_get_resources_for_os (BoxesOSDatabase* self,
                                                         OsinfoOs* os,
                                                         const gchar* architecture);
static void boxes_installer_media_real_set_direct_boot_params (BoxesInstallerMedia* self,
                                                        GVirConfigDomainOs* os);
static void boxes_installer_media_real_prepare_data_free (gpointer _data);
static void boxes_installer_media_real_prepare (BoxesInstallerMedia* self,
                                         BoxesActivityProgress* progress,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static gboolean boxes_installer_media_real_prepare_co (BoxesInstallerMediaPrepareData* _data_);
static void boxes_installer_media_real_prepare_for_installation_data_free (gpointer _data);
static void boxes_installer_media_real_prepare_for_installation (BoxesInstallerMedia* self,
                                                          const gchar* vm_name,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static gboolean boxes_installer_media_real_prepare_for_installation_co (BoxesInstallerMediaPrepareForInstallationData* _data_);
static void boxes_installer_media_real_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                                  const gchar* vm_name);
static void boxes_installer_media_real_clean_up (BoxesInstallerMedia* self);
static void boxes_installer_media_real_clean_up_preparation_cache (BoxesInstallerMedia* self);
static void boxes_installer_media_real_setup_domain_config (BoxesInstallerMedia* self,
                                                     GVirConfigDomain* domain);
VALA_EXTERN void boxes_installer_media_add_cd_config (BoxesInstallerMedia* self,
                                          GVirConfigDomain* domain,
                                          GVirConfigDomainDiskType type,
                                          const gchar* iso_path,
                                          const gchar* device_name,
                                          gboolean mandatory);
static void boxes_installer_media_real_setup_post_install_domain_config (BoxesInstallerMedia* self,
                                                                  GVirConfigDomain* domain);
static void boxes_installer_media_eject_cdrom_media (BoxesInstallerMedia* self,
                                              GVirConfigDomain* domain);
VALA_EXTERN gboolean boxes_installer_media_is_architecture_compatible (BoxesInstallerMedia* self,
                                                           const gchar* architecture);
VALA_EXTERN GType boxes_cpu_arch_compatibility_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BoxesCPUArchCompatibility boxes_compare_cpu_architectures (const gchar* arch1,
                                                           const gchar* arch2);
static BoxesVMCreator* boxes_installer_media_real_get_vm_creator (BoxesInstallerMedia* self);
VALA_EXTERN BoxesVMCreator* boxes_vm_creator_new (BoxesInstallerMedia* install_media);
VALA_EXTERN BoxesVMCreator* boxes_vm_creator_construct (GType object_type,
                                            BoxesInstallerMedia* install_media);
static void boxes_installer_media_get_device_file_from_path_data_free (gpointer _data);
static gboolean boxes_installer_media_get_device_file_from_path_co (BoxesInstallerMediaGetDeviceFileFromPathData* _data_);
static void boxes_installer_media_get_device_file_from_path_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void boxes_installer_media_get_device_from_device_file_data_free (gpointer _data);
static gboolean boxes_installer_media_get_device_from_device_file_co (BoxesInstallerMediaGetDeviceFromDeviceFileData* _data_);
static void boxes_installer_media_get_media_info_from_device_data_free (gpointer _data);
static gboolean boxes_installer_media_get_media_info_from_device_co (BoxesInstallerMediaGetMediaInfoFromDeviceData* _data_);
VALA_EXTERN GQuark boxes_os_database_error_quark (void);
VALA_EXTERN GType boxes_os_database_error_get_type (void) G_GNUC_CONST ;
static gchar* boxes_installer_media_get_decoded_udev_property (BoxesInstallerMedia* self,
                                                        GUdevDevice* device,
                                                        const gchar* property_name);
VALA_EXTERN void boxes_os_database_get_os_by_id (BoxesOSDatabase* self,
                                     const gchar* id,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
VALA_EXTERN OsinfoOs* boxes_os_database_get_os_by_id_finish (BoxesOSDatabase* self,
                                                 GAsyncResult* _res_,
                                                 GError** error);
static void boxes_installer_media_get_media_info_from_device_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
VALA_EXTERN OsinfoMedia* boxes_os_database_get_media_by_id (BoxesOSDatabase* self,
                                                OsinfoOs* os,
                                                const gchar* id,
                                                GError** error);
static void boxes_installer_media_get_decoded_udev_properties_for_media (BoxesInstallerMedia* self,
                                                                  GUdevDevice* device,
                                                                  gchar** udev_props,
                                                                  gint udev_props_length1,
                                                                  gchar** media_props,
                                                                  gint media_props_length1,
                                                                  OsinfoMedia* media);
VALA_EXTERN void boxes_os_database_guess_os_from_install_media (BoxesOSDatabase* self,
                                                    OsinfoMedia* media,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
VALA_EXTERN OsinfoMedia* boxes_os_database_guess_os_from_install_media_finish (BoxesOSDatabase* self,
                                                                   GAsyncResult* _res_,
                                                                   GError** error);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN void boxes_installer_media_set_uefi_firmware (BoxesInstallerMedia* self,
                                              GVirConfigDomain* domain,
                                              gboolean use_uefi);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_new (void);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_construct (GType object_type);
VALA_EXTERN gboolean boxes_installer_media_get_skip_import (BoxesInstallerMedia* self);
VALA_EXTERN void boxes_installer_media_set_skip_import (BoxesInstallerMedia* self,
                                            gboolean value);
VALA_EXTERN gboolean boxes_installer_media_get_supports_express_install (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio1_disk (BoxesInstallerMedia* self);
VALA_EXTERN OsinfoDevice* boxes_find_device_by_prop (OsinfoDeviceList* devices,
                                         const gchar* prop_name,
                                         const gchar* prop_value);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio_disk (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio1_net (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio_net (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio_gpu (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_efi (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_requires_efi (BoxesInstallerMedia* self);
static void boxes_installer_media_finalize (GObject * obj);
static GType boxes_installer_media_get_type_once (void);
static void _vala_boxes_installer_media_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_boxes_installer_media_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
boxes_installer_media_get_instance_private (BoxesInstallerMedia* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesInstallerMedia_private_offset);
}

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

BoxesInstallerMedia*
boxes_installer_media_construct_from_iso_info (GType object_type,
                                               const gchar* path,
                                               const gchar* label,
                                               OsinfoOs* os,
                                               OsinfoMedia* media,
                                               OsinfoResources* resources)
{
	BoxesInstallerMedia * self = NULL;
	gchar* _tmp0_;
	OsinfoOs* _tmp1_;
	OsinfoMedia* _tmp2_;
	OsinfoResources* _tmp3_;
	g_return_val_if_fail (path != NULL, NULL);
	g_return_val_if_fail (label != NULL, NULL);
	g_return_val_if_fail (resources != NULL, NULL);
	self = (BoxesInstallerMedia*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (path);
	_g_free0 (self->device_file);
	self->device_file = _tmp0_;
	_tmp1_ = _g_object_ref0 (os);
	_g_object_unref0 (self->os);
	self->os = _tmp1_;
	_tmp2_ = _g_object_ref0 (media);
	_g_object_unref0 (self->os_media);
	self->os_media = _tmp2_;
	_tmp3_ = _g_object_ref0 (resources);
	_g_object_unref0 (self->resources);
	self->resources = _tmp3_;
	self->from_image = TRUE;
	boxes_installer_media_label_setup (self, label);
	return self;
}

BoxesInstallerMedia*
boxes_installer_media_new_from_iso_info (const gchar* path,
                                         const gchar* label,
                                         OsinfoOs* os,
                                         OsinfoMedia* media,
                                         OsinfoResources* resources)
{
	return boxes_installer_media_construct_from_iso_info (BOXES_TYPE_INSTALLER_MEDIA, path, label, os, media, resources);
}

static void
boxes_installer_media_construct_for_path_data_free (gpointer _data)
{
	BoxesInstallerMediaNewForPathData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaNewForPathData, _data_);
}

void
boxes_installer_media_construct_for_path (GType object_type,
                                          const gchar* path,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	BoxesInstallerMediaNewForPathData* _data_;
	gchar* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (path != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaNewForPathData);
	_data_->_async_result = g_task_new (NULL, cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_construct_for_path_data_free);
	_data_->object_type = object_type;
	_tmp0_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	boxes_installer_media_construct_for_path_co (_data_);
}

BoxesInstallerMedia*
boxes_installer_media_construct_for_path_finish (GAsyncResult* _res_,
                                                 GError** error)
{
	BoxesInstallerMedia* result;
	BoxesInstallerMediaNewForPathData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->self;
	_data_->self = NULL;
	return result;
}

static void
boxes_installer_media_new_for_path_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	BoxesInstallerMediaNewForPathData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_installer_media_construct_for_path_co (_data_);
}

static gboolean
boxes_installer_media_construct_for_path_co (BoxesInstallerMediaNewForPathData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self = (BoxesInstallerMedia*) g_object_new (_data_->object_type, NULL);
	_data_->_state_ = 1;
	boxes_installer_media_get_device_file_from_path (_data_->self, _data_->path, _data_->cancellable, boxes_installer_media_new_for_path_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = boxes_installer_media_get_device_file_from_path_finish (_data_->self, _data_->_res_);
	_data_->device_file = _data_->_tmp0_;
	_data_->_tmp1_ = boxes_media_manager_get_default ();
	_data_->media_manager = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->device_file;
	_data_->_tmp3_ = _data_->media_manager;
	_data_->_tmp4_ = boxes_media_manager_get_client (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_state_ = 2;
	boxes_installer_media_get_device_from_device_file (_data_->self, _data_->_tmp2_, _data_->_tmp5_, boxes_installer_media_new_for_path_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp6_ = boxes_installer_media_get_device_from_device_file_finish (_data_->self, _data_->_res_);
	_data_->device = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->device;
	if (_data_->_tmp7_ != NULL) {
		_data_->_tmp8_ = _data_->device;
		_data_->_tmp9_ = _data_->media_manager;
		_data_->_tmp10_ = boxes_media_manager_get_os_db (_data_->_tmp9_);
		_data_->_tmp11_ = _data_->_tmp10_;
		_data_->_state_ = 3;
		boxes_installer_media_get_media_info_from_device (_data_->self, _data_->_tmp8_, _data_->_tmp11_, boxes_installer_media_new_for_path_ready, _data_);
		return FALSE;
		_state_3:
		boxes_installer_media_get_media_info_from_device_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->device);
			_g_object_unref0 (_data_->media_manager);
			_g_free0 (_data_->device_file);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	} else {
		_data_->self->from_image = TRUE;
		_data_->_tmp13_ = _data_->media_manager;
		_data_->_tmp14_ = boxes_media_manager_get_os_db (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = _data_->device_file;
		_data_->_state_ = 4;
		boxes_os_database_guess_os_from_install_media_path (_data_->_tmp15_, _data_->_tmp16_, _data_->cancellable, boxes_installer_media_new_for_path_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp17_ = boxes_os_database_guess_os_from_install_media_path_finish (_data_->_tmp15_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp12_ = _data_->_tmp17_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->device);
			_g_object_unref0 (_data_->media_manager);
			_g_free0 (_data_->device_file);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp18_ = _data_->_tmp12_;
		_data_->_tmp12_ = NULL;
		_g_object_unref0 (_data_->self->os_media);
		_data_->self->os_media = _data_->_tmp18_;
		_data_->_tmp19_ = _data_->self->os_media;
		if (_data_->_tmp19_ != NULL) {
			_data_->_tmp20_ = _data_->self->os_media;
			g_object_get (_data_->_tmp20_, "os", &_data_->_tmp21_, NULL);
			_data_->_tmp22_ = _data_->_tmp21_;
			_g_object_unref0 (_data_->self->os);
			_data_->self->os = _data_->_tmp22_;
		}
		_g_object_unref0 (_data_->_tmp12_);
	}
	boxes_installer_media_label_setup (_data_->self, NULL);
	_data_->_tmp24_ = boxes_installer_media_get_architecture (_data_->self);
	_data_->_tmp25_ = _data_->_tmp24_;
	_data_->_tmp23_ = _data_->_tmp25_;
	if (_data_->_tmp23_ == NULL) {
		_data_->_tmp26_ = g_strdup ("i686");
		_g_free0 (_data_->_tmp23_);
		_data_->_tmp23_ = _data_->_tmp26_;
	}
	_data_->_tmp27_ = _data_->_tmp23_;
	_data_->_tmp23_ = NULL;
	_data_->architecture = _data_->_tmp27_;
	_data_->_tmp28_ = _data_->media_manager;
	_data_->_tmp29_ = boxes_media_manager_get_os_db (_data_->_tmp28_);
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_tmp31_ = _data_->self->os;
	_data_->_tmp32_ = _data_->architecture;
	_data_->_tmp33_ = boxes_os_database_get_resources_for_os (_data_->_tmp30_, _data_->_tmp31_, _data_->_tmp32_);
	_g_object_unref0 (_data_->self->resources);
	_data_->self->resources = _data_->_tmp33_;
	_data_->_tmp36_ = _data_->architecture;
	if (g_strcmp0 (_data_->_tmp36_, "i686") == 0) {
		_data_->_tmp35_ = TRUE;
	} else {
		_data_->_tmp37_ = _data_->architecture;
		_data_->_tmp35_ = g_strcmp0 (_data_->_tmp37_, "i386") == 0;
	}
	if (_data_->_tmp35_) {
		_data_->_tmp38_ = _data_->self->resources;
		_data_->_tmp39_ = osinfo_resources_get_ram (_data_->_tmp38_);
		_data_->_tmp40_ = _data_->_tmp39_;
		_data_->_tmp34_ = CLAMP (_data_->_tmp40_, (gint64) OSINFO_MEBIBYTES, (gint64) G_MAXUINT32);
	} else {
		_data_->_tmp41_ = _data_->self->resources;
		_data_->_tmp42_ = osinfo_resources_get_ram (_data_->_tmp41_);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp34_ = CLAMP (_data_->_tmp43_, (gint64) OSINFO_MEBIBYTES, G_MAXINT64);
	}
	_data_->_tmp44_ = _data_->self->resources;
	osinfo_resources_set_ram (_data_->_tmp44_, _data_->_tmp34_);
	_g_free0 (_data_->architecture);
	_g_free0 (_data_->_tmp23_);
	_g_object_unref0 (_data_->device);
	_g_object_unref0 (_data_->media_manager);
	_g_free0 (_data_->device_file);
	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;
}

void
boxes_installer_media_new_for_path (const gchar* path,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	boxes_installer_media_construct_for_path (BOXES_TYPE_INSTALLER_MEDIA, path, cancellable, _callback_, _user_data_);
}

BoxesInstallerMedia*
boxes_installer_media_new_for_path_finish (GAsyncResult* _res_,
                                           GError** error)
{
	return boxes_installer_media_construct_for_path_finish (_res_, error);
}

static void
boxes_installer_media_real_set_direct_boot_params (BoxesInstallerMedia* self,
                                                   GVirConfigDomainOs* os)
{
	g_return_if_fail (os != NULL);
}

void
boxes_installer_media_set_direct_boot_params (BoxesInstallerMedia* self,
                                              GVirConfigDomainOs* os)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->set_direct_boot_params) {
		_klass_->set_direct_boot_params (self, os);
	}
}

static void
boxes_installer_media_real_prepare_data_free (gpointer _data)
{
	BoxesInstallerMediaPrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->progress);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaPrepareData, _data_);
}

static void
boxes_installer_media_real_prepare (BoxesInstallerMedia* self,
                                    BoxesActivityProgress* progress,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	BoxesInstallerMediaPrepareData* _data_;
	BoxesInstallerMedia* _tmp0_;
	BoxesActivityProgress* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (progress != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaPrepareData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_real_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data_->progress);
	_data_->progress = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_installer_media_real_prepare_co (_data_);
}

static gboolean
boxes_installer_media_real_prepare_finish (BoxesInstallerMedia* self,
                                           GAsyncResult* _res_)
{
	gboolean result;
	BoxesInstallerMediaPrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static gboolean
boxes_installer_media_real_prepare_co (BoxesInstallerMediaPrepareData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->result = TRUE;
	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;
}

void
boxes_installer_media_prepare (BoxesInstallerMedia* self,
                               BoxesActivityProgress* progress,
                               GCancellable* cancellable,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	BoxesInstallerMediaClass* _klass_;
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->prepare) {
		_klass_->prepare (self, progress, cancellable, _callback_, _user_data_);
	}
}

gboolean
boxes_installer_media_prepare_finish (BoxesInstallerMedia* self,
                                      GAsyncResult* _res_)
{
	BoxesInstallerMediaClass* _klass_;
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->prepare_finish) {
		return _klass_->prepare_finish (self, _res_);
	}
	return FALSE;
}

static void
boxes_installer_media_real_prepare_for_installation_data_free (gpointer _data)
{
	BoxesInstallerMediaPrepareForInstallationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->vm_name);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaPrepareForInstallationData, _data_);
}

static void
boxes_installer_media_real_prepare_for_installation (BoxesInstallerMedia* self,
                                                     const gchar* vm_name,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	BoxesInstallerMediaPrepareForInstallationData* _data_;
	BoxesInstallerMedia* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (vm_name != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaPrepareForInstallationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_real_prepare_for_installation_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (vm_name);
	_g_free0 (_data_->vm_name);
	_data_->vm_name = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_installer_media_real_prepare_for_installation_co (_data_);
}

static void
boxes_installer_media_real_prepare_for_installation_finish (BoxesInstallerMedia* self,
                                                            GAsyncResult* _res_)
{
	BoxesInstallerMediaPrepareForInstallationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
boxes_installer_media_real_prepare_for_installation_co (BoxesInstallerMediaPrepareForInstallationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	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;
}

void
boxes_installer_media_prepare_for_installation (BoxesInstallerMedia* self,
                                                const gchar* vm_name,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	BoxesInstallerMediaClass* _klass_;
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->prepare_for_installation) {
		_klass_->prepare_for_installation (self, vm_name, cancellable, _callback_, _user_data_);
	}
}

void
boxes_installer_media_prepare_for_installation_finish (BoxesInstallerMedia* self,
                                                       GAsyncResult* _res_)
{
	BoxesInstallerMediaClass* _klass_;
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->prepare_for_installation_finish) {
		_klass_->prepare_for_installation_finish (self, _res_);
	}
}

static void
boxes_installer_media_real_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                             const gchar* vm_name)
{
	g_return_if_fail (vm_name != NULL);
}

void
boxes_installer_media_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                        const gchar* vm_name)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->prepare_to_continue_installation) {
		_klass_->prepare_to_continue_installation (self, vm_name);
	}
}

static void
boxes_installer_media_real_clean_up (BoxesInstallerMedia* self)
{
	boxes_installer_media_clean_up_preparation_cache (self);
}

void
boxes_installer_media_clean_up (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->clean_up) {
		_klass_->clean_up (self);
	}
}

static void
boxes_installer_media_real_clean_up_preparation_cache (BoxesInstallerMedia* self)
{
}

void
boxes_installer_media_clean_up_preparation_cache (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->clean_up_preparation_cache) {
		_klass_->clean_up_preparation_cache (self);
	}
}

static void
boxes_installer_media_real_setup_domain_config (BoxesInstallerMedia* self,
                                                GVirConfigDomain* domain)
{
	GVirConfigDomainDiskType _tmp0_ = 0;
	const gchar* _tmp1_;
	g_return_if_fail (domain != NULL);
	if (self->from_image) {
		_tmp0_ = GVIR_CONFIG_DOMAIN_DISK_FILE;
	} else {
		_tmp0_ = GVIR_CONFIG_DOMAIN_DISK_BLOCK;
	}
	_tmp1_ = self->device_file;
	boxes_installer_media_add_cd_config (self, domain, _tmp0_, _tmp1_, "hdc", TRUE);
}

void
boxes_installer_media_setup_domain_config (BoxesInstallerMedia* self,
                                           GVirConfigDomain* domain)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->setup_domain_config) {
		_klass_->setup_domain_config (self, domain);
	}
}

static void
boxes_installer_media_real_setup_post_install_domain_config (BoxesInstallerMedia* self,
                                                             GVirConfigDomain* domain)
{
	g_return_if_fail (domain != NULL);
	boxes_installer_media_eject_cdrom_media (self, domain);
}

void
boxes_installer_media_setup_post_install_domain_config (BoxesInstallerMedia* self,
                                                        GVirConfigDomain* domain)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->setup_post_install_domain_config) {
		_klass_->setup_post_install_domain_config (self, domain);
	}
}

gboolean
boxes_installer_media_is_architecture_compatible (BoxesInstallerMedia* self,
                                                  const gchar* architecture)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_;
	BoxesCPUArchCompatibility compatibility = 0;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	BoxesCPUArchCompatibility _tmp7_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (architecture != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_architecture (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ == NULL;
	_g_free0 (_tmp2_);
	if (_tmp3_) {
		result = TRUE;
		return result;
	}
	_tmp4_ = boxes_installer_media_get_architecture (self);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = boxes_compare_cpu_architectures (architecture, _tmp6_);
	_g_free0 (_tmp6_);
	compatibility = _tmp7_;
	result = compatibility != BOXES_CPU_ARCH_COMPATIBILITY_INCOMPATIBLE;
	return result;
}

static BoxesVMCreator*
boxes_installer_media_real_get_vm_creator (BoxesInstallerMedia* self)
{
	BoxesVMCreator* _tmp0_;
	BoxesVMCreator* result;
	_tmp0_ = boxes_vm_creator_new (self);
	result = _tmp0_;
	return result;
}

BoxesVMCreator*
boxes_installer_media_get_vm_creator (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_vm_creator) {
		return _klass_->get_vm_creator (self);
	}
	return NULL;
}

void
boxes_installer_media_add_cd_config (BoxesInstallerMedia* self,
                                     GVirConfigDomain* domain,
                                     GVirConfigDomainDiskType type,
                                     const gchar* iso_path,
                                     const gchar* device_name,
                                     gboolean mandatory)
{
	GVirConfigDomainDisk* disk = NULL;
	GVirConfigDomainDisk* _tmp0_;
	GVirConfigDomainDisk* _tmp1_;
	GVirConfigDomainDisk* _tmp2_;
	GVirConfigDomainDisk* _tmp3_;
	GVirConfigDomainDisk* _tmp4_;
	GVirConfigDomainDisk* _tmp5_;
	GVirConfigDomainDiskBus _tmp7_ = 0;
	gboolean _tmp8_;
	gboolean _tmp9_;
	GVirConfigDomainDisk* _tmp10_;
	gboolean _tmp11_ = FALSE;
	GVirConfigDomainDisk* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (domain != NULL);
	g_return_if_fail (device_name != NULL);
	_tmp0_ = gvir_config_domain_disk_new ();
	disk = _tmp0_;
	_tmp1_ = disk;
	gvir_config_domain_disk_set_type (_tmp1_, type);
	_tmp2_ = disk;
	gvir_config_domain_disk_set_guest_device_type (_tmp2_, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM);
	_tmp3_ = disk;
	gvir_config_domain_disk_set_driver_name (_tmp3_, "qemu");
	_tmp4_ = disk;
	gvir_config_domain_disk_set_driver_format (_tmp4_, GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW);
	_tmp5_ = disk;
	gvir_config_domain_disk_set_target_dev (_tmp5_, device_name);
	if (iso_path != NULL) {
		GVirConfigDomainDisk* _tmp6_;
		_tmp6_ = disk;
		gvir_config_domain_disk_set_source (_tmp6_, iso_path);
	}
	_tmp8_ = boxes_installer_media_get_prefers_q35 (self);
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		_tmp7_ = GVIR_CONFIG_DOMAIN_DISK_BUS_SATA;
	} else {
		_tmp7_ = GVIR_CONFIG_DOMAIN_DISK_BUS_IDE;
	}
	_tmp10_ = disk;
	gvir_config_domain_disk_set_target_bus (_tmp10_, _tmp7_);
	if (type == GVIR_CONFIG_DOMAIN_DISK_FILE) {
		_tmp11_ = mandatory;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		GVirConfigDomainDisk* _tmp12_;
		_tmp12_ = disk;
		gvir_config_domain_disk_set_startup_policy (_tmp12_, GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_MANDATORY);
	}
	_tmp13_ = disk;
	gvir_config_domain_add_device (domain, (GVirConfigDomainDevice*) _tmp13_);
	_g_object_unref0 (disk);
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (needle != NULL, 0);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

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

void
boxes_installer_media_label_setup (BoxesInstallerMedia* self,
                                   const gchar* label)
{
	g_return_if_fail (self != NULL);
	if (label != NULL) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (label);
		_g_free0 (self->label);
		self->label = _tmp0_;
	} else {
		gboolean _tmp1_ = FALSE;
		OsinfoOs* _tmp2_;
		_tmp2_ = self->os;
		if (_tmp2_ != NULL) {
			OsinfoMedia* _tmp3_;
			_tmp3_ = self->os_media;
			_tmp1_ = _tmp3_ != NULL;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			OsinfoOsVariantList* variants = NULL;
			OsinfoMedia* _tmp4_;
			OsinfoOsVariantList* _tmp5_;
			OsinfoOsVariantList* _tmp6_;
			_tmp4_ = self->os_media;
			_tmp5_ = osinfo_media_get_os_variants (_tmp4_);
			variants = _tmp5_;
			_tmp6_ = variants;
			if (osinfo_list_get_length ((OsinfoList*) _tmp6_) > 0) {
				OsinfoOsVariant* variant = NULL;
				OsinfoOsVariantList* _tmp7_;
				OsinfoEntity* _tmp8_;
				OsinfoOsVariant* _tmp9_;
				OsinfoOsVariant* _tmp10_;
				OsinfoOsVariant* _tmp11_;
				const gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp7_ = variants;
				_tmp8_ = osinfo_list_get_nth ((OsinfoList*) _tmp7_, 0);
				_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, osinfo_os_variant_get_type ()) ? ((OsinfoOsVariant*) _tmp8_) : NULL);
				variant = _tmp9_;
				_tmp10_ = variant;
				_vala_assert (_tmp10_ != NULL, "variant != null");
				_tmp11_ = variant;
				_tmp12_ = osinfo_os_variant_get_name (_tmp11_);
				_tmp13_ = g_strdup (_tmp12_);
				_g_free0 (self->label);
				self->label = _tmp13_;
				_g_object_unref0 (variant);
			} else {
				OsinfoOs* _tmp14_;
				const gchar* _tmp15_;
				gchar* _tmp16_;
				_tmp14_ = self->os;
				_tmp15_ = osinfo_product_get_name ((OsinfoProduct*) _tmp14_);
				_tmp16_ = g_strdup (_tmp15_);
				_g_free0 (self->label);
				self->label = _tmp16_;
			}
			_g_object_unref0 (variants);
		} else {
			gchar* basename = NULL;
			const gchar* _tmp17_;
			gchar* _tmp18_;
			gint ext_index = 0;
			const gchar* _tmp19_;
			gchar* _tmp20_ = NULL;
			gchar* _tmp25_;
			_tmp17_ = self->device_file;
			_tmp18_ = boxes_get_utf8_basename (_tmp17_);
			basename = _tmp18_;
			_tmp19_ = basename;
			ext_index = string_index_of (_tmp19_, ".", 0);
			if (ext_index > 0) {
				const gchar* _tmp21_;
				gchar* _tmp22_;
				_tmp21_ = basename;
				_tmp22_ = string_slice (_tmp21_, (glong) 0, (glong) ext_index);
				_g_free0 (_tmp20_);
				_tmp20_ = _tmp22_;
			} else {
				const gchar* _tmp23_;
				gchar* _tmp24_;
				_tmp23_ = basename;
				_tmp24_ = g_strdup (_tmp23_);
				_g_free0 (_tmp20_);
				_tmp20_ = _tmp24_;
			}
			_tmp25_ = g_strdup (_tmp20_);
			_g_free0 (self->label);
			self->label = _tmp25_;
			_g_free0 (_tmp20_);
			_g_free0 (basename);
			return;
		}
	}
}

static void
boxes_installer_media_get_device_file_from_path_data_free (gpointer _data)
{
	BoxesInstallerMediaGetDeviceFileFromPathData* _data_;
	_data_ = _data;
	_g_free0 (_data_->path);
	_g_object_unref0 (_data_->cancellable);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaGetDeviceFileFromPathData, _data_);
}

static void
boxes_installer_media_get_device_file_from_path (BoxesInstallerMedia* self,
                                                 const gchar* path,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	BoxesInstallerMediaGetDeviceFileFromPathData* _data_;
	BoxesInstallerMedia* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (path != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaGetDeviceFileFromPathData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_get_device_file_from_path_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_installer_media_get_device_file_from_path_co (_data_);
}

static gchar*
boxes_installer_media_get_device_file_from_path_finish (BoxesInstallerMedia* self,
                                                        GAsyncResult* _res_)
{
	gchar* result;
	BoxesInstallerMediaGetDeviceFileFromPathData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
boxes_installer_media_get_device_file_from_path_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	BoxesInstallerMediaGetDeviceFileFromPathData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_installer_media_get_device_file_from_path_co (_data_);
}

static gboolean
boxes_installer_media_get_device_file_from_path_co (BoxesInstallerMediaGetDeviceFileFromPathData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = g_file_new_for_path (_data_->path);
		_data_->mount_dir = _data_->_tmp0_;
		_data_->_state_ = 1;
		g_file_find_enclosing_mount_async (_data_->mount_dir, G_PRIORITY_DEFAULT, _data_->cancellable, boxes_installer_media_get_device_file_from_path_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = g_file_find_enclosing_mount_finish (_data_->mount_dir, _data_->_res_, &_data_->_inner_error0_);
		_data_->mount = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->mount_dir);
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = g_mount_get_root (_data_->mount);
		_data_->root_dir = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->root_dir;
		_data_->_tmp4_ = g_file_get_path (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = g_file_get_path (_data_->mount_dir);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = g_strcmp0 (_data_->_tmp5_, _data_->_tmp7_) == 0;
		_g_free0 (_data_->_tmp7_);
		_g_free0 (_data_->_tmp5_);
		if (_data_->_tmp8_) {
			_data_->_tmp9_ = g_mount_get_volume (_data_->mount);
			_data_->volume = _data_->_tmp9_;
			_data_->_tmp10_ = _data_->volume;
			_data_->_tmp11_ = g_volume_get_identifier (_data_->_tmp10_, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
			_g_free0 (_data_->self->device_file);
			_data_->self->device_file = _data_->_tmp11_;
			_data_->_tmp12_ = g_strdup (_data_->path);
			_g_free0 (_data_->self->mount_point);
			_data_->self->mount_point = _data_->_tmp12_;
			_g_object_unref0 (_data_->volume);
		} else {
			_data_->_tmp13_ = g_strdup (_data_->path);
			_g_free0 (_data_->self->device_file);
			_data_->self->device_file = _data_->_tmp13_;
		}
		_g_object_unref0 (_data_->root_dir);
		_g_object_unref0 (_data_->mount);
		_g_object_unref0 (_data_->mount_dir);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->_tmp14_ = g_strdup (_data_->path);
		_g_free0 (_data_->self->device_file);
		_data_->self->device_file = _data_->_tmp14_;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp15_ = _data_->self->device_file;
	_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
	_data_->result = _data_->_tmp16_;
	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
boxes_installer_media_get_device_from_device_file_data_free (gpointer _data)
{
	BoxesInstallerMediaGetDeviceFromDeviceFileData* _data_;
	_data_ = _data;
	_g_free0 (_data_->device_file);
	_g_object_unref0 (_data_->client);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaGetDeviceFromDeviceFileData, _data_);
}

static void
boxes_installer_media_get_device_from_device_file (BoxesInstallerMedia* self,
                                                   const gchar* device_file,
                                                   GUdevClient* client,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	BoxesInstallerMediaGetDeviceFromDeviceFileData* _data_;
	BoxesInstallerMedia* _tmp0_;
	gchar* _tmp1_;
	GUdevClient* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device_file != NULL);
	g_return_if_fail (client != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaGetDeviceFromDeviceFileData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_get_device_from_device_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (device_file);
	_g_free0 (_data_->device_file);
	_data_->device_file = _tmp1_;
	_tmp2_ = _g_object_ref0 (client);
	_g_object_unref0 (_data_->client);
	_data_->client = _tmp2_;
	boxes_installer_media_get_device_from_device_file_co (_data_);
}

static GUdevDevice*
boxes_installer_media_get_device_from_device_file_finish (BoxesInstallerMedia* self,
                                                          GAsyncResult* _res_)
{
	GUdevDevice* result;
	BoxesInstallerMediaGetDeviceFromDeviceFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
boxes_installer_media_get_device_from_device_file_co (BoxesInstallerMediaGetDeviceFromDeviceFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_udev_client_query_by_device_file (_data_->client, _data_->device_file);
	_data_->result = _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;
}

static void
boxes_installer_media_get_media_info_from_device_data_free (gpointer _data)
{
	BoxesInstallerMediaGetMediaInfoFromDeviceData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->device);
	_g_object_unref0 (_data_->os_db);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesInstallerMediaGetMediaInfoFromDeviceData, _data_);
}

static void
boxes_installer_media_get_media_info_from_device (BoxesInstallerMedia* self,
                                                  GUdevDevice* device,
                                                  BoxesOSDatabase* os_db,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	BoxesInstallerMediaGetMediaInfoFromDeviceData* _data_;
	BoxesInstallerMedia* _tmp0_;
	GUdevDevice* _tmp1_;
	BoxesOSDatabase* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	g_return_if_fail (os_db != NULL);
	_data_ = g_slice_new0 (BoxesInstallerMediaGetMediaInfoFromDeviceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_installer_media_get_media_info_from_device_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (device);
	_g_object_unref0 (_data_->device);
	_data_->device = _tmp1_;
	_tmp2_ = _g_object_ref0 (os_db);
	_g_object_unref0 (_data_->os_db);
	_data_->os_db = _tmp2_;
	boxes_installer_media_get_media_info_from_device_co (_data_);
}

static void
boxes_installer_media_get_media_info_from_device_finish (BoxesInstallerMedia* self,
                                                         GAsyncResult* _res_,
                                                         GError** error)
{
	BoxesInstallerMediaGetMediaInfoFromDeviceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
boxes_installer_media_get_media_info_from_device_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	BoxesInstallerMediaGetMediaInfoFromDeviceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_installer_media_get_media_info_from_device_co (_data_);
}

static gboolean
boxes_installer_media_get_media_info_from_device_co (BoxesInstallerMediaGetMediaInfoFromDeviceData* _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_->_tmp1_ = g_udev_device_get_property (_data_->device, "ID_FS_BOOT_SYSTEM_ID");
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp0_ = !g_udev_device_get_property_as_boolean (_data_->device, "OSINFO_BOOTABLE");
	} else {
		_data_->_tmp0_ = FALSE;
	}
	if (_data_->_tmp0_) {
		_data_->_tmp2_ = _data_->self->device_file;
		_data_->_tmp3_ = g_error_new (BOXES_OS_DATABASE_ERROR, BOXES_OS_DATABASE_ERROR_NON_BOOTABLE, "Media %s is not bootable.", _data_->_tmp2_);
		_data_->_inner_error0_ = _data_->_tmp3_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = boxes_installer_media_get_decoded_udev_property (_data_->self, _data_->device, "ID_FS_LABEL_ENC");
	_g_free0 (_data_->self->label);
	_data_->self->label = _data_->_tmp4_;
	_data_->_tmp6_ = g_udev_device_get_property (_data_->device, "OSINFO_INSTALLER");
	_data_->_tmp5_ = _data_->_tmp6_;
	if (_data_->_tmp5_ == NULL) {
		_data_->_tmp7_ = g_udev_device_get_property (_data_->device, "OSINFO_LIVE");
		_data_->_tmp5_ = _data_->_tmp7_;
	}
	_data_->_tmp8_ = g_strdup (_data_->_tmp5_);
	_data_->os_id = _data_->_tmp8_;
	_data_->_tmp9_ = _data_->os_id;
	if (_data_->_tmp9_ != NULL) {
		_data_->_tmp11_ = _data_->os_id;
		_data_->_state_ = 1;
		boxes_os_database_get_os_by_id (_data_->os_db, _data_->_tmp11_, boxes_installer_media_get_media_info_from_device_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp12_ = boxes_os_database_get_os_by_id_finish (_data_->os_db, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp10_ = _data_->_tmp12_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->os_id);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp13_ = _data_->_tmp10_;
		_data_->_tmp10_ = NULL;
		_g_object_unref0 (_data_->self->os);
		_data_->self->os = _data_->_tmp13_;
		_data_->_tmp14_ = g_udev_device_get_property (_data_->device, "OSINFO_MEDIA");
		_data_->_tmp15_ = g_strdup (_data_->_tmp14_);
		_data_->media_id = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->media_id;
		if (_data_->_tmp16_ != NULL) {
			_data_->_tmp18_ = _data_->self->os;
			_data_->_tmp19_ = _data_->media_id;
			_data_->_tmp20_ = boxes_os_database_get_media_by_id (_data_->os_db, _data_->_tmp18_, _data_->_tmp19_, &_data_->_inner_error0_);
			_data_->_tmp17_ = _data_->_tmp20_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_free0 (_data_->media_id);
				_g_object_unref0 (_data_->_tmp10_);
				_g_free0 (_data_->os_id);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp21_ = _data_->_tmp17_;
			_data_->_tmp17_ = NULL;
			_g_object_unref0 (_data_->self->os_media);
			_data_->self->os_media = _data_->_tmp21_;
			_g_object_unref0 (_data_->_tmp17_);
		}
		_g_free0 (_data_->media_id);
		_g_object_unref0 (_data_->_tmp10_);
	} else {
		_data_->_tmp22_ = _data_->self->device_file;
		_data_->_tmp23_ = osinfo_media_new (_data_->_tmp22_, OSINFO_ARCHITECTURE_ALL);
		_data_->media = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->media;
		_data_->_tmp25_ = _data_->self->label;
		g_object_set (_data_->_tmp24_, "volume-id", _data_->_tmp25_, NULL);
		_data_->_tmp26_ = g_strdup ("ID_FS_SYSTEM_ID");
		_data_->_tmp27_ = g_strdup ("ID_FS_PUBLISHER_ID");
		_data_->_tmp28_ = g_strdup ("ID_FS_APPLICATION_ID");
		_data_->_tmp29_ = g_new0 (gchar*, 3 + 1);
		_data_->_tmp29_[0] = _data_->_tmp26_;
		_data_->_tmp29_[1] = _data_->_tmp27_;
		_data_->_tmp29_[2] = _data_->_tmp28_;
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp30__length1 = 3;
		_data_->_tmp31_ = g_strdup (OSINFO_MEDIA_PROP_SYSTEM_ID);
		_data_->_tmp32_ = g_strdup (OSINFO_MEDIA_PROP_PUBLISHER_ID);
		_data_->_tmp33_ = g_strdup (OSINFO_MEDIA_PROP_APPLICATION_ID);
		_data_->_tmp34_ = g_new0 (gchar*, 3 + 1);
		_data_->_tmp34_[0] = _data_->_tmp31_;
		_data_->_tmp34_[1] = _data_->_tmp32_;
		_data_->_tmp34_[2] = _data_->_tmp33_;
		_data_->_tmp35_ = _data_->_tmp34_;
		_data_->_tmp35__length1 = 3;
		_data_->_tmp36_ = _data_->media;
		boxes_installer_media_get_decoded_udev_properties_for_media (_data_->self, _data_->device, _data_->_tmp30_, (gint) 3, _data_->_tmp35_, (gint) 3, _data_->_tmp36_);
		_data_->_tmp35_ = (_vala_array_free (_data_->_tmp35_, _data_->_tmp35__length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp30_ = (_vala_array_free (_data_->_tmp30_, _data_->_tmp30__length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp38_ = _data_->media;
		_data_->_state_ = 2;
		boxes_os_database_guess_os_from_install_media (_data_->os_db, _data_->_tmp38_, boxes_installer_media_get_media_info_from_device_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp39_ = boxes_os_database_guess_os_from_install_media_finish (_data_->os_db, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp37_ = _data_->_tmp39_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->media);
			_g_free0 (_data_->os_id);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp40_ = _data_->_tmp37_;
		_data_->_tmp37_ = NULL;
		_g_object_unref0 (_data_->self->os_media);
		_data_->self->os_media = _data_->_tmp40_;
		_data_->_tmp41_ = _data_->self->os_media;
		if (_data_->_tmp41_ != NULL) {
			_data_->_tmp42_ = _data_->self->os_media;
			g_object_get (_data_->_tmp42_, "os", &_data_->_tmp43_, NULL);
			_data_->_tmp44_ = _data_->_tmp43_;
			_g_object_unref0 (_data_->self->os);
			_data_->self->os = _data_->_tmp44_;
		}
		_g_object_unref0 (_data_->_tmp37_);
		_g_object_unref0 (_data_->media);
	}
	_g_free0 (_data_->os_id);
	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
boxes_installer_media_get_decoded_udev_properties_for_media (BoxesInstallerMedia* self,
                                                             GUdevDevice* device,
                                                             gchar** udev_props,
                                                             gint udev_props_length1,
                                                             gchar** media_props,
                                                             gint media_props_length1,
                                                             OsinfoMedia* media)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	g_return_if_fail (media != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar* val = NULL;
				const gchar* _tmp2_;
				gchar* _tmp3_;
				const gchar* _tmp4_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < udev_props_length1)) {
					break;
				}
				_tmp2_ = udev_props[i];
				_tmp3_ = boxes_installer_media_get_decoded_udev_property (self, device, _tmp2_);
				val = _tmp3_;
				_tmp4_ = val;
				if (_tmp4_ != NULL) {
					const gchar* _tmp5_;
					const gchar* _tmp6_;
					_tmp5_ = media_props[i];
					_tmp6_ = val;
					g_object_set ((GObject*) media, _tmp5_, _tmp6_, NULL);
				}
				_g_free0 (val);
			}
		}
	}
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static gchar*
boxes_installer_media_get_decoded_udev_property (BoxesInstallerMedia* self,
                                                 GUdevDevice* device,
                                                 const gchar* property_name)
{
	gchar* encoded = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* decoded = NULL;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (device != NULL, NULL);
	g_return_val_if_fail (property_name != NULL, NULL);
	_tmp0_ = g_udev_device_get_property (device, property_name);
	_tmp1_ = g_strdup (_tmp0_);
	encoded = _tmp1_;
	_tmp2_ = encoded;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_free0 (encoded);
		return result;
	}
	_tmp3_ = g_strdup ("");
	decoded = _tmp3_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp4_ = FALSE;
			_tmp4_ = TRUE;
			while (TRUE) {
				const gchar* _tmp5_;
				gint _tmp6_;
				gint _tmp7_;
				guint x = 0U;
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				gint _tmp10_;
				gint _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				guint _tmp14_ = 0U;
				gint _tmp15_;
				gboolean _tmp16_;
				if (!_tmp4_) {
				}
				_tmp4_ = FALSE;
				_tmp5_ = encoded;
				_tmp6_ = strlen (_tmp5_);
				_tmp7_ = _tmp6_;
				if (!(i < _tmp7_)) {
					break;
				}
				_tmp8_ = encoded;
				_tmp9_ = encoded;
				_tmp10_ = strlen (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = string_slice (_tmp8_, (glong) i, (glong) _tmp11_);
				_tmp13_ = _tmp12_;
				_tmp15_ = sscanf (_tmp13_, "\\x%02x", &_tmp14_);
				x = _tmp14_;
				_tmp16_ = _tmp15_ > 0;
				_g_free0 (_tmp13_);
				if (_tmp16_) {
					const gchar* _tmp17_;
					gchar* _tmp18_;
					gchar* _tmp19_;
					gchar* _tmp20_;
					_tmp17_ = decoded;
					_tmp18_ = g_strdup_printf ("%c", (gchar) x);
					_tmp19_ = _tmp18_;
					_tmp20_ = g_strconcat (_tmp17_, _tmp19_, NULL);
					_g_free0 (decoded);
					decoded = _tmp20_;
					_g_free0 (_tmp19_);
					i += 4;
				} else {
					const gchar* _tmp21_;
					const gchar* _tmp22_;
					gchar* _tmp23_;
					gchar* _tmp24_;
					gchar* _tmp25_;
					gint _tmp26_;
					_tmp21_ = decoded;
					_tmp22_ = encoded;
					_tmp23_ = g_strdup_printf ("%c", string_get (_tmp22_, (glong) i));
					_tmp24_ = _tmp23_;
					_tmp25_ = g_strconcat (_tmp21_, _tmp24_, NULL);
					_g_free0 (decoded);
					decoded = _tmp25_;
					_g_free0 (_tmp24_);
					_tmp26_ = i;
					i = _tmp26_ + 1;
				}
			}
		}
	}
	result = decoded;
	_g_free0 (encoded);
	return result;
}

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 void
boxes_installer_media_eject_cdrom_media (BoxesInstallerMedia* self,
                                         GVirConfigDomain* domain)
{
	GList* devices = NULL;
	GList* _tmp0_;
	GList* _tmp1_;
	GList* _tmp14_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (domain != NULL);
	_tmp0_ = gvir_config_domain_get_devices (domain);
	devices = _tmp0_;
	_tmp1_ = devices;
	{
		GList* device_collection = NULL;
		GList* device_it = NULL;
		device_collection = _tmp1_;
		for (device_it = device_collection; device_it != NULL; device_it = device_it->next) {
			GVirConfigDomainDevice* _tmp2_;
			GVirConfigDomainDevice* device = NULL;
			_tmp2_ = _g_object_ref0 ((GVirConfigDomainDevice*) device_it->data);
			device = _tmp2_;
			{
				GVirConfigDomainDevice* _tmp3_;
				GVirConfigDomainDisk* disk = NULL;
				GVirConfigDomainDevice* _tmp4_;
				GVirConfigDomainDisk* _tmp5_;
				GVirConfigDomainDiskGuestDeviceType disk_type = 0;
				GVirConfigDomainDisk* _tmp6_;
				_tmp3_ = device;
				if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, gvir_config_domain_disk_get_type ())) {
					_g_object_unref0 (device);
					continue;
				}
				_tmp4_ = device;
				_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gvir_config_domain_disk_get_type ()) ? ((GVirConfigDomainDisk*) _tmp4_) : NULL);
				disk = _tmp5_;
				_tmp6_ = disk;
				disk_type = gvir_config_domain_disk_get_guest_device_type (_tmp6_);
				if (disk_type == GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM) {
					GVirConfigDomainDisk* _tmp7_;
					gboolean _tmp8_ = FALSE;
					gboolean _tmp9_;
					gboolean _tmp10_;
					_tmp7_ = disk;
					gvir_config_domain_disk_set_startup_policy (_tmp7_, GVIR_CONFIG_DOMAIN_DISK_STARTUP_POLICY_OPTIONAL);
					_tmp9_ = boxes_installer_media_get_eject_after_install (self);
					_tmp10_ = _tmp9_;
					if (_tmp10_) {
						gboolean _tmp11_;
						gboolean _tmp12_;
						_tmp11_ = boxes_installer_media_get_live (self);
						_tmp12_ = _tmp11_;
						_tmp8_ = !_tmp12_;
					} else {
						_tmp8_ = FALSE;
					}
					if (_tmp8_) {
						GVirConfigDomainDisk* _tmp13_;
						_tmp13_ = disk;
						gvir_config_domain_disk_set_source (_tmp13_, "");
					}
				}
				_g_object_unref0 (disk);
				_g_object_unref0 (device);
			}
		}
	}
	_tmp14_ = devices;
	gvir_config_domain_set_devices (domain, _tmp14_);
	(devices == NULL) ? NULL : (devices = (_g_list_free__g_object_unref0_ (devices), NULL));
}

void
boxes_installer_media_set_uefi_firmware (BoxesInstallerMedia* self,
                                         GVirConfigDomain* domain,
                                         gboolean use_uefi)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (domain != NULL);
	{
		GVirConfigDomainOs* os = NULL;
		GVirConfigDomainOs* _tmp0_;
		GVirConfigDomainOs* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		GVirConfigDomainOs* _tmp4_;
		GVirConfigDomainOs* _tmp5_;
		GVirConfigDomainOsFirmware _tmp6_ = 0;
		_tmp0_ = gvir_config_domain_get_os (domain);
		_tmp1_ = _tmp0_;
		_tmp2_ = gvir_config_object_to_xml ((GVirConfigObject*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = gvir_config_domain_os_new_from_xml (_tmp3_, &_inner_error0_);
		_tmp5_ = _tmp4_;
		_g_free0 (_tmp3_);
		_g_object_unref0 (_tmp1_);
		os = _tmp5_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (use_uefi) {
			_tmp6_ = GVIR_CONFIG_DOMAIN_OS_FIRMWARE_EFI;
		} else {
			_tmp6_ = GVIR_CONFIG_DOMAIN_OS_FIRMWARE_BIOS;
		}
		gvir_config_domain_os_set_firmware (os, _tmp6_);
		gvir_config_domain_set_os (domain, os);
		_g_object_unref0 (os);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		const gchar* _tmp7_ = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		if (use_uefi) {
			_tmp7_ = "EFI";
		} else {
			_tmp7_ = "BIOS";
		}
		_tmp8_ = _error_;
		_tmp9_ = _tmp8_->message;
		g_warning ("installer-media.vala:378: Failed to set %s firmware: %s", _tmp7_, _tmp9_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

BoxesInstallerMedia*
boxes_installer_media_construct (GType object_type)
{
	BoxesInstallerMedia * self = NULL;
	self = (BoxesInstallerMedia*) g_object_new (object_type, NULL);
	return self;
}

BoxesInstallerMedia*
boxes_installer_media_new (void)
{
	return boxes_installer_media_construct (BOXES_TYPE_INSTALLER_MEDIA);
}

gboolean
boxes_installer_media_get_skip_import (BoxesInstallerMedia* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_skip_import;
	return result;
}

void
boxes_installer_media_set_skip_import (BoxesInstallerMedia* self,
                                       gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = boxes_installer_media_get_skip_import (self);
	if (old_value != value) {
		self->priv->_skip_import = value;
		g_object_notify_by_pspec ((GObject *) self, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY]);
	}
}

gboolean
boxes_installer_media_get_supports_express_install (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoMedia* _tmp0_;
	OsinfoMedia* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->os_media;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->os_media;
	result = osinfo_media_supports_installer_script (_tmp1_);
	return result;
}

OsinfoDeviceList*
boxes_installer_media_get_supported_devices (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_supported_devices) {
		return _klass_->get_supported_devices (self);
	}
	return NULL;
}

static OsinfoDeviceList*
boxes_installer_media_real_get_supported_devices (BoxesInstallerMedia* base)
{
	OsinfoDeviceList* result;
	BoxesInstallerMedia* self;
	OsinfoDeviceList* _tmp0_ = NULL;
	OsinfoOs* _tmp1_;
	self = base;
	_tmp1_ = self->os;
	if (_tmp1_ != NULL) {
		OsinfoOs* _tmp2_;
		OsinfoDeviceList* _tmp3_;
		_tmp2_ = self->os;
		_tmp3_ = osinfo_os_get_all_devices (_tmp2_, NULL);
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp3_;
	} else {
		OsinfoDeviceList* _tmp4_;
		_tmp4_ = osinfo_devicelist_new ();
		_g_object_unref0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	result = _tmp0_;
	return result;
}

guint64
boxes_installer_media_get_installed_size (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, 0ULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_installed_size) {
		return _klass_->get_installed_size (self);
	}
	return 0ULL;
}

static guint64
boxes_installer_media_real_get_installed_size (BoxesInstallerMedia* base)
{
	guint64 result;
	BoxesInstallerMedia* self;
	self = base;
	result = (guint64) 0;
	return result;
}

gboolean
boxes_installer_media_get_need_user_input_for_vm_creation (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_need_user_input_for_vm_creation) {
		return _klass_->get_need_user_input_for_vm_creation (self);
	}
	return FALSE;
}

static gboolean
boxes_installer_media_real_get_need_user_input_for_vm_creation (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesInstallerMedia* self;
	self = base;
	result = FALSE;
	return result;
}

gboolean
boxes_installer_media_get_supports_virtio1_disk (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoDeviceList* _tmp0_;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDevice* _tmp3_;
	OsinfoDevice* _tmp4_;
	gboolean _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_supported_devices (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = boxes_find_device_by_prop (_tmp2_, OSINFO_DEVICE_PROP_NAME, "virtio1.0-block");
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

gboolean
boxes_installer_media_get_supports_virtio_disk (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoDeviceList* _tmp0_;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDevice* _tmp3_;
	OsinfoDevice* _tmp4_;
	gboolean _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_supported_devices (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = boxes_find_device_by_prop (_tmp2_, OSINFO_DEVICE_PROP_NAME, "virtio-block");
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

gboolean
boxes_installer_media_get_supports_virtio1_net (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoDeviceList* _tmp0_;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDevice* _tmp3_;
	OsinfoDevice* _tmp4_;
	gboolean _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_supported_devices (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = boxes_find_device_by_prop (_tmp2_, OSINFO_DEVICE_PROP_NAME, "virtio1.0-net");
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

gboolean
boxes_installer_media_get_supports_virtio_net (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoDeviceList* _tmp0_;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDevice* _tmp3_;
	OsinfoDevice* _tmp4_;
	gboolean _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_supported_devices (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = boxes_find_device_by_prop (_tmp2_, OSINFO_DEVICE_PROP_NAME, "virtio-net");
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

gboolean
boxes_installer_media_get_supports_virtio_gpu (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoDeviceList* _tmp0_;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDevice* _tmp3_;
	OsinfoDevice* _tmp4_;
	gboolean _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = boxes_installer_media_get_supported_devices (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = boxes_find_device_by_prop (_tmp2_, OSINFO_DEVICE_PROP_NAME, "virtio1.0-gpu");
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ != NULL;
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

gboolean
boxes_installer_media_get_supports_efi (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoOs* _tmp0_;
	OsinfoOs* _tmp1_;
	OsinfoFirmwareList* _tmp2_;
	OsinfoFirmwareList* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->os;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->os;
	_tmp2_ = osinfo_os_get_firmware_list (_tmp1_, NULL);
	_tmp3_ = _tmp2_;
	_tmp4_ = osinfo_list_get_elements ((OsinfoList*) _tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	{
		GList* iter_collection = NULL;
		GList* iter_it = NULL;
		iter_collection = _tmp5_;
		for (iter_it = iter_collection; iter_it != NULL; iter_it = iter_it->next) {
			OsinfoEntity* iter = NULL;
			iter = (OsinfoEntity*) iter_it->data;
			{
				OsinfoFirmware* firmware = NULL;
				OsinfoEntity* _tmp6_;
				OsinfoFirmware* _tmp7_;
				OsinfoFirmware* _tmp8_;
				const gchar* _tmp9_;
				_tmp6_ = iter;
				_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, osinfo_firmware_get_type ()) ? ((OsinfoFirmware*) _tmp6_) : NULL);
				firmware = _tmp7_;
				_tmp8_ = firmware;
				_tmp9_ = osinfo_firmware_get_firmware_type (_tmp8_);
				if (g_strcmp0 (_tmp9_, "efi") == 0) {
					result = TRUE;
					_g_object_unref0 (firmware);
					(iter_collection == NULL) ? NULL : (iter_collection = (g_list_free (iter_collection), NULL));
					return result;
				}
				_g_object_unref0 (firmware);
			}
		}
		(iter_collection == NULL) ? NULL : (iter_collection = (g_list_free (iter_collection), NULL));
	}
	result = FALSE;
	return result;
}

gboolean
boxes_installer_media_get_requires_efi (BoxesInstallerMedia* self)
{
	gboolean result;
	OsinfoOs* _tmp0_;
	OsinfoOs* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->os;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->os;
	_tmp2_ = osinfo_entity_get_id ((OsinfoEntity*) _tmp1_);
	result = g_str_has_prefix (_tmp2_, "http://gnome.org/gnome/");
	return result;
}

gboolean
boxes_installer_media_get_prefers_q35 (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_prefers_q35) {
		return _klass_->get_prefers_q35 (self);
	}
	return FALSE;
}

static gboolean
boxes_installer_media_real_get_prefers_q35 (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesInstallerMedia* self;
	OsinfoOs* _tmp0_;
	OsinfoDevice* device = NULL;
	OsinfoDeviceList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoDeviceList* _tmp3_;
	OsinfoDevice* _tmp4_;
	OsinfoDevice* _tmp5_;
	OsinfoDevice* _tmp6_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_;
	gboolean _tmp9_;
	self = base;
	_tmp0_ = self->os;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = boxes_installer_media_get_supported_devices (self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = boxes_find_device_by_prop (_tmp3_, OSINFO_DEVICE_PROP_NAME, "qemu-x86-q35");
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp3_);
	device = _tmp5_;
	_tmp6_ = device;
	if (_tmp6_ == NULL) {
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	_tmp8_ = boxes_installer_media_get_supports_virtio_net (self);
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		gboolean _tmp10_;
		gboolean _tmp11_;
		_tmp10_ = boxes_installer_media_get_supports_virtio1_net (self);
		_tmp11_ = _tmp10_;
		_tmp7_ = !_tmp11_;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (device);
	return result;
}

gboolean
boxes_installer_media_get_prefers_ich9 (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_prefers_ich9) {
		return _klass_->get_prefers_ich9 (self);
	}
	return FALSE;
}

static gboolean
boxes_installer_media_real_get_prefers_ich9 (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesInstallerMedia* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	OsinfoDevice* device = NULL;
	OsinfoDeviceList* _tmp2_;
	OsinfoDeviceList* _tmp3_;
	OsinfoDeviceList* _tmp4_;
	OsinfoDevice* _tmp5_;
	OsinfoDevice* _tmp6_;
	OsinfoDevice* _tmp7_;
	self = base;
	_tmp0_ = boxes_installer_media_get_prefers_q35 (self);
	_tmp1_ = _tmp0_;
	if (!_tmp1_) {
		result = FALSE;
		return result;
	}
	_tmp2_ = boxes_installer_media_get_supported_devices (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = boxes_find_device_by_prop (_tmp4_, OSINFO_DEVICE_PROP_NAME, "ich9-hda");
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp4_);
	device = _tmp6_;
	_tmp7_ = device;
	if (_tmp7_ == NULL) {
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (device);
	return result;
}

gboolean
boxes_installer_media_get_live (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_live) {
		return _klass_->get_live (self);
	}
	return FALSE;
}

static gboolean
boxes_installer_media_real_get_live (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesInstallerMedia* self;
	gboolean _tmp0_ = FALSE;
	OsinfoMedia* _tmp1_;
	self = base;
	_tmp1_ = self->os_media;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		OsinfoMedia* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->os_media;
		g_object_get (_tmp2_, "live", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	result = _tmp0_;
	return result;
}

gboolean
boxes_installer_media_get_eject_after_install (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_eject_after_install) {
		return _klass_->get_eject_after_install (self);
	}
	return FALSE;
}

static gboolean
boxes_installer_media_real_get_eject_after_install (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesInstallerMedia* self;
	gboolean _tmp0_ = FALSE;
	OsinfoMedia* _tmp1_;
	self = base;
	_tmp1_ = self->os_media;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		OsinfoMedia* _tmp2_;
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->os_media;
		g_object_get (_tmp2_, "eject-after-install", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	}
	result = _tmp0_;
	return result;
}

gchar*
boxes_installer_media_get_architecture (BoxesInstallerMedia* self)
{
	BoxesInstallerMediaClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = BOXES_INSTALLER_MEDIA_GET_CLASS (self);
	if (_klass_->get_architecture) {
		return _klass_->get_architecture (self);
	}
	return NULL;
}

static gchar*
boxes_installer_media_real_get_architecture (BoxesInstallerMedia* base)
{
	gchar* result;
	BoxesInstallerMedia* self;
	gchar* _tmp0_ = NULL;
	OsinfoMedia* _tmp1_;
	self = base;
	_tmp1_ = self->os_media;
	if (_tmp1_ != NULL) {
		OsinfoMedia* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		_tmp2_ = self->os_media;
		g_object_get (_tmp2_, "architecture", &_tmp3_, NULL);
		_tmp4_ = _tmp3_;
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	} else {
		_g_free0 (_tmp0_);
		_tmp0_ = NULL;
	}
	result = _tmp0_;
	return result;
}

static void
boxes_installer_media_class_init (BoxesInstallerMediaClass * klass,
                                  gpointer klass_data)
{
	boxes_installer_media_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesInstallerMedia_private_offset);
	((BoxesInstallerMediaClass *) klass)->set_direct_boot_params = (void (*) (BoxesInstallerMedia*, GVirConfigDomainOs*)) boxes_installer_media_real_set_direct_boot_params;
	((BoxesInstallerMediaClass *) klass)->prepare = (void (*) (BoxesInstallerMedia*, BoxesActivityProgress*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_installer_media_real_prepare;
	((BoxesInstallerMediaClass *) klass)->prepare_finish = (gboolean (*) (BoxesInstallerMedia*, GAsyncResult*)) boxes_installer_media_real_prepare_finish;
	((BoxesInstallerMediaClass *) klass)->prepare_for_installation = (void (*) (BoxesInstallerMedia*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_installer_media_real_prepare_for_installation;
	((BoxesInstallerMediaClass *) klass)->prepare_for_installation_finish = (void (*) (BoxesInstallerMedia*, GAsyncResult*)) boxes_installer_media_real_prepare_for_installation_finish;
	((BoxesInstallerMediaClass *) klass)->prepare_to_continue_installation = (void (*) (BoxesInstallerMedia*, const gchar*)) boxes_installer_media_real_prepare_to_continue_installation;
	((BoxesInstallerMediaClass *) klass)->clean_up = (void (*) (BoxesInstallerMedia*)) boxes_installer_media_real_clean_up;
	((BoxesInstallerMediaClass *) klass)->clean_up_preparation_cache = (void (*) (BoxesInstallerMedia*)) boxes_installer_media_real_clean_up_preparation_cache;
	((BoxesInstallerMediaClass *) klass)->setup_domain_config = (void (*) (BoxesInstallerMedia*, GVirConfigDomain*)) boxes_installer_media_real_setup_domain_config;
	((BoxesInstallerMediaClass *) klass)->setup_post_install_domain_config = (void (*) (BoxesInstallerMedia*, GVirConfigDomain*)) boxes_installer_media_real_setup_post_install_domain_config;
	((BoxesInstallerMediaClass *) klass)->get_vm_creator = (BoxesVMCreator* (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_vm_creator;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_supported_devices = (OsinfoDeviceList* (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_supported_devices;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_installed_size = (guint64 (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_installed_size;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_need_user_input_for_vm_creation = (gboolean (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_need_user_input_for_vm_creation;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_prefers_q35 = (gboolean (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_prefers_q35;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_prefers_ich9 = (gboolean (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_prefers_ich9;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_live = (gboolean (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_live;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_eject_after_install = (gboolean (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_eject_after_install;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_architecture = (gchar* (*) (BoxesInstallerMedia*)) boxes_installer_media_real_get_architecture;
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_installer_media_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_installer_media_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_installer_media_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY] = g_param_spec_boolean ("skip-import", "skip-import", "skip-import", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_EXPRESS_INSTALL_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_EXPRESS_INSTALL_PROPERTY] = g_param_spec_boolean ("supports-express-install", "supports-express-install", "supports-express-install", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTED_DEVICES_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTED_DEVICES_PROPERTY] = g_param_spec_object ("supported-devices", "supported-devices", "supported-devices", osinfo_devicelist_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_INSTALLED_SIZE_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_INSTALLED_SIZE_PROPERTY] = g_param_spec_uint64 ("installed-size", "installed-size", "installed-size", 0, G_MAXUINT64, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY] = g_param_spec_boolean ("need-user-input-for-vm-creation", "need-user-input-for-vm-creation", "need-user-input-for-vm-creation", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_DISK_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_DISK_PROPERTY] = g_param_spec_boolean ("supports-virtio1-disk", "supports-virtio1-disk", "supports-virtio1-disk", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_DISK_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_DISK_PROPERTY] = g_param_spec_boolean ("supports-virtio-disk", "supports-virtio-disk", "supports-virtio-disk", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_NET_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_NET_PROPERTY] = g_param_spec_boolean ("supports-virtio1-net", "supports-virtio1-net", "supports-virtio1-net", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_NET_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_NET_PROPERTY] = g_param_spec_boolean ("supports-virtio-net", "supports-virtio-net", "supports-virtio-net", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_GPU_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_GPU_PROPERTY] = g_param_spec_boolean ("supports-virtio-gpu", "supports-virtio-gpu", "supports-virtio-gpu", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_SUPPORTS_EFI_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_SUPPORTS_EFI_PROPERTY] = g_param_spec_boolean ("supports-efi", "supports-efi", "supports-efi", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_REQUIRES_EFI_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_REQUIRES_EFI_PROPERTY] = g_param_spec_boolean ("requires-efi", "requires-efi", "requires-efi", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_PREFERS_Q35_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_PREFERS_Q35_PROPERTY] = g_param_spec_boolean ("prefers-q35", "prefers-q35", "prefers-q35", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_PREFERS_ICH9_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_PREFERS_ICH9_PROPERTY] = g_param_spec_boolean ("prefers-ich9", "prefers-ich9", "prefers-ich9", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_LIVE_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_LIVE_PROPERTY] = g_param_spec_boolean ("live", "live", "live", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_EJECT_AFTER_INSTALL_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_EJECT_AFTER_INSTALL_PROPERTY] = g_param_spec_boolean ("eject-after-install", "eject-after-install", "eject-after-install", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_INSTALLER_MEDIA_ARCHITECTURE_PROPERTY, boxes_installer_media_properties[BOXES_INSTALLER_MEDIA_ARCHITECTURE_PROPERTY] = g_param_spec_string ("architecture", "architecture", "architecture", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	boxes_installer_media_signals[BOXES_INSTALLER_MEDIA_USER_WANTS_TO_CREATE_SIGNAL] = g_signal_new ("user-wants-to-create", BOXES_TYPE_INSTALLER_MEDIA, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
boxes_installer_media_instance_init (BoxesInstallerMedia * self,
                                     gpointer klass)
{
	self->priv = boxes_installer_media_get_instance_private (self);
	self->priv->_skip_import = FALSE;
}

static void
boxes_installer_media_finalize (GObject * obj)
{
	BoxesInstallerMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia);
	_g_object_unref0 (self->os);
	_g_object_unref0 (self->resources);
	_g_object_unref0 (self->os_media);
	_g_free0 (self->label);
	_g_free0 (self->device_file);
	_g_free0 (self->mount_point);
	G_OBJECT_CLASS (boxes_installer_media_parent_class)->finalize (obj);
}

static GType
boxes_installer_media_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesInstallerMediaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_installer_media_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesInstallerMedia), 0, (GInstanceInitFunc) boxes_installer_media_instance_init, NULL };
	GType boxes_installer_media_type_id;
	boxes_installer_media_type_id = g_type_register_static (G_TYPE_OBJECT, "BoxesInstallerMedia", &g_define_type_info, 0);
	BoxesInstallerMedia_private_offset = g_type_add_instance_private (boxes_installer_media_type_id, sizeof (BoxesInstallerMediaPrivate));
	return boxes_installer_media_type_id;
}

GType
boxes_installer_media_get_type (void)
{
	static volatile gsize boxes_installer_media_type_id__once = 0;
	if (g_once_init_enter (&boxes_installer_media_type_id__once)) {
		GType boxes_installer_media_type_id;
		boxes_installer_media_type_id = boxes_installer_media_get_type_once ();
		g_once_init_leave (&boxes_installer_media_type_id__once, boxes_installer_media_type_id);
	}
	return boxes_installer_media_type_id__once;
}

static void
_vala_boxes_installer_media_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	BoxesInstallerMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia);
	switch (property_id) {
		case BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_skip_import (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_EXPRESS_INSTALL_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_express_install (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTED_DEVICES_PROPERTY:
		g_value_take_object (value, boxes_installer_media_get_supported_devices (self));
		break;
		case BOXES_INSTALLER_MEDIA_INSTALLED_SIZE_PROPERTY:
		g_value_set_uint64 (value, boxes_installer_media_get_installed_size (self));
		break;
		case BOXES_INSTALLER_MEDIA_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_need_user_input_for_vm_creation (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_DISK_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_virtio1_disk (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_DISK_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_virtio_disk (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO1_NET_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_virtio1_net (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_NET_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_virtio_net (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_VIRTIO_GPU_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_virtio_gpu (self));
		break;
		case BOXES_INSTALLER_MEDIA_SUPPORTS_EFI_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_supports_efi (self));
		break;
		case BOXES_INSTALLER_MEDIA_REQUIRES_EFI_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_requires_efi (self));
		break;
		case BOXES_INSTALLER_MEDIA_PREFERS_Q35_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_prefers_q35 (self));
		break;
		case BOXES_INSTALLER_MEDIA_PREFERS_ICH9_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_prefers_ich9 (self));
		break;
		case BOXES_INSTALLER_MEDIA_LIVE_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_live (self));
		break;
		case BOXES_INSTALLER_MEDIA_EJECT_AFTER_INSTALL_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_eject_after_install (self));
		break;
		case BOXES_INSTALLER_MEDIA_ARCHITECTURE_PROPERTY:
		g_value_take_string (value, boxes_installer_media_get_architecture (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_boxes_installer_media_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	BoxesInstallerMedia * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia);
	switch (property_id) {
		case BOXES_INSTALLER_MEDIA_SKIP_IMPORT_PROPERTY:
		boxes_installer_media_set_skip_import (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

