/* libvirt-vm-cloner.c generated by valac 0.36.1.38-6532, the Vala compiler
 * generated from libvirt-vm-cloner.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>


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

#define BOXES_TYPE_LIBVIRT_VM_CLONER (boxes_libvirt_vm_cloner_get_type ())
#define BOXES_LIBVIRT_VM_CLONER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_LIBVIRT_VM_CLONER, BoxesLibvirtVMCloner))
#define BOXES_LIBVIRT_VM_CLONER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_LIBVIRT_VM_CLONER, BoxesLibvirtVMClonerClass))
#define BOXES_IS_LIBVIRT_VM_CLONER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_LIBVIRT_VM_CLONER))
#define BOXES_IS_LIBVIRT_VM_CLONER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_LIBVIRT_VM_CLONER))
#define BOXES_LIBVIRT_VM_CLONER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_LIBVIRT_VM_CLONER, BoxesLibvirtVMClonerClass))

typedef struct _BoxesLibvirtVMCloner BoxesLibvirtVMCloner;
typedef struct _BoxesLibvirtVMClonerClass BoxesLibvirtVMClonerClass;
typedef struct _BoxesLibvirtVMClonerPrivate BoxesLibvirtVMClonerPrivate;
enum  {
	BOXES_LIBVIRT_VM_CLONER_DUMMY_PROPERTY,
	BOXES_LIBVIRT_VM_CLONER_LAST_PROPERTY
};
static GParamSpec* boxes_libvirt_vm_cloner_properties[BOXES_LIBVIRT_VM_CLONER_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 _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)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _BoxesLibvirtVmClonerPostImportSetupData BoxesLibvirtVmClonerPostImportSetupData;

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 _BoxesLibvirtVMCloner {
	BoxesLibvirtVMImporter parent_instance;
	BoxesLibvirtVMClonerPrivate * priv;
};

struct _BoxesLibvirtVMClonerClass {
	BoxesLibvirtVMImporterClass parent_class;
};

struct _BoxesLibvirtVmClonerPostImportSetupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gboolean _task_complete_;
	BoxesLibvirtVMCloner* self;
	BoxesLibvirtMachine* machine;
	gchar* image_path;
	BoxesLibvirtMachine* _tmp0_;
	GVirStorageVol* _tmp1_;
	GVirStorageVol* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** argv;
	gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar** _tmp9_;
	gint argv_length1;
	gint _argv_size_;
	gchar* std_output;
	gchar* std_error;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	GError* _error_;
	GError* _tmp16_;
	const gchar* _tmp17_;
	BoxesLibvirtMachine* _tmp18_;
	GError * _inner_error_;
};


static gpointer boxes_libvirt_vm_cloner_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_libvirt_vm_cloner_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;
BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_new (BoxesInstalledMedia* source_media);
BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_construct (GType object_type, BoxesInstalledMedia* source_media);
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_new (BoxesInstalledMedia* source_media);
BoxesLibvirtVMImporter* boxes_libvirt_vm_importer_construct (GType object_type, BoxesInstalledMedia* source_media);
BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_new_for_cloning_completion (BoxesLibvirtMachine* machine);
BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_construct_for_cloning_completion (GType object_type, BoxesLibvirtMachine* machine);
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);
static void boxes_libvirt_vm_cloner_real_post_import_setup_data_free (gpointer _data);
static void boxes_libvirt_vm_cloner_real_post_import_setup (BoxesVMImporter* base, BoxesLibvirtMachine* machine, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean boxes_libvirt_vm_cloner_real_post_import_setup_co (BoxesLibvirtVmClonerPostImportSetupData* _data_);
GVirStorageVol* boxes_libvirt_machine_get_storage_volume (BoxesLibvirtMachine* self);
static void boxes_libvirt_vm_cloner_post_import_setup_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void boxes_vm_importer_post_import_setup (BoxesVMImporter* self, BoxesLibvirtMachine* machine, GAsyncReadyCallback _callback_, gpointer _user_data_);
void boxes_vm_importer_post_import_setup_finish (BoxesVMImporter* self, GAsyncResult* _res_);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_construct (GType object_type, BoxesInstalledMedia* source_media) {
	BoxesLibvirtVMCloner* self = NULL;
	BoxesInstalledMedia* _tmp0_;
#line 4 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_return_val_if_fail (source_media != NULL, NULL);
#line 5 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_tmp0_ = source_media;
#line 5 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	self = (BoxesLibvirtVMCloner*) boxes_libvirt_vm_importer_construct (object_type, _tmp0_);
#line 4 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return self;
#line 254 "libvirt-vm-cloner.c"
}


BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_new (BoxesInstalledMedia* source_media) {
#line 4 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return boxes_libvirt_vm_cloner_construct (BOXES_TYPE_LIBVIRT_VM_CLONER, source_media);
#line 261 "libvirt-vm-cloner.c"
}


BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_construct_for_cloning_completion (GType object_type, BoxesLibvirtMachine* machine) {
	BoxesLibvirtVMCloner* self = NULL;
	BoxesLibvirtMachine* _tmp0_;
#line 8 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_return_val_if_fail (machine != NULL, NULL);
#line 9 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_tmp0_ = machine;
#line 9 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	self = (BoxesLibvirtVMCloner*) boxes_libvirt_vm_importer_construct_for_import_completion (object_type, _tmp0_);
#line 8 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return self;
#line 276 "libvirt-vm-cloner.c"
}


BoxesLibvirtVMCloner* boxes_libvirt_vm_cloner_new_for_cloning_completion (BoxesLibvirtMachine* machine) {
#line 8 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return boxes_libvirt_vm_cloner_construct_for_cloning_completion (BOXES_TYPE_LIBVIRT_VM_CLONER, machine);
#line 283 "libvirt-vm-cloner.c"
}


static void boxes_libvirt_vm_cloner_real_post_import_setup_data_free (gpointer _data) {
	BoxesLibvirtVmClonerPostImportSetupData* _data_;
	_data_ = _data;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_g_object_unref0 (_data_->machine);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_boxes_vm_creator_unref0 (_data_->self);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_slice_free (BoxesLibvirtVmClonerPostImportSetupData, _data_);
#line 296 "libvirt-vm-cloner.c"
}


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


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


static void boxes_libvirt_vm_cloner_real_post_import_setup (BoxesVMImporter* base, BoxesLibvirtMachine* machine, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	BoxesLibvirtVMCloner * self;
	BoxesLibvirtVmClonerPostImportSetupData* _data_;
	BoxesLibvirtVMCloner* _tmp0_;
	BoxesLibvirtMachine* _tmp1_;
	BoxesLibvirtMachine* _tmp2_;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	self = (BoxesLibvirtVMCloner*) base;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_ = g_slice_new0 (BoxesLibvirtVmClonerPostImportSetupData);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	if (_callback_ == NULL) {
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_task_complete_ = TRUE;
#line 330 "libvirt-vm-cloner.c"
	}
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_task_set_task_data (_data_->_async_result, _data_, boxes_libvirt_vm_cloner_real_post_import_setup_data_free);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_tmp0_ = _boxes_vm_creator_ref0 (self);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->self = _tmp0_;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_tmp1_ = machine;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_tmp2_ = _g_object_ref0 (_tmp1_);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_g_object_unref0 (_data_->machine);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->machine = _tmp2_;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	boxes_libvirt_vm_cloner_real_post_import_setup_co (_data_);
#line 348 "libvirt-vm-cloner.c"
}


static void boxes_libvirt_vm_cloner_real_post_import_setup_finish (BoxesVMImporter* base, GAsyncResult* _res_) {
	BoxesLibvirtVmClonerPostImportSetupData* _data_;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_task_complete_ = TRUE;
#line 358 "libvirt-vm-cloner.c"
}


static void boxes_libvirt_vm_cloner_post_import_setup_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	BoxesLibvirtVmClonerPostImportSetupData* _data_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_ = _user_data_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_source_object_ = source_object;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_res_ = _res_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_task_complete_ = TRUE;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	boxes_libvirt_vm_cloner_real_post_import_setup_co (_data_);
#line 374 "libvirt-vm-cloner.c"
}


static gboolean boxes_libvirt_vm_cloner_real_post_import_setup_co (BoxesLibvirtVmClonerPostImportSetupData* _data_) {
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	switch (_data_->_state_) {
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		case 0:
#line 383 "libvirt-vm-cloner.c"
		goto _state_0;
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		case 1:
#line 387 "libvirt-vm-cloner.c"
		goto _state_1;
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		case 2:
#line 391 "libvirt-vm-cloner.c"
		goto _state_2;
		default:
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_assert_not_reached ();
#line 396 "libvirt-vm-cloner.c"
	}
	_state_0:
	{
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp0_ = _data_->machine;
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp1_ = boxes_libvirt_machine_get_storage_volume (_data_->_tmp0_);
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp2_ = _data_->_tmp1_;
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp3_ = gvir_storage_vol_get_path (_data_->_tmp2_, &_data_->_inner_error_);
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp4_ = g_strdup (_data_->_tmp3_);
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->image_path = _data_->_tmp4_;
#line 14 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 414 "libvirt-vm-cloner.c"
			goto __catch130_g_error;
		}
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp5_ = g_strdup ("virt-sysprep");
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp6_ = g_strdup ("-a");
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp7_ = _data_->image_path;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp8_ = g_strdup (_data_->_tmp7_);
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp9_ = g_new0 (gchar*, 3 + 1);
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp9_[0] = _data_->_tmp5_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp9_[1] = _data_->_tmp6_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp9_[2] = _data_->_tmp8_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->argv = _data_->_tmp9_;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->argv_length1 = 3;
#line 15 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_argv_size_ = _data_->argv_length1;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp10_ = _data_->argv;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp10__length1 = _data_->argv_length1;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp11_ = NULL;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp12_ = NULL;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_state_ = 1;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		boxes_exec (_data_->_tmp10_, _data_->_tmp10__length1, NULL, boxes_libvirt_vm_cloner_post_import_setup_ready, _data_);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		return FALSE;
#line 453 "libvirt-vm-cloner.c"
		_state_1:
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		boxes_exec_finish (_data_->_res_, &_data_->_tmp11_, &_data_->_tmp12_, &_data_->_inner_error_);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_free0 (_data_->std_output);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->std_output = _data_->_tmp11_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_free0 (_data_->std_error);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->std_error = _data_->_tmp12_;
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			_g_free0 (_data_->std_error);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			_g_free0 (_data_->std_output);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
#line 18 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			_g_free0 (_data_->image_path);
#line 475 "libvirt-vm-cloner.c"
			goto __catch130_g_error;
		}
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp13_ = _data_->std_error;
#line 20 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		if (g_strcmp0 (_data_->_tmp13_, "") != 0) {
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			_data_->_tmp14_ = _data_->std_error;
#line 21 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			g_debug ("libvirt-vm-cloner.vala:21: Error output from virt-sysprep command: %s", _data_->_tmp14_);
#line 486 "libvirt-vm-cloner.c"
		}
#line 22 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp15_ = _data_->std_output;
#line 22 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_debug ("libvirt-vm-cloner.vala:22: Standard output from virt-sysprep command: " \
"%s", _data_->_tmp15_);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_free0 (_data_->std_error);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_free0 (_data_->std_output);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_free0 (_data_->image_path);
#line 500 "libvirt-vm-cloner.c"
	}
	goto __finally130;
	__catch130_g_error:
	{
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_error_ = _data_->_inner_error_;
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_inner_error_ = NULL;
#line 25 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp16_ = _data_->_error_;
#line 25 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_data_->_tmp17_ = _data_->_tmp16_->message;
#line 25 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_debug ("libvirt-vm-cloner.vala:25: Failed to run virt-sysprep: %s. You're on y" \
"our own.", _data_->_tmp17_);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		_g_error_free0 (_data_->_error_);
#line 517 "libvirt-vm-cloner.c"
	}
	__finally130:
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_clear_error (&_data_->_inner_error_);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		g_object_unref (_data_->_async_result);
#line 13 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		return FALSE;
#line 530 "libvirt-vm-cloner.c"
	}
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_tmp18_ = _data_->machine;
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	_data_->_state_ = 2;
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	BOXES_VM_IMPORTER_CLASS (boxes_libvirt_vm_cloner_parent_class)->post_import_setup ((BoxesVMImporter*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, BOXES_TYPE_LIBVIRT_VM_IMPORTER, BoxesLibvirtVMImporter), _data_->_tmp18_, boxes_libvirt_vm_cloner_post_import_setup_ready, _data_);
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return FALSE;
#line 540 "libvirt-vm-cloner.c"
	_state_2:
#line 28 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	BOXES_VM_IMPORTER_CLASS (boxes_libvirt_vm_cloner_parent_class)->post_import_setup_finish ((BoxesVMImporter*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, BOXES_TYPE_LIBVIRT_VM_IMPORTER, BoxesLibvirtVMImporter), _data_->_res_);
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	if (_data_->_state_ != 0) {
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
		while (_data_->_task_complete_ != TRUE) {
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
#line 552 "libvirt-vm-cloner.c"
		}
	}
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	g_object_unref (_data_->_async_result);
#line 12 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	return FALSE;
#line 559 "libvirt-vm-cloner.c"
}


static void boxes_libvirt_vm_cloner_class_init (BoxesLibvirtVMClonerClass * klass) {
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	boxes_libvirt_vm_cloner_parent_class = g_type_class_peek_parent (klass);
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	((BoxesVMImporterClass *) klass)->post_import_setup = (void (*) (BoxesVMImporter *, BoxesLibvirtMachine*, GAsyncReadyCallback, gpointer)) boxes_libvirt_vm_cloner_real_post_import_setup;
#line 3 "/home/fborges/checkout/gnome-boxes/src/libvirt-vm-cloner.vala"
	((BoxesVMImporterClass *) klass)->post_import_setup_finish = (void (*) (BoxesVMImporter *, GAsyncResult*)) boxes_libvirt_vm_cloner_real_post_import_setup_finish;
#line 570 "libvirt-vm-cloner.c"
}


static void boxes_libvirt_vm_cloner_instance_init (BoxesLibvirtVMCloner * self) {
}


GType boxes_libvirt_vm_cloner_get_type (void) {
	static volatile gsize boxes_libvirt_vm_cloner_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_libvirt_vm_cloner_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesLibvirtVMClonerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_libvirt_vm_cloner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesLibvirtVMCloner), 0, (GInstanceInitFunc) boxes_libvirt_vm_cloner_instance_init, NULL };
		GType boxes_libvirt_vm_cloner_type_id;
		boxes_libvirt_vm_cloner_type_id = g_type_register_static (BOXES_TYPE_LIBVIRT_VM_IMPORTER, "BoxesLibvirtVMCloner", &g_define_type_info, 0);
		g_once_init_leave (&boxes_libvirt_vm_cloner_type_id__volatile, boxes_libvirt_vm_cloner_type_id);
	}
	return boxes_libvirt_vm_cloner_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
	if ((array != NULL) && (destroy_func != NULL)) {
#line 593 "libvirt-vm-cloner.c"
		int i;
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
		for (i = 0; i < array_length; i = i + 1) {
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
			if (((gpointer*) array)[i] != NULL) {
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
				destroy_func (((gpointer*) array)[i]);
#line 601 "libvirt-vm-cloner.c"
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
	_vala_array_destroy (array, array_length, destroy_func);
#line 535 "/home/fborges/checkout/gnome-boxes/src/libvirt-machine.vala"
	g_free (array);
#line 613 "libvirt-vm-cloner.c"
}



