[gnome-boxes/gnome-3-8] wizard: Go to next page if a setup entry activates



commit 870d2b03b1184aa575189c1821a9d7186d5290e0
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Apr 10 22:05:12 2013 +0300

    wizard: Go to next page if a setup entry activates
    
    But before we do, ensure user has provided all required info. If all
    required info is not yet provided, take user to next required entry that
    is still awaiting input.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664218

 src/installer-media.vala      |    2 ++
 src/unattended-installer.vala |   23 ++++++++++++++++++++++-
 src/wizard.vala               |    4 ++++
 3 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index f94feee..0bf3eb2 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -15,6 +15,8 @@ private class Boxes.InstallerMedia : GLib.Object {
 
     public Osinfo.DeviceList supported_devices;
 
+    public signal void user_wants_to_create (); // User wants to already create the VM
+
     // FIXME: Currently this information is always unknown so practically we never show any progress for 
installations.
     public virtual uint64 installed_size { get { return 0; } }
     public virtual bool need_user_input_for_vm_creation { get { return false; } }
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 02b3ab1..5e16bb1 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -375,7 +375,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         express_toggle.margin_bottom = 15;
         express_toggle.halign = Gtk.Align.START;
         express_toggle.valign = Gtk.Align.CENTER;
-        express_toggle.notify["active"].connect (() => { notify_property ("ready-to-create"); });
+        express_toggle.notify["active"].connect (() => { user_wants_to_create (); });
         setup_grid.attach (express_toggle, 2, 0, 1, 1);
         setup_grid_n_rows++;
 
@@ -399,6 +399,13 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         username_entry.margin_bottom  = 10;
         username_entry.halign = Gtk.Align.FILL;
         username_entry.valign = Gtk.Align.END;
+        username_entry.activate.connect (() => {
+            if (ready_for_express)
+                user_wants_to_create ();
+            else if (username != "" && product_key_format != null)
+                key_entry.grab_focus (); // If username is provided, must be product key thats still not 
provided
+        });
+
         setup_grid.attach (username_entry, 2, 1, 1, 1);
         setup_grid_n_rows++;
 
@@ -428,6 +435,14 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
                 notebook.prev_page ();
             return false;
         });
+        password_entry.activate.connect (() => {
+            if (ready_for_express)
+                user_wants_to_create ();
+            else if (username == "")
+                username_entry.grab_focus ();
+            else if (product_key_format != null)
+                key_entry.grab_focus ();
+        });
         setup_grid.attach (notebook, 2, 2, 1, 1);
         setup_grid_n_rows++;
 
@@ -455,6 +470,12 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         key_entry.get_style_context ().add_class ("boxes-product-key-entry");
         setup_grid.attach (key_entry, 2, setup_grid_n_rows, 1, 1);
         express_toggle.bind_property ("active", key_entry, "sensitive", 0);
+        key_entry.activate.connect (() => {
+            if (ready_for_express)
+                user_wants_to_create ();
+            else if (key_entry.text_length == product_key_format.length)
+                username_entry.grab_focus (); // If product key is provided, must be username thats still 
not provided.
+        });
         setup_grid_n_rows++;
 
         key_inserted_id = key_entry.insert_text.connect (on_key_text_inserted);
diff --git a/src/wizard.vala b/src/wizard.vala
index 385e34b..1e2129c 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -338,6 +338,10 @@ private class Boxes.Wizard: Boxes.UI {
                                                 continue_button, "sensitive",
                                                 BindingFlags.SYNC_CREATE);
         vm_creator.install_media.populate_setup_vbox (setup_vbox);
+        vm_creator.install_media.user_wants_to_create.connect (() => {
+            if (vm_creator.install_media.ready_to_create)
+                page = page + 1;
+        });
 
         return true;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]