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

/* This file is part of GNOME Boxes. License: LGPLv2+*/
/* Automated installer media for Windows XP, 2000 and 2003*/

#include <glib.h>
#include <glib-object.h>
#include <osinfo/osinfo.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gio/gio.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_WIN_XP_INSTALLER (boxes_win_xp_installer_get_type ())
#define BOXES_WIN_XP_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_WIN_XP_INSTALLER, BoxesWinXPInstaller))
#define BOXES_WIN_XP_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_WIN_XP_INSTALLER, BoxesWinXPInstallerClass))
#define BOXES_IS_WIN_XP_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_WIN_XP_INSTALLER))
#define BOXES_IS_WIN_XP_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_WIN_XP_INSTALLER))
#define BOXES_WIN_XP_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_WIN_XP_INSTALLER, BoxesWinXPInstallerClass))

typedef struct _BoxesWinXPInstaller BoxesWinXPInstaller;
typedef struct _BoxesWinXPInstallerClass BoxesWinXPInstallerClass;
typedef struct _BoxesWinXPInstallerPrivate BoxesWinXPInstallerPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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

struct _BoxesInstallerMediaClass {
	GObjectClass parent_class;
};

struct _BoxesUnattendedInstaller {
	BoxesInstallerMedia parent_instance;
	BoxesUnattendedInstallerPrivate * priv;
	gchar* kernel_path;
	gchar* initrd_path;
	gchar* _floppy_path;
	gchar* unattended_src_path;
	gchar* unattended_dest_name;
	GtkLabel* setup_label;
	GtkHBox* setup_hbox;
	GtkSwitch* express_toggle;
	GtkEntry* username_entry;
	GtkEntry* password_entry;
};

struct _BoxesUnattendedInstallerClass {
	BoxesInstallerMediaClass parent_class;
	void (*populate_setup_vbox) (BoxesUnattendedInstaller* self, GtkVBox* setup_vbox);
	void (*setup_ui) (BoxesUnattendedInstaller* self);
	void (*clean_up) (BoxesUnattendedInstaller* self, GError** error);
	void (*prepare_direct_boot) (BoxesUnattendedInstaller* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*prepare_direct_boot_finish) (BoxesUnattendedInstaller* self, GAsyncResult* _res_, GError** error);
};

struct _BoxesWinXPInstaller {
	BoxesUnattendedInstaller parent_instance;
	BoxesWinXPInstallerPrivate * priv;
};

struct _BoxesWinXPInstallerClass {
	BoxesUnattendedInstallerClass parent_class;
};


static gpointer boxes_win_xp_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_win_xp_installer_get_type (void) G_GNUC_CONST;
enum  {
	BOXES_WIN_XP_INSTALLER_DUMMY_PROPERTY
};
BoxesWinXPInstaller* boxes_win_xp_installer_new_copy (BoxesInstallerMedia* media, GError** error);
BoxesWinXPInstaller* boxes_win_xp_installer_construct_copy (GType object_type, BoxesInstallerMedia* media, GError** error);
gchar* boxes_get_unattended_dir (const gchar* file_name);
BoxesUnattendedInstaller* boxes_unattended_installer_construct_copy (GType object_type, BoxesInstallerMedia* media, const gchar* unattended_src_path, const gchar* unattended_dest_name, GError** error);
BoxesWinXPInstaller* boxes_win_xp_installer_new (void);
BoxesWinXPInstaller* boxes_win_xp_installer_construct (GType object_type);
BoxesUnattendedInstaller* boxes_unattended_installer_construct (GType object_type);


BoxesWinXPInstaller* boxes_win_xp_installer_construct_copy (GType object_type, BoxesInstallerMedia* media, GError** error) {
	BoxesWinXPInstaller * self = NULL;
	BoxesInstallerMedia* _tmp0_;
	OsinfoOs* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar* unattended_source;
	BoxesInstallerMedia* _tmp8_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (media != NULL, NULL);
	_tmp0_ = media;
	_tmp1_ = _tmp0_->os;
	_tmp2_ = osinfo_product_get_short_id ((OsinfoProduct*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat (_tmp3_, ".sif", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = boxes_get_unattended_dir (_tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	unattended_source = _tmp7_;
	_tmp8_ = media;
	self = (BoxesWinXPInstaller*) boxes_unattended_installer_construct_copy (object_type, _tmp8_, unattended_source, "Winnt.sif", &_inner_error_);
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_free0 (unattended_source);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_free0 (unattended_source);
	return self;
}


BoxesWinXPInstaller* boxes_win_xp_installer_new_copy (BoxesInstallerMedia* media, GError** error) {
	return boxes_win_xp_installer_construct_copy (BOXES_TYPE_WIN_XP_INSTALLER, media, error);
}


BoxesWinXPInstaller* boxes_win_xp_installer_construct (GType object_type) {
	BoxesWinXPInstaller * self = NULL;
	self = (BoxesWinXPInstaller*) boxes_unattended_installer_construct (object_type);
	return self;
}


BoxesWinXPInstaller* boxes_win_xp_installer_new (void) {
	return boxes_win_xp_installer_construct (BOXES_TYPE_WIN_XP_INSTALLER);
}


static void boxes_win_xp_installer_class_init (BoxesWinXPInstallerClass * klass) {
	boxes_win_xp_installer_parent_class = g_type_class_peek_parent (klass);
}


static void boxes_win_xp_installer_instance_init (BoxesWinXPInstaller * self) {
}


GType boxes_win_xp_installer_get_type (void) {
	static volatile gsize boxes_win_xp_installer_type_id__volatile = 0;
	if (g_once_init_enter (&boxes_win_xp_installer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (BoxesWinXPInstallerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_win_xp_installer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesWinXPInstaller), 0, (GInstanceInitFunc) boxes_win_xp_installer_instance_init, NULL };
		GType boxes_win_xp_installer_type_id;
		boxes_win_xp_installer_type_id = g_type_register_static (BOXES_TYPE_UNATTENDED_INSTALLER, "BoxesWinXPInstaller", &g_define_type_info, 0);
		g_once_init_leave (&boxes_win_xp_installer_type_id__volatile, boxes_win_xp_installer_type_id);
	}
	return boxes_win_xp_installer_type_id__volatile;
}



