[gnome-boxes] wizard: Ensure needed info is provided at 'setup'
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] wizard: Ensure needed info is provided at 'setup'
- Date: Mon, 5 Mar 2012 21:13:16 +0000 (UTC)
commit 6a3c5a58125ab4c7863f29010aabfd72597d0715
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sat Feb 18 16:34:45 2012 +0200
wizard: Ensure needed info is provided at 'setup'
https://bugzilla.gnome.org/show_bug.cgi?id=670306
src/unattended-installer.vala | 12 +++++++++++-
src/wizard.vala | 40 ++++++++++++++++++++++++++++++----------
2 files changed, 41 insertions(+), 11 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 6f61d45..d7939ba 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -3,7 +3,8 @@
using GVirConfig;
public errordomain UnattendedInstallerError {
- COMMAND_FAILED
+ COMMAND_FAILED,
+ SETUP_INCOMPLETE
}
private abstract class Boxes.UnattendedInstaller: InstallerMedia {
@@ -144,6 +145,15 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
return disk;
}
+ // Ensure needed information was provided by user
+ public virtual void check_needed_info () throws UnattendedInstallerError.SETUP_INCOMPLETE {
+ if (!express_toggle.active)
+ return;
+
+ if (username == "")
+ throw new UnattendedInstallerError.SETUP_INCOMPLETE (_("No username provided"));
+ }
+
protected virtual void setup_ui () {
setup_label = new Gtk.Label (_("Choose express install to automatically preconfigure the box with optimal settings."));
setup_label.halign = Gtk.Align.START;
diff --git a/src/wizard.vala b/src/wizard.vala
index c057cc8..02ae434 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -53,12 +53,8 @@ private class Boxes.Wizard: Boxes.UI {
if (forwards) {
switch (value) {
case WizardPage.PREPARATION:
- try {
- prepare ();
- } catch (GLib.Error error) {
- app.notificationbar.display_error (error.message);
+ if (!prepare ())
return;
- }
break;
case WizardPage.SETUP:
@@ -67,7 +63,8 @@ private class Boxes.Wizard: Boxes.UI {
break;
case WizardPage.REVIEW:
- review ();
+ if (!review ())
+ return;
break;
case WizardPage.LAST:
@@ -232,7 +229,7 @@ private class Boxes.Wizard: Boxes.UI {
}
}
- private void prepare () throws GLib.Error {
+ private bool prepare () {
installer_image.set_from_icon_name ("media-optical", 0); // Reset
if (this.wizard_source.install_media != null) {
@@ -243,8 +240,19 @@ private class Boxes.Wizard: Boxes.UI {
return false;
});
- } else
- prepare_for_location (this.wizard_source.uri);
+
+ return true;
+ } else {
+ try {
+ prepare_for_location (this.wizard_source.uri);
+ } catch (GLib.Error error) {
+ app.notificationbar.display_error (error.message);
+
+ return false;
+ }
+
+ return true;
+ }
}
private bool setup () {
@@ -275,7 +283,17 @@ private class Boxes.Wizard: Boxes.UI {
return true;
}
- private void review () {
+ private bool review () {
+ if (install_media != null && install_media is UnattendedInstaller) {
+ try {
+ (install_media as UnattendedInstaller).check_needed_info ();
+ } catch (UnattendedInstallerError.SETUP_INCOMPLETE error) {
+ app.notificationbar.display_error (error.message);
+
+ return false;
+ }
+ }
+
summary.clear ();
review_label.set_text (_("Will create a new box with the following properties:"));
@@ -323,6 +341,8 @@ private class Boxes.Wizard: Boxes.UI {
memory = format_size (install_media.resources.storage, FormatSizeFlags.IEC_UNITS);
summary.add_property (_("Disk"), _("%s maximum".printf (memory)));
}
+
+ return true;
}
private void add_step (Gtk.Widget widget, string title, WizardPage page) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]