/* windows-installer.c generated by valac 0.17.7, the Vala compiler
 * generated from windows-installer.vala, do not modify */

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

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


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

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

#define BOXES_TYPE_UNATTENDED_INSTALLER (boxes_unattended_installer_get_type ())
#define BOXES_UNATTENDED_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller))
#define BOXES_UNATTENDED_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstallerClass))
#define BOXES_IS_UNATTENDED_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_INSTALLER))
#define BOXES_IS_UNATTENDED_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UNATTENDED_INSTALLER))
#define BOXES_UNATTENDED_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstallerClass))

typedef struct _BoxesUnattendedInstaller BoxesUnattendedInstaller;
typedef struct _BoxesUnattendedInstallerClass BoxesUnattendedInstallerClass;
typedef struct _BoxesUnattendedInstallerPrivate BoxesUnattendedInstallerPrivate;

#define BOXES_TYPE_UNATTENDED_FILE (boxes_unattended_file_get_type ())
#define BOXES_UNATTENDED_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_FILE, BoxesUnattendedFile))
#define BOXES_IS_UNATTENDED_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_FILE))
#define BOXES_UNATTENDED_FILE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_UNATTENDED_FILE, BoxesUnattendedFileIface))

typedef struct _BoxesUnattendedFile BoxesUnattendedFile;
typedef struct _BoxesUnattendedFileIface BoxesUnattendedFileIface;

#define TYPE_AVATAR_FORMAT (avatar_format_get_type ())
#define AVATAR_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AVATAR_FORMAT, AvatarFormat))
#define AVATAR_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AVATAR_FORMAT, AvatarFormatClass))
#define IS_AVATAR_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AVATAR_FORMAT))
#define IS_AVATAR_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AVATAR_FORMAT))
#define AVATAR_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AVATAR_FORMAT, AvatarFormatClass))

typedef struct _AvatarFormat AvatarFormat;
typedef struct _AvatarFormatClass AvatarFormatClass;

#define BOXES_TYPE_WINDOWS_INSTALLER (boxes_windows_installer_get_type ())
#define BOXES_WINDOWS_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_WINDOWS_INSTALLER, BoxesWindowsInstaller))
#define BOXES_WINDOWS_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_WINDOWS_INSTALLER, BoxesWindowsInstallerClass))
#define BOXES_IS_WINDOWS_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_WINDOWS_INSTALLER))
#define BOXES_IS_WINDOWS_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_WINDOWS_INSTALLER))
#define BOXES_WINDOWS_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_WINDOWS_INSTALLER, BoxesWindowsInstallerClass))

typedef struct _BoxesWindowsInstaller BoxesWindowsInstaller;
typedef struct _BoxesWindowsInstallerClass BoxesWindowsInstallerClass;
typedef struct _BoxesWindowsInstallerPrivate BoxesWindowsInstallerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

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_for_installation) (BoxesInstallerMedia* self, const gchar* vm_name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*prepare_for_installation_finish) (BoxesInstallerMedia* self, GAsyncResult* _res_, GError** error);
	void (*setup_domain_config) (BoxesInstallerMedia* self, GVirConfigDomain* domain);
	void (*populate_setup_vbox) (BoxesInstallerMedia* self, GtkVBox* setup_vbox);
	GList* (*get_vm_properties) (BoxesInstallerMedia* self);
	guint64 (*get_installed_size) (BoxesInstallerMedia* self);
	gboolean (*get_need_user_input_for_vm_creation) (BoxesInstallerMedia* self);
	gboolean (*get_user_data_for_vm_creation_available) (BoxesInstallerMedia* self);
	gboolean (*get_supports_virtio_disk) (BoxesInstallerMedia* self);
};

struct _BoxesUnattendedFileIface {
	GTypeInterface parent_iface;
	void (*get_source_file) (BoxesUnattendedFile* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GFile* (*get_source_file_finish) (BoxesUnattendedFile* self, GAsyncResult* _res_, GError** error);
	const gchar* (*get_src_path) (BoxesUnattendedFile* self);
	void (*set_src_path) (BoxesUnattendedFile* self, const gchar* value);
	const gchar* (*get_dest_name) (BoxesUnattendedFile* self);
	void (*set_dest_name) (BoxesUnattendedFile* self, const gchar* value);
	BoxesUnattendedInstaller* (*get_installer) (BoxesUnattendedFile* self);
	void (*set_installer) (BoxesUnattendedFile* self, BoxesUnattendedInstaller* value);
};

struct _BoxesUnattendedInstaller {
	BoxesInstallerMedia parent_instance;
	BoxesUnattendedInstallerPrivate * priv;
	GDataStreamNewlineType newline_type;
	GFile* disk_file;
	GList* unattended_files;
	GtkTable* setup_table;
	GtkLabel* setup_label;
	GtkHBox* setup_hbox;
	GtkSwitch* express_toggle;
	GtkEntry* username_entry;
	GtkEntry* password_entry;
	gchar* timezone;
	gchar* lang;
	gchar* hostname;
	AvatarFormat* avatar_format;
};

struct _BoxesUnattendedInstallerClass {
	BoxesInstallerMediaClass parent_class;
	gchar* (*fill_unattended_data) (BoxesUnattendedInstaller* self, const gchar* data, GError** error);
	void (*setup_ui) (BoxesUnattendedInstaller* self);
	void (*clean_up) (BoxesUnattendedInstaller* self, GError** error);
	GVirConfigDomainDisk* (*get_unattended_disk_config) (BoxesUnattendedInstaller* self);
};

struct _BoxesWindowsInstaller {
	BoxesUnattendedInstaller parent_instance;
	BoxesWindowsInstallerPrivate * priv;
};

struct _BoxesWindowsInstallerClass {
	BoxesUnattendedInstallerClass parent_class;
};


static gpointer boxes_windows_installer_parent_class = NULL;

GType boxes_installer_media_get_type (void) G_GNUC_CONST;
GType boxes_unattended_installer_get_type (void) G_GNUC_CONST;
GType boxes_unattended_file_get_type (void) G_GNUC_CONST;
gpointer avatar_format_ref (gpointer instance);
void avatar_format_unref (gpointer instance);
GParamSpec* param_spec_avatar_format (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void value_set_avatar_format (GValue* value, gpointer v_object);
void value_take_avatar_format (GValue* value, gpointer v_object);
gpointer value_get_avatar_format (const GValue* value);
GType avatar_format_get_type (void) G_GNUC_CONST;
GType boxes_windows_installer_get_type (void) G_GNUC_CONST;
enum  {
	BOXES_WINDOWS_INSTALLER_DUMMY_PROPERTY
};
static GVirConfigDomainDisk* boxes_windows_installer_real_get_unattended_disk_config (BoxesUnattendedInstaller* base);
GVirConfigDomainDisk* boxes_unattended_installer_get_unattended_disk_config (BoxesUnattendedInstaller* self);
static void boxes_windows_installer_real_setup_domain_config (BoxesInstallerMedia* base, GVirConfigDomain* domain);
void boxes_installer_media_setup_domain_config (BoxesInstallerMedia* self, GVirConfigDomain* domain);
gchar* boxes_unattended_installer_get_extra_iso (BoxesUnattendedInstaller* self);
void boxes_unattended_installer_add_extra_iso (BoxesUnattendedInstaller* self, GVirConfigDomain* domain);
BoxesWindowsInstaller* boxes_windows_installer_construct (GType object_type);
BoxesUnattendedInstaller* boxes_unattended_installer_construct (GType object_type);


static GVirConfigDomainDisk* boxes_windows_installer_real_get_unattended_disk_config (BoxesUnattendedInstaller* base) {
	BoxesWindowsInstaller * self;
	GVirConfigDomainDisk* result = NULL;
	GVirConfigDomainDisk* _tmp0_ = NULL;
	GVirConfigDomainDisk* disk;
	GVirConfigDomainDisk* _tmp1_;
	GVirConfigDomainDisk* _tmp2_;
	GVirConfigDomainDisk* _tmp3_;
	self = (BoxesWindowsInstaller*) base;
	_tmp0_ = BOXES_UNATTENDED_INSTALLER_CLASS (boxes_windows_installer_parent_class)->get_unattended_disk_config (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller));
	disk = _tmp0_;
	_tmp1_ = disk;
	if (_tmp1_ == NULL) {
		result = NULL;
		_g_object_unref0 (disk);
		return result;
	}
	_tmp2_ = disk;
	gvir_config_domain_disk_set_guest_device_type (_tmp2_, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_FLOPPY);
	_tmp3_ = disk;
	gvir_config_domain_disk_set_target_dev (_tmp3_, "fd");
	result = disk;
	return result;
}


static void boxes_windows_installer_real_setup_domain_config (BoxesInstallerMedia* base, GVirConfigDomain* domain) {
	BoxesWindowsInstaller * self;
	GVirConfigDomain* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	self = (BoxesWindowsInstaller*) base;
	g_return_if_fail (domain != NULL);
	_tmp0_ = domain;
	BOXES_INSTALLER_MEDIA_CLASS (boxes_windows_installer_parent_class)->setup_domain_config ((BoxesInstallerMedia*) G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller), _tmp0_);
	_tmp1_ = boxes_unattended_installer_get_extra_iso ((BoxesUnattendedInstaller*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ != NULL;
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		GVirConfigDomain* _tmp5_;
		_tmp5_ = domain;
		boxes_unattended_installer_add_extra_iso ((BoxesUnattendedInstaller*) self, _tmp5_);
	}
}


BoxesWindowsInstaller* boxes_windows_installer_construct (GType object_type) {
	BoxesWindowsInstaller * self = NULL;
	self = (BoxesWindowsInstaller*) boxes_unattended_installer_construct (object_type);
	return self;
}


static void boxes_windows_installer_class_init (BoxesWindowsInstallerClass * klass) {
	boxes_windows_installer_parent_class = g_type_class_peek_parent (klass);
	BOXES_UNATTENDED_INSTALLER_CLASS (klass)->get_unattended_disk_config = boxes_windows_installer_real_get_unattended_disk_config;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->setup_domain_config = boxes_windows_installer_real_setup_domain_config;
}


static void boxes_windows_installer_instance_init (BoxesWindowsInstaller * self) {
}


GType boxes_windows_installer_get_type (void) {
	static volatile gsize boxes_windows_installer_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_windows_installer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesWindowsInstallerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_windows_installer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesWindowsInstaller), 0, (GInstanceInitFunc) boxes_windows_installer_instance_init, NULL };
		GType boxes_windows_installer_type_id;
		boxes_windows_installer_type_id = g_type_register_static (BOXES_TYPE_UNATTENDED_INSTALLER, "BoxesWindowsInstaller", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&boxes_windows_installer_type_id__volatile, boxes_windows_installer_type_id);
	}
	return boxes_windows_installer_type_id__volatile;
}



