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

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

#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <libvirt-gobject/libvirt-gobject.h>
#include <gtk/gtk.h>
#include "common.h"
#include <osinfo/osinfo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

#define BOXES_VM_CREATOR_INSTALL_COMPLETE_PERCENT 99
#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_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;
typedef struct _BoxesVMCreatorPrivate BoxesVMCreatorPrivate;

#define BOXES_TYPE_COLLECTION_ITEM (boxes_collection_item_get_type ())
#define BOXES_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItem))
#define BOXES_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))
#define BOXES_IS_COLLECTION_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_IS_COLLECTION_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_COLLECTION_ITEM))
#define BOXES_COLLECTION_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_COLLECTION_ITEM, BoxesCollectionItemClass))

typedef struct _BoxesCollectionItem BoxesCollectionItem;
typedef struct _BoxesCollectionItemClass BoxesCollectionItemClass;

#define BOXES_TYPE_MACHINE (boxes_machine_get_type ())
#define BOXES_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MACHINE, BoxesMachine))
#define BOXES_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MACHINE, BoxesMachineClass))
#define BOXES_IS_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MACHINE))
#define BOXES_IS_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MACHINE))
#define BOXES_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MACHINE, BoxesMachineClass))

typedef struct _BoxesMachine BoxesMachine;
typedef struct _BoxesMachineClass BoxesMachineClass;

#define BOXES_TYPE_LIBVIRT_MACHINE (boxes_libvirt_machine_get_type ())
#define BOXES_LIBVIRT_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachine))
#define BOXES_LIBVIRT_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachineClass))
#define BOXES_IS_LIBVIRT_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_MACHINE))
#define BOXES_IS_LIBVIRT_MACHINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_MACHINE))
#define BOXES_LIBVIRT_MACHINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_MACHINE, BoxesLibvirtMachineClass))

typedef struct _BoxesLibvirtMachine BoxesLibvirtMachine;
typedef struct _BoxesLibvirtMachineClass BoxesLibvirtMachineClass;

#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;
enum  {
	BOXES_VM_CREATOR_0_PROPERTY,
	BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY,
	BOXES_VM_CREATOR_CONNECTION_PROPERTY,
	BOXES_VM_CREATOR_NUM_PROPERTIES
};
static GParamSpec* boxes_vm_creator_properties[BOXES_VM_CREATOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block52Data Block52Data;
typedef struct _Block53Data Block53Data;

#define BOXES_TYPE_APP (boxes_app_get_type ())
#define BOXES_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP, BoxesApp))
#define BOXES_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP, BoxesAppClass))
#define BOXES_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP))
#define BOXES_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP))
#define BOXES_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP, BoxesAppClass))

typedef struct _BoxesApp BoxesApp;
typedef struct _BoxesAppClass BoxesAppClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _BoxesInstallerMediaPrivate BoxesInstallerMediaPrivate;

#define BOXES_TYPE_BROKER (boxes_broker_get_type ())
#define BOXES_BROKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_BROKER, BoxesBroker))
#define BOXES_BROKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_BROKER, BoxesBrokerClass))
#define BOXES_IS_BROKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_BROKER))
#define BOXES_IS_BROKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_BROKER))
#define BOXES_BROKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_BROKER, BoxesBrokerClass))

typedef struct _BoxesBroker BoxesBroker;
typedef struct _BoxesBrokerClass BoxesBrokerClass;

#define BOXES_TYPE_LIBVIRT_BROKER (boxes_libvirt_broker_get_type ())
#define BOXES_LIBVIRT_BROKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_BROKER, BoxesLibvirtBroker))
#define BOXES_LIBVIRT_BROKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_BROKER, BoxesLibvirtBrokerClass))
#define BOXES_IS_LIBVIRT_BROKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_BROKER))
#define BOXES_IS_LIBVIRT_BROKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_BROKER))
#define BOXES_LIBVIRT_BROKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_BROKER, BoxesLibvirtBrokerClass))

typedef struct _BoxesLibvirtBroker BoxesLibvirtBroker;
typedef struct _BoxesLibvirtBrokerClass BoxesLibvirtBrokerClass;
typedef struct _BoxesVmCreatorCreateVmData BoxesVmCreatorCreateVmData;

#define BOXES_TYPE_UI (boxes_ui_get_type ())
#define BOXES_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UI, BoxesUI))
#define BOXES_IS_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UI))
#define BOXES_UI_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_UI, BoxesUIIface))

typedef struct _BoxesUI BoxesUI;
typedef struct _BoxesUIIface BoxesUIIface;
typedef enum  {
	BOXES_UI_STATE_NONE,
	BOXES_UI_STATE_COLLECTION,
	BOXES_UI_STATE_CREDS,
	BOXES_UI_STATE_DISPLAY,
	BOXES_UI_STATE_WIZARD,
	BOXES_UI_STATE_PROPERTIES,
	BOXES_UI_STATE_TROUBLESHOOT
} BoxesUIState;

#define BOXES_TYPE_UI_STATE (boxes_ui_state_get_type ())
typedef struct _BoxesCollectionItemPrivate BoxesCollectionItemPrivate;
typedef struct _BoxesMachinePrivate BoxesMachinePrivate;
typedef enum  {
	BOXES_MACHINE_CONNECT_FLAGS_NONE = 0,
	BOXES_MACHINE_CONNECT_FLAGS_IGNORE_SAVED_STATE = 1 << 0
} BoxesMachineConnectFlags;

#define BOXES_MACHINE_TYPE_CONNECT_FLAGS (boxes_machine_connect_flags_get_type ())

#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;
typedef enum  {
	BOXES_MACHINE_MACHINE_STATE_UNKNOWN,
	BOXES_MACHINE_MACHINE_STATE_STOPPED,
	BOXES_MACHINE_MACHINE_STATE_FORCE_STOPPED,
	BOXES_MACHINE_MACHINE_STATE_RUNNING,
	BOXES_MACHINE_MACHINE_STATE_PAUSED,
	BOXES_MACHINE_MACHINE_STATE_SAVED,
	BOXES_MACHINE_MACHINE_STATE_SLEEPING
} BoxesMachineMachineState;

#define BOXES_MACHINE_TYPE_MACHINE_STATE (boxes_machine_machine_state_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _BoxesVmCreatorContinueInstallationData BoxesVmCreatorContinueInstallationData;

#define BOXES_TYPE_INSTALLED_MEDIA (boxes_installed_media_get_type ())
#define BOXES_INSTALLED_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_INSTALLED_MEDIA, BoxesInstalledMedia))
#define BOXES_INSTALLED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_INSTALLED_MEDIA, BoxesInstalledMediaClass))
#define BOXES_IS_INSTALLED_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_INSTALLED_MEDIA))
#define BOXES_IS_INSTALLED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_INSTALLED_MEDIA))
#define BOXES_INSTALLED_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_INSTALLED_MEDIA, BoxesInstalledMediaClass))

typedef struct _BoxesInstalledMedia BoxesInstalledMedia;
typedef struct _BoxesInstalledMediaClass BoxesInstalledMediaClass;

#define BOXES_TYPE_LIBVIRT_MEDIA (boxes_libvirt_media_get_type ())
#define BOXES_LIBVIRT_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_MEDIA, BoxesLibvirtMedia))
#define BOXES_LIBVIRT_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_MEDIA, BoxesLibvirtMediaClass))
#define BOXES_IS_LIBVIRT_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_MEDIA))
#define BOXES_IS_LIBVIRT_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_MEDIA))
#define BOXES_LIBVIRT_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_MEDIA, BoxesLibvirtMediaClass))

typedef struct _BoxesLibvirtMedia BoxesLibvirtMedia;
typedef struct _BoxesLibvirtMediaClass BoxesLibvirtMediaClass;

#define BOXES_TYPE_LIBVIRT_CLONED_MEDIA (boxes_libvirt_cloned_media_get_type ())
#define BOXES_LIBVIRT_CLONED_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_CLONED_MEDIA, BoxesLibvirtClonedMedia))
#define BOXES_LIBVIRT_CLONED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_CLONED_MEDIA, BoxesLibvirtClonedMediaClass))
#define BOXES_IS_LIBVIRT_CLONED_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_CLONED_MEDIA))
#define BOXES_IS_LIBVIRT_CLONED_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_CLONED_MEDIA))
#define BOXES_LIBVIRT_CLONED_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_CLONED_MEDIA, BoxesLibvirtClonedMediaClass))

typedef struct _BoxesLibvirtClonedMedia BoxesLibvirtClonedMedia;
typedef struct _BoxesLibvirtClonedMediaClass BoxesLibvirtClonedMediaClass;

#define BOXES_TYPE_VM_CONFIGURATOR_ERROR (boxes_vm_configurator_error_get_type ())
typedef struct _BoxesVmCreatorCreateDomainConfigData BoxesVmCreatorCreateDomainConfigData;
#define __vala_GVirStorageVolInfo_free0(var) ((var == NULL) ? NULL : (var = (_vala_GVirStorageVolInfo_free (var), NULL)))
typedef struct _BoxesVmCreatorCreateDomainNameAndTitleFromMediaData BoxesVmCreatorCreateDomainNameAndTitleFromMediaData;
typedef struct _BoxesVmCreatorCreateTargetVolumeData BoxesVmCreatorCreateTargetVolumeData;

struct _BoxesVMCreator {
	GObject parent_instance;
	BoxesVMCreatorPrivate * priv;
};

struct _BoxesVMCreatorClass {
	GObjectClass parent_class;
	void (*launch_vm) (BoxesVMCreator* self, BoxesLibvirtMachine* machine, gint64 access_last_time, gboolean clone, GError** error);
	void (*continue_installation) (BoxesVMCreator* self, BoxesLibvirtMachine* machine, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*continue_installation_finish) (BoxesVMCreator* self, GAsyncResult* _res_);
	void (*create_domain_config) (BoxesVMCreator* self, const gchar* name, const gchar* title, const gchar* volume_path, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GVirConfigDomain* (*create_domain_config_finish) (BoxesVMCreator* self, GAsyncResult* _res_, GError** error);
	void (*create_domain_base_name_and_title) (BoxesVMCreator* self, gchar** base_name, gchar** base_title);
};

struct _BoxesVMCreatorPrivate {
	BoxesInstallerMedia* _install_media;
	gulong state_changed_id;
	guint _num_reboots;
};

struct _Block52Data {
	int _ref_count_;
	BoxesVMCreator* self;
	gpointer _async_data_;
};

struct _Block53Data {
	int _ref_count_;
	Block52Data * _data52_;
	gulong handler;
};

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 _BoxesVmCreatorCreateVmData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesVMCreator* self;
	GCancellable* cancellable;
	gboolean clone;
	BoxesLibvirtMachine* result;
	Block52Data* _data52_;
	GVirConnection* _tmp0_;
	GVirConnection* _tmp1_;
	GVirConnection* _tmp2_;
	gboolean _tmp3_;
	Block53Data* _data53_;
	BoxesApp* _tmp4_;
	gulong _tmp5_;
	gchar* title;
	gchar* name;
	gchar* _tmp6_;
	gchar* _tmp7_;
	BoxesInstallerMedia* _tmp8_;
	const gchar* _tmp9_;
	gchar* volume_path;
	gboolean _tmp10_;
	BoxesInstallerMedia* _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_;
	BoxesInstallerMedia* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	GVirStorageVol* volume;
	const gchar* _tmp18_;
	BoxesInstallerMedia* _tmp19_;
	OsinfoResources* _tmp20_;
	gint64 _tmp21_;
	gint64 _tmp22_;
	GVirStorageVol* _tmp23_;
	const gchar* _tmp24_;
	GVirStorageVol* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	GVirConfigDomain* config;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	GVirConfigDomain* _tmp31_;
	GVirDomain* domain;
	GVirConnection* _tmp32_;
	GVirConnection* _tmp33_;
	GVirConnection* _tmp34_;
	GVirConfigDomain* _tmp35_;
	GVirDomain* _tmp36_;
	GVirDomain* _tmp37_;
	BoxesLibvirtMachine* machine;
	BoxesLibvirtBroker* _tmp38_;
	BoxesLibvirtBroker* _tmp39_;
	BoxesApp* _tmp40_;
	BoxesCollectionSource* _tmp41_;
	BoxesCollectionSource* _tmp42_;
	BoxesApp* _tmp43_;
	GVirConnection* _tmp44_;
	GVirConnection* _tmp45_;
	GVirConnection* _tmp46_;
	GVirDomain* _tmp47_;
	BoxesLibvirtMachine* _tmp48_;
	BoxesLibvirtMachine* _tmp49_;
	BoxesLibvirtMachine* _tmp50_;
	BoxesLibvirtMachine* _tmp51_;
	GError* _inner_error0_;
};

struct _BoxesUIIface {
	GTypeInterface parent_iface;
	BoxesUIState (*get_previous_ui_state) (BoxesUI* self);
	void (*set_previous_ui_state) (BoxesUI* self, BoxesUIState value);
	BoxesUIState (*get_ui_state) (BoxesUI* self);
	void (*set_ui_state) (BoxesUI* self, BoxesUIState value);
};

struct _BoxesCollectionItem {
	GObject parent_instance;
	BoxesCollectionItemPrivate * priv;
};

struct _BoxesCollectionItemClass {
	GObjectClass parent_class;
	gint (*compare) (BoxesCollectionItem* self, BoxesCollectionItem* other);
};

struct _BoxesMachine {
	BoxesCollectionItem parent_instance;
	BoxesMachinePrivate * priv;
	BoxesCollectionSource* source;
	BoxesBoxConfig* config;
	gboolean stay_on_display;
};

struct _BoxesMachineClass {
	BoxesCollectionItemClass parent_class;
	void (*save_real) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*save_real_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*take_screenshot) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GdkPixbuf* (*take_screenshot_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*connect_display) (BoxesMachine* self, BoxesMachineConnectFlags flags, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*connect_display_finish) (BoxesMachine* self, GAsyncResult* _res_, GError** error);
	void (*restart) (BoxesMachine* self);
	void (*clone) (BoxesMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*clone_finish) (BoxesMachine* self, GAsyncResult* _res_);
	void (*disconnect_display) (BoxesMachine* self);
	void (*update_status) (BoxesMachine* self);
	void (*delete) (BoxesMachine* self, gboolean by_user);
	gboolean (*get_suspend_at_exit) (BoxesMachine* self);
	gboolean (*get_can_save) (BoxesMachine* self);
	gboolean (*get_can_restart) (BoxesMachine* self);
	gboolean (*get_can_clone) (BoxesMachine* self);
	gboolean (*get_should_autosave) (BoxesMachine* self);
	gboolean (*get_is_local) (BoxesMachine* self);
};

struct _BoxesVmCreatorContinueInstallationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesVMCreator* self;
	BoxesLibvirtMachine* machine;
	BoxesMediaManager* _tmp0_;
	BoxesMediaManager* _tmp1_;
	GVirConfigDomain* _tmp2_;
	GVirConfigDomain* _tmp3_;
	BoxesInstallerMedia* _tmp4_;
	BoxesInstallerMedia* _tmp5_;
	GVirConfigDomain* _tmp6_;
	GVirConfigDomain* _tmp7_;
	gchar* name;
	GVirDomain* _tmp8_;
	GVirDomain* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	BoxesInstallerMedia* _tmp12_;
	BoxesInstallerMedia* _tmp13_;
	const gchar* _tmp14_;
	gulong _tmp15_;
	gboolean _tmp16_;
	BoxesMachineMachineState _tmp17_;
	BoxesMachineMachineState _tmp18_;
	GVirConfigDomain* _tmp19_;
	GVirConfigDomain* _tmp20_;
	GVirDomain* _tmp21_;
	GVirDomain* _tmp22_;
	GError* e;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	GError* _tmp25_;
	const gchar* _tmp26_;
	GError* _inner_error0_;
};

typedef enum  {
	BOXES_VM_CONFIGURATOR_ERROR_NO_GUEST_CAPS
} BoxesVMConfiguratorError;
#define BOXES_VM_CONFIGURATOR_ERROR boxes_vm_configurator_error_quark ()

struct _BoxesVmCreatorCreateDomainConfigData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesVMCreator* self;
	gchar* name;
	gchar* title;
	gchar* volume_path;
	GCancellable* cancellable;
	GVirConfigDomain* result;
	GVirConfigCapabilities* caps;
	GVirConnection* _tmp0_;
	GVirConnection* _tmp1_;
	GVirConnection* _tmp2_;
	GVirConfigCapabilities* _tmp3_;
	GVirConfigCapabilities* _tmp4_;
	GVirConfigDomainCapabilities* domcaps;
	GVirConnection* _tmp5_;
	GVirConnection* _tmp6_;
	GVirConnection* _tmp7_;
	GVirConfigDomainCapabilities* _tmp8_;
	GVirConfigDomainCapabilities* _tmp9_;
	GVirConfigDomain* config;
	BoxesInstallerMedia* _tmp10_;
	GVirConfigCapabilities* _tmp11_;
	GVirConfigDomainCapabilities* _tmp12_;
	GVirConfigDomain* _tmp13_;
	GVirConfigDomain* _tmp14_;
	GVirConfigDomain* _tmp15_;
	GError* _inner_error0_;
};

struct _BoxesVmCreatorCreateDomainNameAndTitleFromMediaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesVMCreator* self;
	gchar* name;
	gchar* title;
	gchar* base_name;
	gchar* base_title;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GVirStoragePool* pool;
	GVirConnection* _tmp4_;
	GVirConnection* _tmp5_;
	GVirConnection* _tmp6_;
	GVirStoragePool* _tmp7_;
	GVirStoragePool* _tmp8_;
	gint i;
	gboolean _tmp9_;
	gint _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	GVirConnection* _tmp13_;
	GVirConnection* _tmp14_;
	GVirConnection* _tmp15_;
	const gchar* _tmp16_;
	GVirDomain* _tmp17_;
	GVirDomain* _tmp18_;
	gboolean _tmp19_;
	GVirConnection* _tmp20_;
	GVirConnection* _tmp21_;
	GVirConnection* _tmp22_;
	const gchar* _tmp23_;
	GVirDomain* _tmp24_;
	GVirDomain* _tmp25_;
	const gchar* _tmp26_;
	GVirStorageVol* _tmp27_;
	GVirStorageVol* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	gchar* _tmp38_;
	GError* _inner_error0_;
};

struct _BoxesVmCreatorCreateTargetVolumeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesVMCreator* self;
	gchar* name;
	gint64 storage;
	GVirStorageVol* result;
	GVirStoragePool* pool;
	GVirConnection* _tmp0_;
	GVirConnection* _tmp1_;
	GVirConnection* _tmp2_;
	GVirStoragePool* _tmp3_;
	GVirStoragePool* _tmp4_;
	GVirConfigStorageVol* config;
	GVirConfigStorageVol* _tmp5_;
	GVirStorageVol* volume;
	GVirStoragePool* _tmp6_;
	GVirConfigStorageVol* _tmp7_;
	GVirStorageVol* _tmp8_;
	GError* _inner_error0_;
};

static gint BoxesVMCreator_private_offset;
static gpointer boxes_vm_creator_parent_class = NULL;
VALA_EXTERN BoxesApp* boxes_app_app;

VALA_EXTERN GType boxes_vm_creator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesVMCreator, g_object_unref)
VALA_EXTERN GType boxes_collection_item_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesCollectionItem, g_object_unref)
VALA_EXTERN GType boxes_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMachine, g_object_unref)
VALA_EXTERN GType boxes_libvirt_machine_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesLibvirtMachine, g_object_unref)
VALA_EXTERN GType boxes_installer_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesInstallerMedia, g_object_unref)
VALA_EXTERN void boxes_vm_creator_launch_vm (BoxesVMCreator* self,
                                 BoxesLibvirtMachine* machine,
                                 gint64 access_last_time,
                                 gboolean clone,
                                 GError** error);
VALA_EXTERN void boxes_vm_creator_continue_installation (BoxesVMCreator* self,
                                             BoxesLibvirtMachine* machine,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
VALA_EXTERN void boxes_vm_creator_continue_installation_finish (BoxesVMCreator* self,
                                                    GAsyncResult* _res_);
VALA_EXTERN void boxes_vm_creator_create_domain_config (BoxesVMCreator* self,
                                            const gchar* name,
                                            const gchar* title,
                                            const gchar* volume_path,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN GVirConfigDomain* boxes_vm_creator_create_domain_config_finish (BoxesVMCreator* self,
                                                                GAsyncResult* _res_,
                                                                GError** error);
VALA_EXTERN void boxes_vm_creator_create_domain_base_name_and_title (BoxesVMCreator* self,
                                                         gchar** base_name,
                                                         gchar** base_title);
VALA_EXTERN BoxesInstallerMedia* boxes_vm_creator_get_install_media (BoxesVMCreator* self);
VALA_EXTERN void boxes_installer_media_clean_up (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);
VALA_EXTERN void boxes_vm_creator_set_install_media (BoxesVMCreator* self,
                                         BoxesInstallerMedia* value);
VALA_EXTERN BoxesVMCreator* boxes_vm_creator_new_for_install_completion (BoxesLibvirtMachine* machine);
VALA_EXTERN BoxesVMCreator* boxes_vm_creator_construct_for_install_completion (GType object_type,
                                                                   BoxesLibvirtMachine* machine);
static void boxes_vm_creator_create_vm_data_free (gpointer _data);
VALA_EXTERN void boxes_vm_creator_create_vm (BoxesVMCreator* self,
                                 GCancellable* cancellable,
                                 gboolean clone,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
VALA_EXTERN BoxesLibvirtMachine* boxes_vm_creator_create_vm_finish (BoxesVMCreator* self,
                                                        GAsyncResult* _res_,
                                                        GError** error);
static gboolean boxes_vm_creator_create_vm_co (BoxesVmCreatorCreateVmData* _data_);
static Block52Data* block52_data_ref (Block52Data* _data52_);
static void block52_data_unref (void * _userdata_);
VALA_EXTERN GVirConnection* boxes_vm_creator_get_connection (BoxesVMCreator* self);
static Block53Data* block53_data_ref (Block53Data* _data53_);
static void block53_data_unref (void * _userdata_);
VALA_EXTERN GType boxes_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesApp, g_object_unref)
static void ___lambda49_ (Block53Data* _data53_);
static void ____lambda49__g_object_notify (GObject* _sender,
                                    GParamSpec* pspec,
                                    gpointer self);
static void boxes_vm_creator_create_domain_name_and_title_from_media (BoxesVMCreator* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static void boxes_vm_creator_create_domain_name_and_title_from_media_finish (BoxesVMCreator* self,
                                                                      GAsyncResult* _res_,
                                                                      gchar** name,
                                                                      gchar** title,
                                                                      GError** error);
static void boxes_vm_creator_create_vm_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_);
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 gboolean boxes_installer_media_get_skip_import (BoxesInstallerMedia* self);
static void boxes_vm_creator_create_target_volume (BoxesVMCreator* self,
                                            const gchar* name,
                                            gint64 storage,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static GVirStorageVol* boxes_vm_creator_create_target_volume_finish (BoxesVMCreator* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
VALA_EXTERN GType boxes_broker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesBroker, g_object_unref)
VALA_EXTERN GType boxes_libvirt_broker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesLibvirtBroker, g_object_unref)
VALA_EXTERN BoxesLibvirtBroker* boxes_libvirt_broker_get_default (void);
VALA_EXTERN void boxes_libvirt_broker_add_domain (BoxesLibvirtBroker* self,
                                      BoxesCollectionSource* source,
                                      GVirConnection* connection,
                                      GVirDomain* domain,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_);
VALA_EXTERN BoxesLibvirtMachine* boxes_libvirt_broker_add_domain_finish (BoxesLibvirtBroker* self,
                                                             GAsyncResult* _res_,
                                                             GError** error);
VALA_EXTERN BoxesCollectionSource* boxes_app_get_default_source (BoxesApp* self);
VALA_EXTERN GVirConnection* boxes_app_get_default_connection (BoxesApp* self);
VALA_EXTERN void boxes_libvirt_machine_set_vm_creator (BoxesLibvirtMachine* self,
                                           BoxesVMCreator* value);
VALA_EXTERN void boxes_libvirt_machine_set_run_in_bg (BoxesLibvirtMachine* self,
                                          gboolean value);
static void boxes_vm_creator_real_launch_vm (BoxesVMCreator* self,
                                      BoxesLibvirtMachine* machine,
                                      gint64 access_last_time,
                                      gboolean clone,
                                      GError** error);
static void boxes_vm_creator_on_machine_state_changed (BoxesVMCreator* self,
                                                GObject* object,
                                                GParamSpec* pspec);
static void _boxes_vm_creator_on_machine_state_changed_g_object_notify (GObject* _sender,
                                                                 GParamSpec* pspec,
                                                                 gpointer self);
VALA_EXTERN GType boxes_ui_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType boxes_ui_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUI, g_object_unref)
VALA_EXTERN GType boxes_machine_connect_flags_get_type (void) G_GNUC_CONST ;
static void boxes_vm_creator_real_continue_installation_data_free (gpointer _data);
static void boxes_vm_creator_real_continue_installation (BoxesVMCreator* self,
                                                  BoxesLibvirtMachine* machine,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static gboolean boxes_vm_creator_real_continue_installation_co (BoxesVmCreatorContinueInstallationData* _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);
VALA_EXTERN void boxes_media_manager_create_installer_media_from_config (BoxesMediaManager* self,
                                                             GVirConfigDomain* config,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
VALA_EXTERN BoxesInstallerMedia* boxes_media_manager_create_installer_media_from_config_finish (BoxesMediaManager* self,
                                                                                    GAsyncResult* _res_);
VALA_EXTERN GVirConfigDomain* boxes_libvirt_machine_get_domain_config (BoxesLibvirtMachine* self);
static void boxes_vm_creator_continue_installation_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN guint boxes_vm_configurator_get_num_reboots (GVirConfigDomain* domain);
static void boxes_vm_creator_set_num_reboots (BoxesVMCreator* self,
                                       guint value);
VALA_EXTERN GVirDomain* boxes_libvirt_machine_get_domain (BoxesLibvirtMachine* self);
VALA_EXTERN void boxes_vm_creator_set_post_install_config (BoxesVMCreator* self,
                                               BoxesLibvirtMachine* machine);
VALA_EXTERN void boxes_installer_media_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                             const gchar* vm_name);
VALA_EXTERN GType boxes_machine_machine_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BoxesMachineMachineState boxes_machine_get_state (BoxesMachine* self);
VALA_EXTERN gboolean boxes_vm_configurator_is_install_config (GVirConfigDomain* domain);
VALA_EXTERN const gchar* boxes_collection_item_get_name (BoxesCollectionItem* self);
VALA_EXTERN gboolean boxes_machine_get_is_on (BoxesMachine* self);
VALA_EXTERN gboolean boxes_machine_get_deleted (BoxesMachine* self);
static void boxes_vm_creator_increment_num_reboots (BoxesVMCreator* self,
                                             BoxesLibvirtMachine* machine);
static gboolean boxes_vm_creator_guest_installed_os (BoxesVMCreator* self,
                                              BoxesLibvirtMachine* machine);
VALA_EXTERN void boxes_app_notify_machine_installed (BoxesApp* self,
                                         BoxesMachine* machine);
VALA_EXTERN void boxes_machine_schedule_autosave (BoxesMachine* self);
VALA_EXTERN gboolean boxes_vm_configurator_is_live_config (GVirConfigDomain* domain);
VALA_EXTERN void boxes_vm_configurator_post_install_setup (GVirConfigDomain* domain,
                                               BoxesInstallerMedia* install_media);
VALA_EXTERN GType boxes_installed_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesInstalledMedia, g_object_unref)
VALA_EXTERN GType boxes_libvirt_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesLibvirtMedia, g_object_unref)
VALA_EXTERN GType boxes_libvirt_cloned_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesLibvirtClonedMedia, g_object_unref)
static void boxes_vm_creator_real_create_domain_config_data_free (gpointer _data);
static void boxes_vm_creator_real_create_domain_config (BoxesVMCreator* self,
                                                 const gchar* name,
                                                 const gchar* title,
                                                 const gchar* volume_path,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static gboolean boxes_vm_creator_real_create_domain_config_co (BoxesVmCreatorCreateDomainConfigData* _data_);
static void boxes_vm_creator_create_domain_config_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN GQuark boxes_vm_configurator_error_quark (void);
VALA_EXTERN GType boxes_vm_configurator_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GVirConfigDomain* boxes_vm_configurator_create_domain_config (BoxesInstallerMedia* install_media,
                                                              const gchar* target_path,
                                                              GVirConfigCapabilities* caps,
                                                              GVirConfigDomainCapabilities* domain_caps,
                                                              GError** error);
static void boxes_vm_creator_real_create_domain_base_name_and_title (BoxesVMCreator* self,
                                                              gchar** base_name,
                                                              gchar** base_title);
static guint boxes_vm_creator_get_num_reboots (BoxesVMCreator* self);
VALA_EXTERN void boxes_vm_configurator_set_num_reboots (GVirConfigDomain* domain,
                                            BoxesInstallerMedia* install_media,
                                            guint num_reboots);
VALA_EXTERN GVirStorageVol* boxes_libvirt_machine_get_storage_volume (BoxesLibvirtMachine* self);
static void _vala_GVirStorageVolInfo_free (GVirStorageVolInfo* self);
static void boxes_vm_creator_create_domain_name_and_title_from_media_data_free (gpointer _data);
static gboolean boxes_vm_creator_create_domain_name_and_title_from_media_co (BoxesVmCreatorCreateDomainNameAndTitleFromMediaData* _data_);
VALA_EXTERN void boxes_ensure_storage_pool (GVirConnection* connection,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN GVirStoragePool* boxes_ensure_storage_pool_finish (GAsyncResult* _res_,
                                                   GError** error);
static void boxes_vm_creator_create_domain_name_and_title_from_media_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void boxes_vm_creator_create_target_volume_data_free (gpointer _data);
static gboolean boxes_vm_creator_create_target_volume_co (BoxesVmCreatorCreateTargetVolumeData* _data_);
static void boxes_vm_creator_create_target_volume_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN GVirConfigStorageVol* boxes_vm_configurator_create_volume_config (const gchar* name,
                                                                  gint64 storage,
                                                                  GError** error);
static void boxes_vm_creator_finalize (GObject * obj);
static GType boxes_vm_creator_get_type_once (void);
static void _vala_boxes_vm_creator_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_boxes_vm_creator_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);

static inline gpointer
boxes_vm_creator_get_instance_private (BoxesVMCreator* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesVMCreator_private_offset);
}

BoxesVMCreator*
boxes_vm_creator_construct (GType object_type,
                            BoxesInstallerMedia* install_media)
{
	BoxesVMCreator * self = NULL;
	g_return_val_if_fail (install_media != NULL, NULL);
	self = (BoxesVMCreator*) g_object_new (object_type, NULL);
	boxes_vm_creator_set_install_media (self, install_media);
	return self;
}

BoxesVMCreator*
boxes_vm_creator_new (BoxesInstallerMedia* install_media)
{
	return boxes_vm_creator_construct (BOXES_TYPE_VM_CREATOR, install_media);
}

BoxesVMCreator*
boxes_vm_creator_construct_for_install_completion (GType object_type,
                                                   BoxesLibvirtMachine* machine)
{
	BoxesVMCreator * self = NULL;
	g_return_val_if_fail (machine != NULL, NULL);
	self = (BoxesVMCreator*) g_object_new (object_type, NULL);
	boxes_vm_creator_continue_installation (self, machine, NULL, NULL);
	return self;
}

BoxesVMCreator*
boxes_vm_creator_new_for_install_completion (BoxesLibvirtMachine* machine)
{
	return boxes_vm_creator_construct_for_install_completion (BOXES_TYPE_VM_CREATOR, machine);
}

static void
boxes_vm_creator_create_vm_data_free (gpointer _data)
{
	BoxesVmCreatorCreateVmData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesVmCreatorCreateVmData, _data_);
}

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

void
boxes_vm_creator_create_vm (BoxesVMCreator* self,
                            GCancellable* cancellable,
                            gboolean clone,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	BoxesVmCreatorCreateVmData* _data_;
	BoxesVMCreator* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesVmCreatorCreateVmData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_vm_creator_create_vm_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	_data_->clone = clone;
	boxes_vm_creator_create_vm_co (_data_);
}

BoxesLibvirtMachine*
boxes_vm_creator_create_vm_finish (BoxesVMCreator* self,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	BoxesLibvirtMachine* result;
	BoxesVmCreatorCreateVmData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block52Data*
block52_data_ref (Block52Data* _data52_)
{
	g_atomic_int_inc (&_data52_->_ref_count_);
	return _data52_;
}

static void
block52_data_unref (void * _userdata_)
{
	Block52Data* _data52_;
	_data52_ = (Block52Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data52_->_ref_count_)) {
		BoxesVMCreator* self;
		self = _data52_->self;
		_g_object_unref0 (self);
		g_slice_free (Block52Data, _data52_);
	}
}

static Block53Data*
block53_data_ref (Block53Data* _data53_)
{
	g_atomic_int_inc (&_data53_->_ref_count_);
	return _data53_;
}

static void
block53_data_unref (void * _userdata_)
{
	Block53Data* _data53_;
	_data53_ = (Block53Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data53_->_ref_count_)) {
		BoxesVMCreator* self;
		self = _data53_->_data52_->self;
		block52_data_unref (_data53_->_data52_);
		_data53_->_data52_ = NULL;
		g_slice_free (Block53Data, _data53_);
	}
}

static void
___lambda49_ (Block53Data* _data53_)
{
	Block52Data* _data52_;
	BoxesVMCreator* self;
	BoxesApp* _tmp0_;
	_data52_ = _data53_->_data52_;
	self = _data52_->self;
	boxes_vm_creator_create_vm_co (_data52_->_async_data_);
	_tmp0_ = boxes_app_app;
	g_signal_handler_disconnect ((GObject*) _tmp0_, _data53_->handler);
}

static void
____lambda49__g_object_notify (GObject* _sender,
                               GParamSpec* pspec,
                               gpointer self)
{
	___lambda49_ (self);
}

static void
boxes_vm_creator_create_vm_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_)
{
	BoxesVmCreatorCreateVmData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_vm_creator_create_vm_co (_data_);
}

static gboolean
boxes_vm_creator_create_vm_co (BoxesVmCreatorCreateVmData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		case 6:
		goto _state_6;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data52_ = g_slice_new0 (Block52Data);
	_data_->_data52_->_ref_count_ = 1;
	_data_->_data52_->self = g_object_ref (_data_->self);
	_data_->_data52_->_async_data_ = _data_;
	_data_->_tmp0_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->_tmp2_ == NULL;
	_g_object_unref0 (_data_->_tmp2_);
	if (_data_->_tmp3_) {
		_data_->_data53_ = g_slice_new0 (Block53Data);
		_data_->_data53_->_ref_count_ = 1;
		_data_->_data53_->_data52_ = block52_data_ref (_data_->_data52_);
		_data_->_data53_->handler = (gulong) 0;
		_data_->_tmp4_ = boxes_app_app;
		_data_->_tmp5_ = g_signal_connect_data ((GObject*) _data_->_tmp4_, "notify::default-connection", (GCallback) ____lambda49__g_object_notify, block53_data_ref (_data_->_data53_), (GClosureNotify) block53_data_unref, 0);
		_data_->_data53_->handler = _data_->_tmp5_;
		_data_->_state_ = 1;
		return FALSE;
		_state_1:
		;
		block53_data_unref (_data_->_data53_);
		_data_->_data53_ = NULL;
	}
	_data_->_tmp6_ = NULL;
	_data_->_tmp7_ = NULL;
	_data_->_state_ = 2;
	boxes_vm_creator_create_domain_name_and_title_from_media (_data_->self, boxes_vm_creator_create_vm_ready, _data_);
	return FALSE;
	_state_2:
	boxes_vm_creator_create_domain_name_and_title_from_media_finish (_data_->self, _data_->_res_, &_data_->_tmp6_, &_data_->_tmp7_, &_data_->_inner_error0_);
	_g_free0 (_data_->name);
	_data_->name = _data_->_tmp6_;
	_g_free0 (_data_->title);
	_data_->title = _data_->_tmp7_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->name);
		_g_free0 (_data_->title);
		block52_data_unref (_data_->_data52_);
		_data_->_data52_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = _data_->self->priv->_install_media;
	_data_->_tmp9_ = _data_->name;
	_data_->_state_ = 3;
	boxes_installer_media_prepare_for_installation (_data_->_tmp8_, _data_->_tmp9_, _data_->cancellable, boxes_vm_creator_create_vm_ready, _data_);
	return FALSE;
	_state_3:
	boxes_installer_media_prepare_for_installation_finish (_data_->_tmp8_, _data_->_res_);
	_data_->volume_path = NULL;
	_data_->_tmp11_ = _data_->self->priv->_install_media;
	_data_->_tmp12_ = boxes_installer_media_get_skip_import (_data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	if (_data_->_tmp13_) {
		_data_->_tmp10_ = !_data_->clone;
	} else {
		_data_->_tmp10_ = FALSE;
	}
	if (_data_->_tmp10_) {
		_data_->_tmp14_ = _data_->self->priv->_install_media;
		_data_->_tmp15_ = _data_->_tmp14_->device_file;
		_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
		_g_free0 (_data_->volume_path);
		_data_->volume_path = _data_->_tmp16_;
		_data_->_tmp17_ = _data_->volume_path;
		g_debug ("vm-creator.vala:51: Skiping import. Using '%s' as target volume", _data_->_tmp17_);
	} else {
		_data_->_tmp18_ = _data_->name;
		_data_->_tmp19_ = _data_->self->priv->_install_media;
		_data_->_tmp20_ = _data_->_tmp19_->resources;
		_data_->_tmp21_ = osinfo_resources_get_storage (_data_->_tmp20_);
		_data_->_tmp22_ = _data_->_tmp21_;
		_data_->_state_ = 4;
		boxes_vm_creator_create_target_volume (_data_->self, _data_->_tmp18_, _data_->_tmp22_, boxes_vm_creator_create_vm_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp23_ = boxes_vm_creator_create_target_volume_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
		_data_->volume = _data_->_tmp23_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_free0 (_data_->volume_path);
			_g_free0 (_data_->name);
			_g_free0 (_data_->title);
			block52_data_unref (_data_->_data52_);
			_data_->_data52_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp25_ = _data_->volume;
		_data_->_tmp26_ = gvir_storage_vol_get_path (_data_->_tmp25_, &_data_->_inner_error0_);
		_data_->_tmp24_ = _data_->_tmp26_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->volume);
			_g_free0 (_data_->volume_path);
			_g_free0 (_data_->name);
			_g_free0 (_data_->title);
			block52_data_unref (_data_->_data52_);
			_data_->_data52_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp27_ = g_strdup (_data_->_tmp24_);
		_g_free0 (_data_->volume_path);
		_data_->volume_path = _data_->_tmp27_;
		_g_object_unref0 (_data_->volume);
	}
	_data_->_tmp28_ = _data_->name;
	_data_->_tmp29_ = _data_->title;
	_data_->_tmp30_ = _data_->volume_path;
	_data_->_state_ = 5;
	boxes_vm_creator_create_domain_config (_data_->self, _data_->_tmp28_, _data_->_tmp29_, _data_->_tmp30_, _data_->cancellable, boxes_vm_creator_create_vm_ready, _data_);
	return FALSE;
	_state_5:
	_data_->_tmp31_ = boxes_vm_creator_create_domain_config_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->config = _data_->_tmp31_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->volume_path);
		_g_free0 (_data_->name);
		_g_free0 (_data_->title);
		block52_data_unref (_data_->_data52_);
		_data_->_data52_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp32_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp33_ = _data_->_tmp32_;
	_data_->_tmp34_ = _data_->_tmp33_;
	_data_->_tmp35_ = _data_->config;
	_data_->_tmp36_ = gvir_connection_create_domain (_data_->_tmp34_, _data_->_tmp35_, &_data_->_inner_error0_);
	_data_->_tmp37_ = _data_->_tmp36_;
	_g_object_unref0 (_data_->_tmp34_);
	_data_->domain = _data_->_tmp37_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->config);
		_g_free0 (_data_->volume_path);
		_g_free0 (_data_->name);
		_g_free0 (_data_->title);
		block52_data_unref (_data_->_data52_);
		_data_->_data52_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp38_ = boxes_libvirt_broker_get_default ();
	_data_->_tmp39_ = _data_->_tmp38_;
	_data_->_tmp40_ = boxes_app_app;
	_data_->_tmp41_ = boxes_app_get_default_source (_data_->_tmp40_);
	_data_->_tmp42_ = _data_->_tmp41_;
	_data_->_tmp43_ = boxes_app_app;
	_data_->_tmp44_ = boxes_app_get_default_connection (_data_->_tmp43_);
	_data_->_tmp45_ = _data_->_tmp44_;
	_data_->_tmp46_ = _data_->_tmp45_;
	_data_->_tmp47_ = _data_->domain;
	_data_->_state_ = 6;
	boxes_libvirt_broker_add_domain (_data_->_tmp39_, _data_->_tmp42_, _data_->_tmp46_, _data_->_tmp47_, boxes_vm_creator_create_vm_ready, _data_);
	return FALSE;
	_state_6:
	_data_->_tmp48_ = boxes_libvirt_broker_add_domain_finish (_data_->_tmp39_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp49_ = _data_->_tmp48_;
	_g_object_unref0 (_data_->_tmp46_);
	_g_object_unref0 (_data_->_tmp39_);
	_data_->machine = _data_->_tmp49_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->domain);
		_g_object_unref0 (_data_->config);
		_g_free0 (_data_->volume_path);
		_g_free0 (_data_->name);
		_g_free0 (_data_->title);
		block52_data_unref (_data_->_data52_);
		_data_->_data52_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp50_ = _data_->machine;
	boxes_libvirt_machine_set_vm_creator (_data_->_tmp50_, _data_->self);
	_data_->_tmp51_ = _data_->machine;
	boxes_libvirt_machine_set_run_in_bg (_data_->_tmp51_, TRUE);
	_data_->result = _data_->machine;
	_g_object_unref0 (_data_->domain);
	_g_object_unref0 (_data_->config);
	_g_free0 (_data_->volume_path);
	_g_free0 (_data_->name);
	_g_free0 (_data_->title);
	block52_data_unref (_data_->_data52_);
	_data_->_data52_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
_boxes_vm_creator_on_machine_state_changed_g_object_notify (GObject* _sender,
                                                            GParamSpec* pspec,
                                                            gpointer self)
{
	boxes_vm_creator_on_machine_state_changed ((BoxesVMCreator*) self, _sender, pspec);
}

static void
boxes_vm_creator_real_launch_vm (BoxesVMCreator* self,
                                 BoxesLibvirtMachine* machine,
                                 gint64 access_last_time,
                                 gboolean clone,
                                 GError** error)
{
	gulong _tmp0_;
	gint64 _tmp1_ = 0LL;
	BoxesBoxConfig* _tmp2_;
	g_return_if_fail (machine != NULL);
	_tmp0_ = g_signal_connect_object ((GObject*) machine, "notify::state", (GCallback) _boxes_vm_creator_on_machine_state_changed_g_object_notify, self, 0);
	self->priv->state_changed_id = _tmp0_;
	if (access_last_time > ((gint64) 0)) {
		_tmp1_ = access_last_time;
	} else {
		_tmp1_ = g_get_real_time ();
	}
	_tmp2_ = ((BoxesMachine*) machine)->config;
	boxes_box_config_set_access_last_time (_tmp2_, _tmp1_);
}

void
boxes_vm_creator_launch_vm (BoxesVMCreator* self,
                            BoxesLibvirtMachine* machine,
                            gint64 access_last_time,
                            gboolean clone,
                            GError** error)
{
	BoxesVMCreatorClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->launch_vm) {
		_klass_->launch_vm (self, machine, access_last_time, clone, error);
	}
}

static void
boxes_vm_creator_real_continue_installation_data_free (gpointer _data)
{
	BoxesVmCreatorContinueInstallationData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->machine);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesVmCreatorContinueInstallationData, _data_);
}

static void
boxes_vm_creator_real_continue_installation (BoxesVMCreator* self,
                                             BoxesLibvirtMachine* machine,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	BoxesVmCreatorContinueInstallationData* _data_;
	BoxesVMCreator* _tmp0_;
	BoxesLibvirtMachine* _tmp1_;
	g_return_if_fail (machine != NULL);
	_data_ = g_slice_new0 (BoxesVmCreatorContinueInstallationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_vm_creator_real_continue_installation_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (machine);
	_g_object_unref0 (_data_->machine);
	_data_->machine = _tmp1_;
	boxes_vm_creator_real_continue_installation_co (_data_);
}

static void
boxes_vm_creator_real_continue_installation_finish (BoxesVMCreator* self,
                                                    GAsyncResult* _res_)
{
	BoxesVmCreatorContinueInstallationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
boxes_vm_creator_continue_installation_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	BoxesVmCreatorContinueInstallationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_vm_creator_real_continue_installation_co (_data_);
}

static gboolean
boxes_vm_creator_real_continue_installation_co (BoxesVmCreatorContinueInstallationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = boxes_media_manager_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = boxes_libvirt_machine_get_domain_config (_data_->machine);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	boxes_media_manager_create_installer_media_from_config (_data_->_tmp1_, _data_->_tmp3_, boxes_vm_creator_continue_installation_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = boxes_media_manager_create_installer_media_from_config_finish (_data_->_tmp1_, _data_->_res_);
	_data_->_tmp5_ = _data_->_tmp4_;
	boxes_vm_creator_set_install_media (_data_->self, _data_->_tmp5_);
	_g_object_unref0 (_data_->_tmp5_);
	_g_object_unref0 (_data_->_tmp1_);
	_data_->_tmp6_ = boxes_libvirt_machine_get_domain_config (_data_->machine);
	_data_->_tmp7_ = _data_->_tmp6_;
	boxes_vm_creator_set_num_reboots (_data_->self, boxes_vm_configurator_get_num_reboots (_data_->_tmp7_));
	_data_->_tmp8_ = boxes_libvirt_machine_get_domain (_data_->machine);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = gvir_domain_get_name (_data_->_tmp9_);
	_data_->_tmp11_ = g_strdup (_data_->_tmp10_);
	_data_->name = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->self->priv->_install_media;
	if (_data_->_tmp12_ == NULL) {
		g_debug ("vm-creator.vala:81: Could not find needed install media to continue in" \
"stallation, give up on automatic installation");
		boxes_vm_creator_set_post_install_config (_data_->self, _data_->machine);
		_g_free0 (_data_->name);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = _data_->self->priv->_install_media;
	_data_->_tmp14_ = _data_->name;
	boxes_installer_media_prepare_to_continue_installation (_data_->_tmp13_, _data_->_tmp14_);
	_data_->_tmp15_ = g_signal_connect_object ((GObject*) _data_->machine, "notify::state", (GCallback) _boxes_vm_creator_on_machine_state_changed_g_object_notify, _data_->self, 0);
	_data_->self->priv->state_changed_id = _data_->_tmp15_;
	boxes_libvirt_machine_set_vm_creator (_data_->machine, _data_->self);
	boxes_vm_creator_on_machine_state_changed (_data_->self, (GObject*) _data_->machine, NULL);
	_data_->_tmp17_ = boxes_machine_get_state ((BoxesMachine*) _data_->machine);
	_data_->_tmp18_ = _data_->_tmp17_;
	if (_data_->_tmp18_ == BOXES_MACHINE_MACHINE_STATE_SAVED) {
		_data_->_tmp19_ = boxes_libvirt_machine_get_domain_config (_data_->machine);
		_data_->_tmp20_ = _data_->_tmp19_;
		_data_->_tmp16_ = boxes_vm_configurator_is_install_config (_data_->_tmp20_);
	} else {
		_data_->_tmp16_ = FALSE;
	}
	if (_data_->_tmp16_) {
		{
			_data_->_tmp21_ = boxes_libvirt_machine_get_domain (_data_->machine);
			_data_->_tmp22_ = _data_->_tmp21_;
			_data_->_state_ = 2;
			gvir_domain_start_async (_data_->_tmp22_, (guint) 0, NULL, boxes_vm_creator_continue_installation_ready, _data_);
			return FALSE;
			_state_2:
			gvir_domain_start_finish (_data_->_tmp22_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			_data_->e = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp23_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _data_->machine);
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_tmp25_ = _data_->e;
			_data_->_tmp26_ = _data_->_tmp25_->message;
			g_warning ("vm-creator.vala:97: Failed to start '%s': %s", _data_->_tmp24_, _data_->_tmp26_);
			_g_error_free0 (_data_->e);
		}
		__finally0:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->name);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_g_free0 (_data_->name);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
boxes_vm_creator_continue_installation (BoxesVMCreator* self,
                                        BoxesLibvirtMachine* machine,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	BoxesVMCreatorClass* _klass_;
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->continue_installation) {
		_klass_->continue_installation (self, machine, _callback_, _user_data_);
	}
}

void
boxes_vm_creator_continue_installation_finish (BoxesVMCreator* self,
                                               GAsyncResult* _res_)
{
	BoxesVMCreatorClass* _klass_;
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->continue_installation_finish) {
		_klass_->continue_installation_finish (self, _res_);
	}
}

static void
boxes_vm_creator_on_machine_state_changed (BoxesVMCreator* self,
                                           GObject* object,
                                           GParamSpec* pspec)
{
	BoxesLibvirtMachine* machine = NULL;
	BoxesLibvirtMachine* _tmp0_;
	BoxesLibvirtMachine* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	BoxesLibvirtMachine* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	BoxesLibvirtMachine* _tmp11_;
	BoxesMachineMachineState _tmp12_;
	BoxesMachineMachineState _tmp13_;
	BoxesLibvirtMachine* _tmp17_;
	BoxesMachineMachineState _tmp18_;
	BoxesMachineMachineState _tmp19_;
	BoxesLibvirtMachine* _tmp23_;
	GVirDomain* domain = NULL;
	BoxesLibvirtMachine* _tmp24_;
	GVirDomain* _tmp25_;
	GVirDomain* _tmp26_;
	GVirDomain* _tmp27_;
	BoxesLibvirtMachine* _tmp28_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	_tmp0_ = _g_object_ref0 (BOXES_IS_LIBVIRT_MACHINE (object) ? ((BoxesLibvirtMachine*) object) : NULL);
	machine = _tmp0_;
	_tmp1_ = machine;
	_tmp2_ = boxes_machine_get_is_on ((BoxesMachine*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_g_object_unref0 (machine);
		return;
	}
	_tmp4_ = machine;
	_tmp5_ = boxes_machine_get_deleted ((BoxesMachine*) _tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		BoxesLibvirtMachine* _tmp7_;
		BoxesLibvirtMachine* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		_tmp7_ = machine;
		g_signal_handler_disconnect ((GObject*) _tmp7_, self->priv->state_changed_id);
		_tmp8_ = machine;
		_tmp9_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _tmp8_);
		_tmp10_ = _tmp9_;
		g_debug ("vm-creator.vala:109: '%s' was deleted, no need for post-installation s" \
"etup on it", _tmp10_);
		_g_object_unref0 (machine);
		return;
	}
	_tmp11_ = machine;
	_tmp12_ = boxes_machine_get_state ((BoxesMachine*) _tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_ == BOXES_MACHINE_MACHINE_STATE_SAVED) {
		BoxesLibvirtMachine* _tmp14_;
		const gchar* _tmp15_;
		const gchar* _tmp16_;
		_tmp14_ = machine;
		_tmp15_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _tmp14_);
		_tmp16_ = _tmp15_;
		g_debug ("vm-creator.vala:116: '%s' has saved state, no need for post-installati" \
"on setup on it", _tmp16_);
		_g_object_unref0 (machine);
		return;
	}
	_tmp17_ = machine;
	_tmp18_ = boxes_machine_get_state ((BoxesMachine*) _tmp17_);
	_tmp19_ = _tmp18_;
	if (_tmp19_ == BOXES_MACHINE_MACHINE_STATE_FORCE_STOPPED) {
		BoxesLibvirtMachine* _tmp20_;
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		_tmp20_ = machine;
		_tmp21_ = boxes_collection_item_get_name ((BoxesCollectionItem*) _tmp20_);
		_tmp22_ = _tmp21_;
		g_debug ("vm-creator.vala:122: '%s' has forced stopped, no need for post-install" \
"ation setup on it", _tmp22_);
		_g_object_unref0 (machine);
		return;
	}
	_tmp23_ = machine;
	boxes_vm_creator_increment_num_reboots (self, _tmp23_);
	_tmp24_ = machine;
	_tmp25_ = boxes_libvirt_machine_get_domain (_tmp24_);
	_tmp26_ = _tmp25_;
	_tmp27_ = _g_object_ref0 (_tmp26_);
	domain = _tmp27_;
	_tmp28_ = machine;
	if (boxes_vm_creator_guest_installed_os (self, _tmp28_)) {
		BoxesLibvirtMachine* _tmp29_;
		BoxesInstallerMedia* _tmp30_;
		BoxesLibvirtMachine* _tmp36_;
		BoxesApp* _tmp37_;
		BoxesLibvirtMachine* _tmp38_;
		BoxesLibvirtMachine* _tmp39_;
		BoxesLibvirtMachine* _tmp40_;
		_tmp29_ = machine;
		boxes_vm_creator_set_post_install_config (self, _tmp29_);
		_tmp30_ = self->priv->_install_media;
		boxes_installer_media_clean_up (_tmp30_);
		{
			GVirDomain* _tmp31_;
			_tmp31_ = domain;
			gvir_domain_start (_tmp31_, (guint) 0, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* _error_ = NULL;
			GVirDomain* _tmp32_;
			const gchar* _tmp33_;
			GError* _tmp34_;
			const gchar* _tmp35_;
			_error_ = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp32_ = domain;
			_tmp33_ = gvir_domain_get_name (_tmp32_);
			_tmp34_ = _error_;
			_tmp35_ = _tmp34_->message;
			g_warning ("vm-creator.vala:135: Failed to start domain '%s': %s", _tmp33_, _tmp35_);
			_g_error_free0 (_error_);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (domain);
			_g_object_unref0 (machine);
			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;
		}
		_tmp36_ = machine;
		g_signal_handler_disconnect ((GObject*) _tmp36_, self->priv->state_changed_id);
		_tmp37_ = boxes_app_app;
		_tmp38_ = machine;
		boxes_app_notify_machine_installed (_tmp37_, (BoxesMachine*) _tmp38_);
		_tmp39_ = machine;
		boxes_libvirt_machine_set_vm_creator (_tmp39_, NULL);
		_tmp40_ = machine;
		boxes_machine_schedule_autosave ((BoxesMachine*) _tmp40_);
	} else {
		BoxesLibvirtMachine* _tmp41_;
		GVirConfigDomain* _tmp42_;
		GVirConfigDomain* _tmp43_;
		_tmp41_ = machine;
		_tmp42_ = boxes_libvirt_machine_get_domain_config (_tmp41_);
		_tmp43_ = _tmp42_;
		if (!boxes_vm_configurator_is_live_config (_tmp43_)) {
			{
				GVirDomain* _tmp44_;
				_tmp44_ = domain;
				gvir_domain_start (_tmp44_, (guint) 0, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch1_g_error;
				}
			}
			goto __finally1;
			__catch1_g_error:
			{
				GError* _error_ = NULL;
				GVirDomain* _tmp45_;
				const gchar* _tmp46_;
				GError* _tmp47_;
				const gchar* _tmp48_;
				_error_ = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp45_ = domain;
				_tmp46_ = gvir_domain_get_name (_tmp45_);
				_tmp47_ = _error_;
				_tmp48_ = _tmp47_->message;
				g_warning ("vm-creator.vala:145: Failed to start domain '%s': %s", _tmp46_, _tmp48_);
				_g_error_free0 (_error_);
			}
			__finally1:
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (domain);
				_g_object_unref0 (machine);
				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;
			}
		}
	}
	_g_object_unref0 (domain);
	_g_object_unref0 (machine);
}

void
boxes_vm_creator_set_post_install_config (BoxesVMCreator* self,
                                          BoxesLibvirtMachine* machine)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_tmp0_ = boxes_collection_item_get_name ((BoxesCollectionItem*) machine);
	_tmp1_ = _tmp0_;
	g_debug ("vm-creator.vala:151: Setting post-installation configuration on '%s'", _tmp1_);
	{
		GVirConfigDomain* config = NULL;
		GVirDomain* _tmp2_;
		GVirDomain* _tmp3_;
		GVirConfigDomain* _tmp4_;
		GVirConfigDomain* _tmp5_;
		BoxesInstallerMedia* _tmp6_;
		GVirDomain* _tmp7_;
		GVirDomain* _tmp8_;
		GVirConfigDomain* _tmp9_;
		BoxesInstallerMedia* _tmp10_;
		_tmp2_ = boxes_libvirt_machine_get_domain (machine);
		_tmp3_ = _tmp2_;
		_tmp4_ = gvir_domain_get_config (_tmp3_, (guint) GVIR_DOMAIN_XML_INACTIVE, &_inner_error0_);
		config = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp5_ = config;
		_tmp6_ = self->priv->_install_media;
		boxes_vm_configurator_post_install_setup (_tmp5_, _tmp6_);
		_tmp7_ = boxes_libvirt_machine_get_domain (machine);
		_tmp8_ = _tmp7_;
		_tmp9_ = config;
		gvir_domain_set_config (_tmp8_, _tmp9_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (config);
			goto __catch0_g_error;
		}
		_tmp10_ = self->priv->_install_media;
		if (!BOXES_IS_LIBVIRT_CLONED_MEDIA (_tmp10_)) {
			boxes_libvirt_machine_set_run_in_bg (machine, FALSE);
		}
		_g_object_unref0 (config);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		GError* _tmp13_;
		const gchar* _tmp14_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp11_ = boxes_collection_item_get_name ((BoxesCollectionItem*) machine);
		_tmp12_ = _tmp11_;
		_tmp13_ = _error_;
		_tmp14_ = _tmp13_->message;
		g_warning ("vm-creator.vala:159: Failed to set post-install configuration on '%s':" \
" %s", _tmp12_, _tmp14_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
boxes_vm_creator_real_create_domain_config_data_free (gpointer _data)
{
	BoxesVmCreatorCreateDomainConfigData* _data_;
	_data_ = _data;
	_g_free0 (_data_->name);
	_g_free0 (_data_->title);
	_g_free0 (_data_->volume_path);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesVmCreatorCreateDomainConfigData, _data_);
}

static void
boxes_vm_creator_real_create_domain_config (BoxesVMCreator* self,
                                            const gchar* name,
                                            const gchar* title,
                                            const gchar* volume_path,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	BoxesVmCreatorCreateDomainConfigData* _data_;
	BoxesVMCreator* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GCancellable* _tmp4_;
	g_return_if_fail (name != NULL);
	g_return_if_fail (title != NULL);
	g_return_if_fail (volume_path != NULL);
	_data_ = g_slice_new0 (BoxesVmCreatorCreateDomainConfigData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_vm_creator_real_create_domain_config_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (_data_->name);
	_data_->name = _tmp1_;
	_tmp2_ = g_strdup (title);
	_g_free0 (_data_->title);
	_data_->title = _tmp2_;
	_tmp3_ = g_strdup (volume_path);
	_g_free0 (_data_->volume_path);
	_data_->volume_path = _tmp3_;
	_tmp4_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	boxes_vm_creator_real_create_domain_config_co (_data_);
}

static GVirConfigDomain*
boxes_vm_creator_real_create_domain_config_finish (BoxesVMCreator* self,
                                                   GAsyncResult* _res_,
                                                   GError** error)
{
	GVirConfigDomain* result;
	BoxesVmCreatorCreateDomainConfigData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
boxes_vm_creator_create_domain_config_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	BoxesVmCreatorCreateDomainConfigData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_vm_creator_real_create_domain_config_co (_data_);
}

static gboolean
boxes_vm_creator_real_create_domain_config_co (BoxesVmCreatorCreateDomainConfigData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_state_ = 1;
	gvir_connection_get_capabilities_async (_data_->_tmp2_, _data_->cancellable, boxes_vm_creator_create_domain_config_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = gvir_connection_get_capabilities_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->caps = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_state_ = 2;
	gvir_connection_get_domain_capabilities_async (_data_->_tmp7_, NULL, NULL, NULL, NULL, (guint) 0, _data_->cancellable, boxes_vm_creator_create_domain_config_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp8_ = gvir_connection_get_domain_capabilities_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	_data_->domcaps = _data_->_tmp9_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->caps);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp10_ = _data_->self->priv->_install_media;
	_data_->_tmp11_ = _data_->caps;
	_data_->_tmp12_ = _data_->domcaps;
	_data_->_tmp13_ = boxes_vm_configurator_create_domain_config (_data_->_tmp10_, _data_->volume_path, _data_->_tmp11_, _data_->_tmp12_, &_data_->_inner_error0_);
	_data_->config = _data_->_tmp13_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->domcaps);
		_g_object_unref0 (_data_->caps);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp14_ = _data_->config;
	gvir_config_domain_set_name (_data_->_tmp14_, _data_->name);
	_data_->_tmp15_ = _data_->config;
	gvir_config_domain_set_title (_data_->_tmp15_, _data_->title);
	_data_->result = _data_->config;
	_g_object_unref0 (_data_->domcaps);
	_g_object_unref0 (_data_->caps);
	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_vm_creator_create_domain_config (BoxesVMCreator* self,
                                       const gchar* name,
                                       const gchar* title,
                                       const gchar* volume_path,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	BoxesVMCreatorClass* _klass_;
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->create_domain_config) {
		_klass_->create_domain_config (self, name, title, volume_path, cancellable, _callback_, _user_data_);
	}
}

GVirConfigDomain*
boxes_vm_creator_create_domain_config_finish (BoxesVMCreator* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	BoxesVMCreatorClass* _klass_;
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->create_domain_config_finish) {
		return _klass_->create_domain_config_finish (self, _res_, error);
	}
	return NULL;
}

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

static void
boxes_vm_creator_real_create_domain_base_name_and_title (BoxesVMCreator* self,
                                                         gchar** base_name,
                                                         gchar** base_title)
{
	gchar* _vala_base_name = NULL;
	gchar* _vala_base_title = NULL;
	BoxesInstallerMedia* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	BoxesInstallerMedia* _tmp3_;
	OsinfoOs* _tmp4_;
	_tmp0_ = self->priv->_install_media;
	_tmp1_ = _tmp0_->label;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (_vala_base_title);
	_vala_base_title = _tmp2_;
	_tmp3_ = self->priv->_install_media;
	_tmp4_ = _tmp3_->os;
	if (_tmp4_ != NULL) {
		BoxesInstallerMedia* _tmp5_;
		OsinfoOs* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		BoxesInstallerMedia* _tmp10_;
		OsinfoMedia* _tmp11_;
		const gchar* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		_tmp5_ = self->priv->_install_media;
		_tmp6_ = _tmp5_->os;
		_tmp7_ = osinfo_product_get_short_id ((OsinfoProduct*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strdup (_tmp8_);
		_g_free0 (_vala_base_name);
		_vala_base_name = _tmp9_;
		_tmp10_ = self->priv->_install_media;
		_tmp11_ = _tmp10_->os_media;
		if (_tmp11_ != NULL) {
			OsinfoOsVariantList* variants = NULL;
			BoxesInstallerMedia* _tmp12_;
			OsinfoMedia* _tmp13_;
			OsinfoOsVariantList* _tmp14_;
			OsinfoOsVariantList* _tmp15_;
			_tmp12_ = self->priv->_install_media;
			_tmp13_ = _tmp12_->os_media;
			_tmp14_ = osinfo_media_get_os_variants (_tmp13_);
			variants = _tmp14_;
			_tmp15_ = variants;
			if (osinfo_list_get_length ((OsinfoList*) _tmp15_) > 0) {
				const gchar* _tmp16_;
				OsinfoOsVariantList* _tmp17_;
				OsinfoEntity* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				gchar* _tmp22_;
				gchar* _tmp23_;
				gchar* _tmp24_;
				_tmp16_ = _vala_base_name;
				_tmp17_ = variants;
				_tmp18_ = osinfo_list_get_nth ((OsinfoList*) _tmp17_, 0);
				g_object_get (_tmp18_, "id", &_tmp19_, NULL);
				_tmp20_ = _tmp19_;
				_tmp21_ = _tmp20_;
				_tmp22_ = g_strconcat ("-", _tmp21_, NULL);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strconcat (_tmp16_, _tmp23_, NULL);
				_g_free0 (_vala_base_name);
				_vala_base_name = _tmp24_;
				_g_free0 (_tmp23_);
				_g_free0 (_tmp21_);
			}
			_g_object_unref0 (variants);
		}
		_tmp25_ = _vala_base_name;
		_tmp26_ = strlen (_tmp25_);
		_tmp27_ = _tmp26_;
		if (_tmp27_ > 12) {
			const gchar* _tmp28_;
			gchar* _tmp29_;
			_tmp28_ = _vala_base_name;
			_tmp29_ = string_slice (_tmp28_, (glong) 0, (glong) 12);
			_g_free0 (_vala_base_name);
			_vala_base_name = _tmp29_;
		}
	} else {
		gchar* _tmp30_;
		_tmp30_ = g_strdup ("boxes-unknown");
		_g_free0 (_vala_base_name);
		_vala_base_name = _tmp30_;
	}
	if (base_name) {
		*base_name = _vala_base_name;
	} else {
		_g_free0 (_vala_base_name);
	}
	if (base_title) {
		*base_title = _vala_base_title;
	} else {
		_g_free0 (_vala_base_title);
	}
}

void
boxes_vm_creator_create_domain_base_name_and_title (BoxesVMCreator* self,
                                                    gchar** base_name,
                                                    gchar** base_title)
{
	BoxesVMCreatorClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = BOXES_VM_CREATOR_GET_CLASS (self);
	if (_klass_->create_domain_base_name_and_title) {
		_klass_->create_domain_base_name_and_title (self, base_name, base_title);
	}
}

static void
boxes_vm_creator_increment_num_reboots (BoxesVMCreator* self,
                                        BoxesLibvirtMachine* machine)
{
	guint _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (machine != NULL);
	_tmp0_ = self->priv->_num_reboots;
	boxes_vm_creator_set_num_reboots (self, _tmp0_ + 1);
	{
		GVirConfigDomain* config = NULL;
		GVirDomain* _tmp1_;
		GVirDomain* _tmp2_;
		GVirConfigDomain* _tmp3_;
		GVirConfigDomain* _tmp4_;
		BoxesInstallerMedia* _tmp5_;
		guint _tmp6_;
		GVirDomain* _tmp7_;
		GVirDomain* _tmp8_;
		GVirConfigDomain* _tmp9_;
		_tmp1_ = boxes_libvirt_machine_get_domain (machine);
		_tmp2_ = _tmp1_;
		_tmp3_ = gvir_domain_get_config (_tmp2_, (guint) GVIR_DOMAIN_XML_INACTIVE, &_inner_error0_);
		config = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = config;
		_tmp5_ = self->priv->_install_media;
		_tmp6_ = self->priv->_num_reboots;
		boxes_vm_configurator_set_num_reboots (_tmp4_, _tmp5_, _tmp6_);
		_tmp7_ = boxes_libvirt_machine_get_domain (machine);
		_tmp8_ = _tmp7_;
		_tmp9_ = config;
		gvir_domain_set_config (_tmp8_, _tmp9_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (config);
			goto __catch0_g_error;
		}
		_g_object_unref0 (config);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		GError* _tmp12_;
		const gchar* _tmp13_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp10_ = boxes_collection_item_get_name ((BoxesCollectionItem*) machine);
		_tmp11_ = _tmp10_;
		_tmp12_ = _error_;
		_tmp13_ = _tmp12_->message;
		g_warning ("vm-creator.vala:205: Failed to update configuration on '%s': %s", _tmp11_, _tmp13_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_vala_GVirStorageVolInfo_free (GVirStorageVolInfo* self)
{
	g_boxed_free (gvir_storage_vol_info_get_type (), self);
}

static gboolean
boxes_vm_creator_guest_installed_os (BoxesVMCreator* self,
                                     BoxesLibvirtMachine* machine)
{
	GVirStorageVol* volume = NULL;
	GVirStorageVol* _tmp0_;
	GVirStorageVol* _tmp1_;
	GVirStorageVol* _tmp2_;
	gboolean _tmp21_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (machine != NULL, FALSE);
	_tmp0_ = boxes_libvirt_machine_get_storage_volume (machine);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	volume = _tmp2_;
	{
		gboolean _tmp3_ = FALSE;
		BoxesInstallerMedia* _tmp4_;
		OsinfoMedia* _tmp5_;
		_tmp4_ = self->priv->_install_media;
		_tmp5_ = _tmp4_->os_media;
		if (_tmp5_ != NULL) {
			GVirConfigDomain* _tmp6_;
			GVirConfigDomain* _tmp7_;
			_tmp6_ = boxes_libvirt_machine_get_domain_config (machine);
			_tmp7_ = _tmp6_;
			_tmp3_ = boxes_vm_configurator_is_install_config (_tmp7_);
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			guint _tmp8_;
			BoxesInstallerMedia* _tmp9_;
			OsinfoMedia* _tmp10_;
			gint _tmp11_;
			gint _tmp12_;
			_tmp8_ = self->priv->_num_reboots;
			_tmp9_ = self->priv->_install_media;
			_tmp10_ = _tmp9_->os_media;
			g_object_get (_tmp10_, "installer-reboots", &_tmp11_, NULL);
			_tmp12_ = _tmp11_;
			result = _tmp8_ == ((guint) _tmp12_);
			_g_object_unref0 (volume);
			return result;
		} else {
			GVirStorageVol* _tmp13_;
			_tmp13_ = volume;
			if (_tmp13_ != NULL) {
				GVirStorageVolInfo* info = NULL;
				GVirStorageVol* _tmp14_;
				GVirStorageVolInfo* _tmp15_;
				GVirStorageVolInfo* _tmp16_;
				_tmp14_ = volume;
				_tmp15_ = gvir_storage_vol_get_info (_tmp14_, &_inner_error0_);
				info = _tmp15_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
				_tmp16_ = info;
				result = _tmp16_->allocation >= ((guint64) OSINFO_MEBIBYTES);
				__vala_GVirStorageVolInfo_free0 (info);
				_g_object_unref0 (volume);
				return result;
			}
		}
		result = FALSE;
		_g_object_unref0 (volume);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GVirStorageVol* _tmp17_;
		const gchar* _tmp18_;
		GError* _tmp19_;
		const gchar* _tmp20_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp17_ = volume;
		_tmp18_ = gvir_storage_vol_get_name (_tmp17_);
		_tmp19_ = _error_;
		_tmp20_ = _tmp19_->message;
		g_warning ("vm-creator.vala:224: Failed to get information from volume '%s': %s", _tmp18_, _tmp20_);
		result = FALSE;
		_g_error_free0 (_error_);
		_g_object_unref0 (volume);
		return result;
	}
	__finally0:
	_g_object_unref0 (volume);
	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 _tmp21_;
}

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

static void
boxes_vm_creator_create_domain_name_and_title_from_media (BoxesVMCreator* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	BoxesVmCreatorCreateDomainNameAndTitleFromMediaData* _data_;
	BoxesVMCreator* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesVmCreatorCreateDomainNameAndTitleFromMediaData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_vm_creator_create_domain_name_and_title_from_media_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	boxes_vm_creator_create_domain_name_and_title_from_media_co (_data_);
}

static void
boxes_vm_creator_create_domain_name_and_title_from_media_finish (BoxesVMCreator* self,
                                                                 GAsyncResult* _res_,
                                                                 gchar** name,
                                                                 gchar** title,
                                                                 GError** error)
{
	BoxesVmCreatorCreateDomainNameAndTitleFromMediaData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
	if (name) {
		*name = _data_->name;
	} else {
		_g_free0 (_data_->name);
	}
	_data_->name = NULL;
	if (title) {
		*title = _data_->title;
	} else {
		_g_free0 (_data_->title);
	}
	_data_->title = NULL;
}

static void
boxes_vm_creator_create_domain_name_and_title_from_media_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	BoxesVmCreatorCreateDomainNameAndTitleFromMediaData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_vm_creator_create_domain_name_and_title_from_media_co (_data_);
}

static gboolean
boxes_vm_creator_create_domain_name_and_title_from_media_co (BoxesVmCreatorCreateDomainNameAndTitleFromMediaData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp1_ = NULL;
	boxes_vm_creator_create_domain_base_name_and_title (_data_->self, &_data_->_tmp0_, &_data_->_tmp1_);
	_g_free0 (_data_->base_name);
	_data_->base_name = _data_->_tmp0_;
	_g_free0 (_data_->base_title);
	_data_->base_title = _data_->_tmp1_;
	_data_->_tmp2_ = g_strdup (_data_->base_name);
	_g_free0 (_data_->name);
	_data_->name = _data_->_tmp2_;
	_data_->_tmp3_ = g_strdup (_data_->base_title);
	_g_free0 (_data_->title);
	_data_->title = _data_->_tmp3_;
	_data_->_tmp4_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_state_ = 1;
	boxes_ensure_storage_pool (_data_->_tmp6_, boxes_vm_creator_create_domain_name_and_title_from_media_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = boxes_ensure_storage_pool_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_g_object_unref0 (_data_->_tmp6_);
	_data_->pool = _data_->_tmp8_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->base_title);
		_g_free0 (_data_->base_name);
		_g_free0 (_data_->name);
		_g_free0 (_data_->title);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->i = 2;
		{
			_data_->_tmp9_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp9_) {
					_data_->_tmp10_ = _data_->i;
					_data_->i = _data_->_tmp10_ + 1;
				}
				_data_->_tmp9_ = FALSE;
				_data_->_tmp13_ = boxes_vm_creator_get_connection (_data_->self);
				_data_->_tmp14_ = _data_->_tmp13_;
				_data_->_tmp15_ = _data_->_tmp14_;
				_data_->_tmp16_ = _data_->name;
				_data_->_tmp17_ = gvir_connection_find_domain_by_name (_data_->_tmp15_, _data_->_tmp16_);
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_tmp19_ = _data_->_tmp18_ != NULL;
				_g_object_unref0 (_data_->_tmp18_);
				_g_object_unref0 (_data_->_tmp15_);
				if (_data_->_tmp19_) {
					_data_->_tmp12_ = TRUE;
				} else {
					_data_->_tmp20_ = boxes_vm_creator_get_connection (_data_->self);
					_data_->_tmp21_ = _data_->_tmp20_;
					_data_->_tmp22_ = _data_->_tmp21_;
					_data_->_tmp23_ = _data_->title;
					_data_->_tmp24_ = gvir_connection_find_domain_by_name (_data_->_tmp22_, _data_->_tmp23_);
					_data_->_tmp25_ = _data_->_tmp24_;
					_data_->_tmp12_ = _data_->_tmp25_ != NULL;
					_g_object_unref0 (_data_->_tmp25_);
					_g_object_unref0 (_data_->_tmp22_);
				}
				if (_data_->_tmp12_) {
					_data_->_tmp11_ = TRUE;
				} else {
					_data_->_tmp26_ = _data_->name;
					_data_->_tmp27_ = gvir_storage_pool_get_volume (_data_->pool, _data_->_tmp26_);
					_data_->_tmp28_ = _data_->_tmp27_;
					_data_->_tmp11_ = _data_->_tmp28_ != NULL;
					_g_object_unref0 (_data_->_tmp28_);
				}
				if (!_data_->_tmp11_) {
					break;
				}
				_data_->_tmp29_ = g_strconcat (_data_->base_name, "-", NULL);
				_data_->_tmp30_ = _data_->_tmp29_;
				_data_->_tmp31_ = g_strdup_printf ("%i", _data_->i);
				_data_->_tmp32_ = _data_->_tmp31_;
				_data_->_tmp33_ = g_strconcat (_data_->_tmp30_, _data_->_tmp32_, NULL);
				_g_free0 (_data_->name);
				_data_->name = _data_->_tmp33_;
				_g_free0 (_data_->_tmp32_);
				_g_free0 (_data_->_tmp30_);
				_data_->_tmp34_ = g_strconcat (_data_->base_title, " ", NULL);
				_data_->_tmp35_ = _data_->_tmp34_;
				_data_->_tmp36_ = g_strdup_printf ("%i", _data_->i);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = g_strconcat (_data_->_tmp35_, _data_->_tmp37_, NULL);
				_g_free0 (_data_->title);
				_data_->title = _data_->_tmp38_;
				_g_free0 (_data_->_tmp37_);
				_g_free0 (_data_->_tmp35_);
			}
		}
	}
	_g_object_unref0 (_data_->pool);
	_g_free0 (_data_->base_title);
	_g_free0 (_data_->base_name);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
boxes_vm_creator_create_target_volume (BoxesVMCreator* self,
                                       const gchar* name,
                                       gint64 storage,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	BoxesVmCreatorCreateTargetVolumeData* _data_;
	BoxesVMCreator* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_data_ = g_slice_new0 (BoxesVmCreatorCreateTargetVolumeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_vm_creator_create_target_volume_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (_data_->name);
	_data_->name = _tmp1_;
	_data_->storage = storage;
	boxes_vm_creator_create_target_volume_co (_data_);
}

static GVirStorageVol*
boxes_vm_creator_create_target_volume_finish (BoxesVMCreator* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	GVirStorageVol* result;
	BoxesVmCreatorCreateTargetVolumeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
boxes_vm_creator_create_target_volume_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	BoxesVmCreatorCreateTargetVolumeData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_vm_creator_create_target_volume_co (_data_);
}

static gboolean
boxes_vm_creator_create_target_volume_co (BoxesVmCreatorCreateTargetVolumeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = boxes_vm_creator_get_connection (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_state_ = 1;
	boxes_ensure_storage_pool (_data_->_tmp2_, boxes_vm_creator_create_target_volume_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = boxes_ensure_storage_pool_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->pool = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = boxes_vm_configurator_create_volume_config (_data_->name, _data_->storage, &_data_->_inner_error0_);
	_data_->config = _data_->_tmp5_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->pool);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_debug ("vm-creator.vala:251: Creating volume '%s'..", _data_->name);
	_data_->_tmp6_ = _data_->pool;
	_data_->_tmp7_ = _data_->config;
	_data_->_tmp8_ = gvir_storage_pool_create_volume (_data_->_tmp6_, _data_->_tmp7_, &_data_->_inner_error0_);
	_data_->volume = _data_->_tmp8_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->config);
		_g_object_unref0 (_data_->pool);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_debug ("vm-creator.vala:253: Created volume '%s'.", _data_->name);
	_data_->result = _data_->volume;
	_g_object_unref0 (_data_->config);
	_g_object_unref0 (_data_->pool);
	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;
}

BoxesInstallerMedia*
boxes_vm_creator_get_install_media (BoxesVMCreator* self)
{
	BoxesInstallerMedia* result;
	BoxesInstallerMedia* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_install_media;
	result = _tmp0_;
	return result;
}

void
boxes_vm_creator_set_install_media (BoxesVMCreator* self,
                                    BoxesInstallerMedia* value)
{
	BoxesInstallerMedia* old_value;
	g_return_if_fail (self != NULL);
	old_value = boxes_vm_creator_get_install_media (self);
	if (old_value != value) {
		BoxesInstallerMedia* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_install_media);
		self->priv->_install_media = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, boxes_vm_creator_properties[BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY]);
	}
}

GVirConnection*
boxes_vm_creator_get_connection (BoxesVMCreator* self)
{
	GVirConnection* result;
	BoxesApp* _tmp0_;
	GVirConnection* _tmp1_;
	GVirConnection* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = boxes_app_app;
	_tmp1_ = boxes_app_get_default_connection (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static guint
boxes_vm_creator_get_num_reboots (BoxesVMCreator* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_num_reboots;
	return result;
}

static void
boxes_vm_creator_set_num_reboots (BoxesVMCreator* self,
                                  guint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_num_reboots = value;
}

static void
boxes_vm_creator_class_init (BoxesVMCreatorClass * klass,
                             gpointer klass_data)
{
	boxes_vm_creator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesVMCreator_private_offset);
	((BoxesVMCreatorClass *) klass)->launch_vm = (void (*) (BoxesVMCreator*, BoxesLibvirtMachine*, gint64, gboolean, GError**)) boxes_vm_creator_real_launch_vm;
	((BoxesVMCreatorClass *) klass)->continue_installation = (void (*) (BoxesVMCreator*, BoxesLibvirtMachine*, GAsyncReadyCallback, gpointer)) boxes_vm_creator_real_continue_installation;
	((BoxesVMCreatorClass *) klass)->continue_installation_finish = (void (*) (BoxesVMCreator*, GAsyncResult*)) boxes_vm_creator_real_continue_installation_finish;
	((BoxesVMCreatorClass *) klass)->create_domain_config = (void (*) (BoxesVMCreator*, const gchar*, const gchar*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_vm_creator_real_create_domain_config;
	((BoxesVMCreatorClass *) klass)->create_domain_config_finish = (GVirConfigDomain* (*) (BoxesVMCreator*, GAsyncResult*, GError**)) boxes_vm_creator_real_create_domain_config_finish;
	((BoxesVMCreatorClass *) klass)->create_domain_base_name_and_title = (void (*) (BoxesVMCreator*, gchar**, gchar**)) boxes_vm_creator_real_create_domain_base_name_and_title;
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_vm_creator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_boxes_vm_creator_set_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_vm_creator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY, boxes_vm_creator_properties[BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY] = g_param_spec_object ("install-media", "install-media", "install-media", BOXES_TYPE_INSTALLER_MEDIA, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_VM_CREATOR_CONNECTION_PROPERTY, boxes_vm_creator_properties[BOXES_VM_CREATOR_CONNECTION_PROPERTY] = g_param_spec_object ("connection", "connection", "connection", gvir_connection_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
boxes_vm_creator_instance_init (BoxesVMCreator * self,
                                gpointer klass)
{
	self->priv = boxes_vm_creator_get_instance_private (self);
}

static void
boxes_vm_creator_finalize (GObject * obj)
{
	BoxesVMCreator * self;
	BoxesInstallerMedia* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_VM_CREATOR, BoxesVMCreator);
	_tmp0_ = self->priv->_install_media;
	if (_tmp0_ != NULL) {
		BoxesInstallerMedia* _tmp1_;
		_tmp1_ = self->priv->_install_media;
		boxes_installer_media_clean_up (_tmp1_);
	}
	_g_object_unref0 (self->priv->_install_media);
	G_OBJECT_CLASS (boxes_vm_creator_parent_class)->finalize (obj);
}

static GType
boxes_vm_creator_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesVMCreatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_vm_creator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesVMCreator), 0, (GInstanceInitFunc) boxes_vm_creator_instance_init, NULL };
	GType boxes_vm_creator_type_id;
	boxes_vm_creator_type_id = g_type_register_static (G_TYPE_OBJECT, "BoxesVMCreator", &g_define_type_info, 0);
	BoxesVMCreator_private_offset = g_type_add_instance_private (boxes_vm_creator_type_id, sizeof (BoxesVMCreatorPrivate));
	return boxes_vm_creator_type_id;
}

GType
boxes_vm_creator_get_type (void)
{
	static volatile gsize boxes_vm_creator_type_id__once = 0;
	if (g_once_init_enter (&boxes_vm_creator_type_id__once)) {
		GType boxes_vm_creator_type_id;
		boxes_vm_creator_type_id = boxes_vm_creator_get_type_once ();
		g_once_init_leave (&boxes_vm_creator_type_id__once, boxes_vm_creator_type_id);
	}
	return boxes_vm_creator_type_id__once;
}

static void
_vala_boxes_vm_creator_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	BoxesVMCreator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_VM_CREATOR, BoxesVMCreator);
	switch (property_id) {
		case BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY:
		g_value_set_object (value, boxes_vm_creator_get_install_media (self));
		break;
		case BOXES_VM_CREATOR_CONNECTION_PROPERTY:
		g_value_take_object (value, boxes_vm_creator_get_connection (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_boxes_vm_creator_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	BoxesVMCreator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_VM_CREATOR, BoxesVMCreator);
	switch (property_id) {
		case BOXES_VM_CREATOR_INSTALL_MEDIA_PROPERTY:
		boxes_vm_creator_set_install_media (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

