/* libvirt-vm-importer.c generated by valac 0.36.1.38-6532, the Vala compiler
 * generated from libvirt-vm-importer.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <libvirt-gobject/libvirt-gobject.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <libcommon.h>
#include <gtk/gtk.h>
#include <osinfo/osinfo.h>


#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_VM_IMPORTER (boxes_vm_importer_get_type ())
#define BOXES_VM_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_VM_IMPORTER, BoxesVMImporter))
#define BOXES_VM_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_VM_IMPORTER, BoxesVMImporterClass))
#define BOXES_IS_VM_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_VM_IMPORTER))
#define BOXES_IS_VM_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_VM_IMPORTER))
#define BOXES_VM_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_VM_IMPORTER, BoxesVMImporterClass))

typedef struct _BoxesVMImporter BoxesVMImporter;
typedef struct _BoxesVMImporterClass BoxesVMImporterClass;
typedef struct _BoxesVMImporterPrivate BoxesVMImporterPrivate;

#define BOXES_TYPE_LIBVIRT_VM_IMPORTER (boxes_libvirt_vm_importer_get_type ())
#define BOXES_LIBVIRT_VM_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_VM_IMPORTER, BoxesLibvirtVMImporter))
#define BOXES_LIBVIRT_VM_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_VM_IMPORTER, BoxesLibvirtVMImporterClass))
#define BOXES_IS_LIBVIRT_VM_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_VM_IMPORTER))
#define BOXES_IS_LIBVIRT_VM_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_VM_IMPORTER))
#define BOXES_LIBVIRT_VM_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_VM_IMPORTER, BoxesLibvirtVMImporterClass))

typedef struct _BoxesLibvirtVMImporter BoxesLibvirtVMImporter;
typedef struct _BoxesLibvirtVMImporterClass BoxesLibvirtVMImporterClass;
typedef struct _BoxesLibvirtVMImporterPrivate BoxesLibvirtVMImporterPrivate;
enum  {
	BOXES_LIBVIRT_VM_IMPORTER_DUMMY_PROPERTY,
	BOXES_LIBVIRT_VM_IMPORTER_LAST_PROPERTY
};
static GParamSpec* boxes_libvirt_vm_importer_properties[BOXES_LIBVIRT_VM_IMPORTER_LAST_PROPERTY];

#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;

#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 _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _boxes_vm_creator_unref0(var) ((var == NULL) ? NULL : (var = (boxes_vm_creator_unref (var), NULL)))
typedef struct _BoxesInstallerMediaPrivate BoxesInstallerMediaPrivate;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
typedef struct _BoxesLibvirtVmImporterCreateDomainConfigData BoxesLibvirtVmImporterCreateDomainConfigData;

struct _BoxesVMCreator {
	GTypeInstance parent_instance;
	volatile int ref_count;
	BoxesVMCreatorPrivate * priv;
};

struct _BoxesVMCreatorClass {
	GTypeClass parent_class;
	void (*finalize) (BoxesVMCreator *self);
	void (*launch_vm) (BoxesVMCreator* self, BoxesLibvirtMachine* machine, gint64 access_last_time, 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, GVirStorageVol* volume, 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 _BoxesVMImporter {
	BoxesVMCreator parent_instance;
	BoxesVMImporterPrivate * priv;
	gboolean start_after_import;
};

struct _BoxesVMImporterClass {
	BoxesVMCreatorClass parent_class;
	void (*post_import_setup) (BoxesVMImporter* self, BoxesLibvirtMachine* machine, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*post_import_setup_finish) (BoxesVMImporter* self, GAsyncResult* _res_);
};

struct _BoxesLibvirtVMImporter {
	BoxesVMImporter parent_instance;
	BoxesLibvirtVMImporterPrivate * priv;
};

struct _BoxesLibvirtVMImporterClass {
	BoxesVMImporterClass parent_class;
};

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);
	void (*populate_setup_box) (BoxesInstallerMedia* self, GtkBox* setup_box);
	GList* (*get_vm_properties) (BoxesInstallerMedia* self);
	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_ready_to_create) (BoxesInstallerMedia* self);
	gboolean (*get_live) (BoxesInstallerMedia* self);
	gchar* (*get_architecture) (BoxesInstallerMedia* self);
};

struct _BoxesLibvirtVmImporterCreateDomainConfigData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean _task_complete_;
	BoxesLibvirtVMImporter* self;
	gchar* name;
	gchar* title;
	GVirStorageVol* volume;
	GCancellable* cancellable;
	GVirConfigDomain* result;
	BoxesLibvirtMedia* media;
	BoxesInstallerMedia* _tmp0_;
	BoxesInstallerMedia* _tmp1_;
	BoxesLibvirtMedia* _tmp2_;
	GVirConfigDomain* config;
	BoxesLibvirtMedia* _tmp3_;
	GVirConfigDomain* _tmp4_;
	GVirConfigDomain* _tmp5_;
	GVirConfigDomain* _tmp6_;
	GVirConfigDomain* _tmp7_;
	const gchar* _tmp8_;
	GVirConfigDomain* _tmp9_;
	const gchar* _tmp10_;
	GVirConfigDomain* _tmp11_;
	BoxesInstallerMedia* _tmp12_;
	BoxesInstallerMedia* _tmp13_;
	GVirConfigDomain* _tmp14_;
	GVirConnection* _tmp15_;
	GVirConnection* _tmp16_;
	GVirConnection* _tmp17_;
	GList* devices;
	GVirConfigDomain* _tmp18_;
	GList* _tmp19_;
	GList* filtered;
	gint hd_index;
	GList* _tmp20_;
	GList* device_collection;
	GList* device_it;
	GVirConfigDomainDevice* _tmp21_;
	GVirConfigDomainDevice* device;
	GVirConfigDomainDevice* _tmp22_;
	GVirConfigDomainDisk* disk;
	GVirConfigDomainDevice* _tmp23_;
	GVirConfigDomainDisk* _tmp24_;
	GVirConfigDomainDisk* _tmp25_;
	const gchar* _tmp26_;
	BoxesLibvirtMedia* _tmp27_;
	const gchar* _tmp28_;
	GVirConfigDomainDisk* _tmp29_;
	GVirConfigDomainDiskGuestDeviceType _tmp30_;
	gchar* dev;
	GVirConfigDomainDisk* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	gint cd_index;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	gchar _tmp38_;
	gint _tmp39_;
	gint _tmp40_;
	gint _tmp41_;
	GVirConfigDomainDevice* _tmp42_;
	GVirConfigDomainDevice* _tmp43_;
	GVirConfigDomain* _tmp44_;
	GList* _tmp45_;
	const gchar* _tmp46_;
	GVirStorageVol* _tmp47_;
	const gchar* _tmp48_;
	GVirConfigDomain* _tmp49_;
	BoxesInstallerMedia* _tmp50_;
	BoxesInstallerMedia* _tmp51_;
	gint _tmp52_;
	GError * _inner_error_;
};


static gpointer boxes_libvirt_vm_importer_parent_class = NULL;

gpointer boxes_vm_creator_ref (gpointer instance);
void boxes_vm_creator_unref (gpointer instance);
GParamSpec* boxes_param_spec_vm_creator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void boxes_value_set_vm_creator (GValue* value, gpointer v_object);
void boxes_value_take_vm_creator (GValue* value, gpointer v_object);
gpointer boxes_value_get_vm_creator (const GValue* value);
GType boxes_vm_creator_get_type (void) G_GNUC_CONST;
GType boxes_collection_item_get_type (void) G_GNUC_CONST;
GType boxes_machine_get_type (void) G_GNUC_CONST;
GType boxes_libvirt_machine_get_type (void) G_GNUC_CONST;
GType boxes_vm_importer_get_type (void) G_GNUC_CONST;
GType boxes_libvirt_vm_importer_get_type (void) G_GNUC_CONST;
GType boxes_installer_media_get_type (void) G_GNUC_CONST;
GType boxes_installed_media_get_type (void) G_GNUC_CONST;
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_new (BoxesInstalledMedia* source_media);
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_construct (GType object_type, BoxesInstalledMedia* source_media);
BoxesVMImporter* boxes_vm_importer_new (BoxesInstalledMedia* source_media);
BoxesVMImporter* boxes_vm_importer_construct (GType object_type, BoxesInstalledMedia* source_media);
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_new_for_import_completion (BoxesLibvirtMachine* machine);
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_construct_for_import_completion (GType object_type, BoxesLibvirtMachine* machine);
BoxesVMCreator* boxes_vm_creator_new_for_install_completion (BoxesLibvirtMachine* machine);
BoxesVMCreator* boxes_vm_creator_construct_for_install_completion (GType object_type, BoxesLibvirtMachine* machine);
static void boxes_libvirt_vm_importer_real_create_domain_base_name_and_title (BoxesVMCreator* base, gchar* * base_name, gchar* * base_title);
GType boxes_libvirt_media_get_type (void) G_GNUC_CONST;
BoxesInstallerMedia* boxes_vm_creator_get_install_media (BoxesVMCreator* self);
GVirConfigDomain* boxes_libvirt_media_get_domain_config (BoxesLibvirtMedia* self);
static void boxes_libvirt_vm_importer_real_create_domain_config_data_free (gpointer _data);
static void boxes_libvirt_vm_importer_real_create_domain_config (BoxesVMCreator* base, const gchar* name, const gchar* title, GVirStorageVol* volume, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean boxes_libvirt_vm_importer_real_create_domain_config_co (BoxesLibvirtVmImporterCreateDomainConfigData* _data_);
void boxes_vm_configurator_setup_custom_xml (GVirConfigDomain* domain, BoxesInstallerMedia* install_media);
void boxes_vm_configurator_update_existing_domain (GVirConfigDomain* domain, GVirConnection* connection, GAsyncReadyCallback _callback_, gpointer _user_data_);
void boxes_vm_configurator_update_existing_domain_finish (GAsyncResult* _res_);
GVirConnection* boxes_vm_creator_get_connection (BoxesVMCreator* self);
static void boxes_libvirt_vm_importer_create_domain_config_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
void boxes_vm_configurator_set_target_media_config (GVirConfigDomain* domain, const gchar* target_path, BoxesInstallerMedia* install_media, guint8 dev_index);


BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_construct (GType object_type, BoxesInstalledMedia* source_media) {
	BoxesLibvirtVMImporter* self = NULL;
	BoxesInstalledMedia* _tmp0_;
#line 7 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_return_val_if_fail (source_media != NULL, NULL);
#line 8 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp0_ = source_media;
#line 8 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	self = (BoxesLibvirtVMImporter*) boxes_vm_importer_construct (object_type, _tmp0_);
#line 9 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	((BoxesVMImporter*) self)->start_after_import = FALSE;
#line 7 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return self;
#line 330 "libvirt-vm-importer.c"
}


BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_new (BoxesInstalledMedia* source_media) {
#line 7 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return boxes_libvirt_vm_importer_construct (BOXES_TYPE_LIBVIRT_VM_IMPORTER, source_media);
#line 337 "libvirt-vm-importer.c"
}


BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_construct_for_import_completion (GType object_type, BoxesLibvirtMachine* machine) {
	BoxesLibvirtVMImporter* self = NULL;
	BoxesLibvirtMachine* _tmp0_;
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_return_val_if_fail (machine != NULL, NULL);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp0_ = machine;
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	self = (BoxesLibvirtVMImporter*) boxes_vm_creator_construct_for_install_completion (object_type, _tmp0_);
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	((BoxesVMImporter*) self)->start_after_import = FALSE;
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return self;
#line 354 "libvirt-vm-importer.c"
}


BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_new_for_import_completion (BoxesLibvirtMachine* machine) {
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return boxes_libvirt_vm_importer_construct_for_import_completion (BOXES_TYPE_LIBVIRT_VM_IMPORTER, machine);
#line 361 "libvirt-vm-importer.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return self ? g_object_ref (self) : NULL;
#line 368 "libvirt-vm-importer.c"
}


static void boxes_libvirt_vm_importer_real_create_domain_base_name_and_title (BoxesVMCreator* base, gchar* * base_name, gchar* * base_title) {
	BoxesLibvirtVMImporter * self;
	gchar* _vala_base_name = NULL;
	gchar* _vala_base_title = NULL;
	BoxesLibvirtMedia* media = NULL;
	BoxesInstallerMedia* _tmp0_;
	BoxesInstallerMedia* _tmp1_;
	BoxesLibvirtMedia* _tmp2_;
	BoxesLibvirtMedia* _tmp3_;
	GVirConfigDomain* _tmp4_;
	GVirConfigDomain* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	const gchar* _tmp9_ = NULL;
	BoxesLibvirtMedia* _tmp10_;
	GVirConfigDomain* _tmp11_;
	GVirConfigDomain* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp16_;
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	self = (BoxesLibvirtVMImporter*) base;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp0_ = boxes_vm_creator_get_install_media ((BoxesVMCreator*) self);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp1_ = _tmp0_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, BOXES_TYPE_LIBVIRT_MEDIA) ? ((BoxesLibvirtMedia*) _tmp1_) : NULL);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	media = _tmp2_;
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp3_ = media;
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp4_ = boxes_libvirt_media_get_domain_config (_tmp3_);
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp5_ = _tmp4_;
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp6_ = gvir_config_domain_get_name (_tmp5_);
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp7_ = _tmp6_;
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp8_ = g_strdup (_tmp7_);
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_vala_base_name);
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_vala_base_name = _tmp8_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp10_ = media;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp11_ = boxes_libvirt_media_get_domain_config (_tmp10_);
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp12_ = _tmp11_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp13_ = gvir_config_domain_get_title (_tmp12_);
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp14_ = _tmp13_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp9_ = _tmp14_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (_tmp9_ == NULL) {
#line 433 "libvirt-vm-importer.c"
		const gchar* _tmp15_;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_tmp15_ = _vala_base_name;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_tmp9_ = _tmp15_;
#line 439 "libvirt-vm-importer.c"
	}
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp16_ = g_strdup (_tmp9_);
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_vala_base_title);
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_vala_base_title = _tmp16_;
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (media);
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (base_name) {
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		*base_name = _vala_base_name;
#line 453 "libvirt-vm-importer.c"
	} else {
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_g_free0 (_vala_base_name);
#line 457 "libvirt-vm-importer.c"
	}
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (base_title) {
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		*base_title = _vala_base_title;
#line 463 "libvirt-vm-importer.c"
	} else {
#line 17 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_g_free0 (_vala_base_title);
#line 467 "libvirt-vm-importer.c"
	}
}


static void boxes_libvirt_vm_importer_real_create_domain_config_data_free (gpointer _data) {
	BoxesLibvirtVmImporterCreateDomainConfigData* _data_;
	_data_ = _data;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_data_->name);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_data_->title);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->volume);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->cancellable);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->result);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_boxes_vm_creator_unref0 (_data_->self);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_slice_free (BoxesLibvirtVmImporterCreateDomainConfigData, _data_);
#line 489 "libvirt-vm-importer.c"
}


static gpointer _boxes_vm_creator_ref0 (gpointer self) {
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return self ? boxes_vm_creator_ref (self) : NULL;
#line 496 "libvirt-vm-importer.c"
}


static void boxes_libvirt_vm_importer_real_create_domain_config (BoxesVMCreator* base, const gchar* name, const gchar* title, GVirStorageVol* volume, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	BoxesLibvirtVMImporter * self;
	BoxesLibvirtVmImporterCreateDomainConfigData* _data_;
	BoxesLibvirtVMImporter* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GVirStorageVol* _tmp5_;
	GVirStorageVol* _tmp6_;
	GCancellable* _tmp7_;
	GCancellable* _tmp8_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	self = (BoxesLibvirtVMImporter*) base;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_ = g_slice_new0 (BoxesLibvirtVmImporterCreateDomainConfigData);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_async_result = g_task_new (NULL, cancellable, _callback_, _user_data_);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (_callback_ == NULL) {
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_data_->_task_complete_ = TRUE;
#line 522 "libvirt-vm-importer.c"
	}
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_task_set_task_data (_data_->_async_result, _data_, boxes_libvirt_vm_importer_real_create_domain_config_data_free);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp0_ = _boxes_vm_creator_ref0 (self);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->self = _tmp0_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp1_ = name;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp2_ = g_strdup (_tmp1_);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_data_->name);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->name = _tmp2_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp3_ = title;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp4_ = g_strdup (_tmp3_);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_free0 (_data_->title);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->title = _tmp4_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp5_ = volume;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp6_ = _g_object_ref0 (_tmp5_);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->volume);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->volume = _tmp6_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp7_ = cancellable;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_tmp8_ = _g_object_ref0 (_tmp7_);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->cancellable);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->cancellable = _tmp8_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_libvirt_vm_importer_real_create_domain_config_co (_data_);
#line 564 "libvirt-vm-importer.c"
}


static GVirConfigDomain* boxes_libvirt_vm_importer_real_create_domain_config_finish (BoxesVMCreator* base, GAsyncResult* _res_, GError** error) {
	GVirConfigDomain* result;
	BoxesLibvirtVmImporterCreateDomainConfigData* _data_;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (NULL == _data_) {
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		return NULL;
#line 577 "libvirt-vm-importer.c"
	}
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_task_complete_ = TRUE;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	result = _data_->result;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->result = NULL;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return result;
#line 587 "libvirt-vm-importer.c"
}


static void boxes_libvirt_vm_importer_create_domain_config_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	BoxesLibvirtVmImporterCreateDomainConfigData* _data_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_ = _user_data_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_source_object_ = source_object;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_res_ = _res_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_task_complete_ = TRUE;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_libvirt_vm_importer_real_create_domain_config_co (_data_);
#line 603 "libvirt-vm-importer.c"
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
#line 1110 "/home/fborges/jhbuild/install/share/vala-0.38/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, '\0');
#line 1111 "/home/fborges/jhbuild/install/share/vala-0.38/vapi/glib-2.0.vapi"
	_tmp0_ = index;
#line 1111 "/home/fborges/jhbuild/install/share/vala-0.38/vapi/glib-2.0.vapi"
	_tmp1_ = ((gchar*) self)[_tmp0_];
#line 1111 "/home/fborges/jhbuild/install/share/vala-0.38/vapi/glib-2.0.vapi"
	result = _tmp1_;
#line 1111 "/home/fborges/jhbuild/install/share/vala-0.38/vapi/glib-2.0.vapi"
	return result;
#line 621 "libvirt-vm-importer.c"
}


static void _g_object_unref0_ (gpointer var) {
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
#line 628 "libvirt-vm-importer.c"
}


static inline void _g_list_free__g_object_unref0_ (GList* self) {
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
#line 635 "libvirt-vm-importer.c"
}


static gboolean boxes_libvirt_vm_importer_real_create_domain_config_co (BoxesLibvirtVmImporterCreateDomainConfigData* _data_) {
#line 24 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	switch (_data_->_state_) {
#line 24 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		case 0:
#line 644 "libvirt-vm-importer.c"
		goto _state_0;
#line 24 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		case 1:
#line 648 "libvirt-vm-importer.c"
		goto _state_1;
		default:
#line 24 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		g_assert_not_reached ();
#line 653 "libvirt-vm-importer.c"
	}
	_state_0:
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp0_ = boxes_vm_creator_get_install_media ((BoxesVMCreator*) _data_->self);
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp1_ = _data_->_tmp0_;
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp1_, BOXES_TYPE_LIBVIRT_MEDIA) ? ((BoxesLibvirtMedia*) _data_->_tmp1_) : NULL);
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->media = _data_->_tmp2_;
#line 29 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp3_ = _data_->media;
#line 29 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp4_ = boxes_libvirt_media_get_domain_config (_data_->_tmp3_);
#line 29 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp5_ = _data_->_tmp4_;
#line 29 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp6_ = _g_object_ref0 (_data_->_tmp5_);
#line 29 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->config = _data_->_tmp6_;
#line 31 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp7_ = _data_->config;
#line 31 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp8_ = _data_->name;
#line 31 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	gvir_config_domain_set_name (_data_->_tmp7_, _data_->_tmp8_);
#line 32 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp9_ = _data_->config;
#line 32 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp10_ = _data_->title;
#line 32 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	gvir_config_domain_set_title (_data_->_tmp9_, _data_->_tmp10_);
#line 34 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp11_ = _data_->config;
#line 34 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp12_ = boxes_vm_creator_get_install_media ((BoxesVMCreator*) _data_->self);
#line 34 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp13_ = _data_->_tmp12_;
#line 34 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_vm_configurator_setup_custom_xml (_data_->_tmp11_, _data_->_tmp13_);
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp14_ = _data_->config;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp15_ = boxes_vm_creator_get_connection ((BoxesVMCreator*) _data_->self);
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp16_ = _data_->_tmp15_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp17_ = _data_->_tmp16_;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_state_ = 1;
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_vm_configurator_update_existing_domain (_data_->_tmp14_, _data_->_tmp17_, boxes_libvirt_vm_importer_create_domain_config_ready, _data_);
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return FALSE;
#line 708 "libvirt-vm-importer.c"
	_state_1:
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_vm_configurator_update_existing_domain_finish (_data_->_res_);
#line 35 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->_tmp17_);
#line 37 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp18_ = _data_->config;
#line 37 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp19_ = gvir_config_domain_get_devices (_data_->_tmp18_);
#line 37 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->devices = _data_->_tmp19_;
#line 38 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->filtered = NULL;
#line 39 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->hd_index = 0;
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp20_ = _data_->devices;
#line 726 "libvirt-vm-importer.c"
	{
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_data_->device_collection = _data_->_tmp20_;
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		for (_data_->device_it = _data_->device_collection; _data_->device_it != NULL; _data_->device_it = _data_->device_it->next) {
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
			_data_->_tmp21_ = _g_object_ref0 ((GVirConfigDomainDevice*) _data_->device_it->data);
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
			_data_->device = _data_->_tmp21_;
#line 736 "libvirt-vm-importer.c"
			{
#line 41 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				_data_->_tmp22_ = _data_->device;
#line 41 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp22_, gvir_config_domain_disk_get_type ())) {
#line 42 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp23_ = _data_->device;
#line 42 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp24_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp23_, gvir_config_domain_disk_get_type ()) ? ((GVirConfigDomainDisk*) _data_->_tmp23_) : NULL);
#line 42 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->disk = _data_->_tmp24_;
#line 44 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp25_ = _data_->disk;
#line 44 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp26_ = gvir_config_domain_disk_get_source (_data_->_tmp25_);
#line 44 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp27_ = _data_->media;
#line 44 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp28_ = ((BoxesInstallerMedia*) _data_->_tmp27_)->device_file;
#line 44 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					if (g_strcmp0 (_data_->_tmp26_, _data_->_tmp28_) == 0) {
#line 46 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_g_object_unref0 (_data_->disk);
#line 46 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_g_object_unref0 (_data_->device);
#line 46 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						continue;
#line 764 "libvirt-vm-importer.c"
					}
#line 49 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp29_ = _data_->disk;
#line 49 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_data_->_tmp30_ = gvir_config_domain_disk_get_guest_device_type (_data_->_tmp29_);
#line 49 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					if (_data_->_tmp30_ == GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM) {
#line 50 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp31_ = _data_->disk;
#line 50 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp32_ = gvir_config_domain_disk_get_target_dev (_data_->_tmp31_);
#line 50 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp33_ = g_strdup (_data_->_tmp32_);
#line 50 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->dev = _data_->_tmp33_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp34_ = _data_->dev;
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp35_ = _data_->dev;
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp36_ = strlen (_data_->_tmp35_);
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp37_ = _data_->_tmp36_;
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp38_ = string_get (_data_->_tmp34_, (glong) (_data_->_tmp37_ - 1));
#line 51 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->cd_index = ((guint8) _data_->_tmp38_) - 97;
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->_tmp40_ = _data_->cd_index;
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						if (_data_->_tmp40_ != 0) {
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
							_data_->_tmp39_ = 0;
#line 798 "libvirt-vm-importer.c"
						} else {
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
							_data_->_tmp41_ = _data_->cd_index;
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
							_data_->_tmp39_ = _data_->_tmp41_ + 1;
#line 804 "libvirt-vm-importer.c"
						}
#line 53 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_data_->hd_index = _data_->_tmp39_;
#line 49 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
						_g_free0 (_data_->dev);
#line 810 "libvirt-vm-importer.c"
					}
#line 41 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
					_g_object_unref0 (_data_->disk);
#line 814 "libvirt-vm-importer.c"
				}
#line 57 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				_data_->_tmp42_ = _data_->device;
#line 57 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				_data_->_tmp43_ = _g_object_ref0 (_data_->_tmp42_);
#line 57 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				_data_->filtered = g_list_prepend (_data_->filtered, _data_->_tmp43_);
#line 40 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
				_g_object_unref0 (_data_->device);
#line 824 "libvirt-vm-importer.c"
			}
		}
	}
#line 59 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->filtered = g_list_reverse (_data_->filtered);
#line 60 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp44_ = _data_->config;
#line 60 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp45_ = _data_->filtered;
#line 60 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	gvir_config_domain_set_devices (_data_->_tmp44_, _data_->_tmp45_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp47_ = _data_->volume;
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp48_ = gvir_storage_vol_get_path (_data_->_tmp47_, &_data_->_inner_error_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp46_ = _data_->_tmp48_;
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		__g_list_free__g_object_unref0_0 (_data_->filtered);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		__g_list_free__g_object_unref0_0 (_data_->devices);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_g_object_unref0 (_data_->config);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		_g_object_unref0 (_data_->media);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		g_object_unref (_data_->_async_result);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		return FALSE;
#line 858 "libvirt-vm-importer.c"
	}
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp49_ = _data_->config;
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp50_ = boxes_vm_creator_get_install_media ((BoxesVMCreator*) _data_->self);
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp51_ = _data_->_tmp50_;
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->_tmp52_ = _data_->hd_index;
#line 63 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_vm_configurator_set_target_media_config (_data_->_tmp49_, _data_->_tmp46_, _data_->_tmp51_, (guint8) _data_->_tmp52_);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_data_->result = _data_->config;
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	__g_list_free__g_object_unref0_0 (_data_->filtered);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	__g_list_free__g_object_unref0_0 (_data_->devices);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	_g_object_unref0 (_data_->media);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	if (_data_->_state_ != 0) {
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
		while (_data_->_task_complete_ != TRUE) {
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
#line 886 "libvirt-vm-importer.c"
		}
	}
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	g_object_unref (_data_->_async_result);
#line 65 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	return FALSE;
#line 893 "libvirt-vm-importer.c"
}


static void boxes_libvirt_vm_importer_class_init (BoxesLibvirtVMImporterClass * klass) {
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	boxes_libvirt_vm_importer_parent_class = g_type_class_peek_parent (klass);
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	((BoxesVMCreatorClass *) klass)->create_domain_base_name_and_title = (void (*) (BoxesVMCreator *, gchar* *, gchar* *)) boxes_libvirt_vm_importer_real_create_domain_base_name_and_title;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	((BoxesVMCreatorClass *) klass)->create_domain_config = (void (*) (BoxesVMCreator *, const gchar*, const gchar*, GVirStorageVol*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_libvirt_vm_importer_real_create_domain_config;
#line 6 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-importer.vala"
	((BoxesVMCreatorClass *) klass)->create_domain_config_finish = (GVirConfigDomain* (*) (BoxesVMCreator *, GAsyncResult*, GError**)) boxes_libvirt_vm_importer_real_create_domain_config_finish;
#line 906 "libvirt-vm-importer.c"
}


static void boxes_libvirt_vm_importer_instance_init (BoxesLibvirtVMImporter * self) {
}


GType boxes_libvirt_vm_importer_get_type (void) {
	static volatile gsize boxes_libvirt_vm_importer_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_libvirt_vm_importer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesLibvirtVMImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_libvirt_vm_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesLibvirtVMImporter), 0, (GInstanceInitFunc) boxes_libvirt_vm_importer_instance_init, NULL };
		GType boxes_libvirt_vm_importer_type_id;
		boxes_libvirt_vm_importer_type_id = g_type_register_static (BOXES_TYPE_VM_IMPORTER, "BoxesLibvirtVMImporter", &g_define_type_info, 0);
		g_once_init_leave (&boxes_libvirt_vm_importer_type_id__volatile, boxes_libvirt_vm_importer_type_id);
	}
	return boxes_libvirt_vm_importer_type_id__volatile;
}



