[gnome-boxes/wizard-initial-setup: 12/12] wizard: Introduce the "Initial Setup" page



commit 0ac60285a3bf06e14d8a9e1a0a3a9ae5351f5cca
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Jun 25 15:38:47 2018 +0200

    wizard: Introduce the "Initial Setup" page
    
    This page is shown the first time a new box is created, describing
    what can be achieved with the assistant.
    
    It detects the first run from a gsetting:
      $ gsettings get org.gnome.boxes first-run
    
    This is based on the wizard mockups available at
    https://gitlab.gnome.org/Community/Design/app-mockups/raw/87e07fbc4/boxes/boxes-newbox-assistant.png

 data/org.gnome.boxes.gschema.xml |  7 +++++++
 data/ui/wizard-window.ui         | 43 ++++++++++++++++++++++++++++++++++++++++
 src/app-window.vala              |  5 +++++
 src/wizard-window.vala           |  8 +++++++-
 src/wizard.vala                  | 10 ++++++++--
 5 files changed, 70 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.boxes.gschema.xml b/data/org.gnome.boxes.gschema.xml
index cfa00f40..2e854ce9 100644
--- a/data/org.gnome.boxes.gschema.xml
+++ b/data/org.gnome.boxes.gschema.xml
@@ -48,6 +48,13 @@
         Window maximized state
       </description>
     </key>
+    <key name="first-run" type="b">
+      <default>true</default>
+      <summary>First run</summary>
+      <description>
+        Whether Boxes is running for the first time
+      </description>
+    </key>
 
     <key name="shared-folders" type="s">
       <default>""</default>
diff --git a/data/ui/wizard-window.ui b/data/ui/wizard-window.ui
index 23c38fe7..51b64781 100644
--- a/data/ui/wizard-window.ui
+++ b/data/ui/wizard-window.ui
@@ -49,6 +49,49 @@
               <class name="content-bg"/>
             </style>
 
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="valign">center</property>
+                <property name="spacing">20</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="resource">/org/gnome/Boxes/icons/boxes-create.png</property>
+                    <property name="halign">center</property>
+                    <property name="valign">center</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Create a Box</property>
+                    <attributes>
+                      <attribute name="scale" value="2.4"/>
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="justify">center</property>
+                    <property name="halign">center</property>
+                    <property name="wrap">True</property>
+                    <property name="max-width-chars">60</property>
+                    <property name="label" translatable="yes">Each box can be a virtual machine that runs on 
this computer, or a connection to an existing remote machine</property>
+                    <attributes>
+                      <attribute name="scale" value="1.2"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+
+              <packing>
+                <property name="name">first-run</property>
+              </packing>
+            </child>
+
             <child>
               <object class="BoxesWizard" id="wizard">
                 <property name="visible">True</property>
diff --git a/src/app-window.vala b/src/app-window.vala
index a0b94b6e..005723bb 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -119,6 +119,11 @@
 
     public GLib.Settings settings;
 
+    public bool first_run {
+        get { return settings.get_boolean ("first-run"); }
+        set { settings.set_boolean ("first-run", value); }
+    }
+
     [GtkChild]
     private Notificationbar _notificationbar;
 
diff --git a/src/wizard-window.vala b/src/wizard-window.vala
index f819c1c9..cd0f36ee 100644
--- a/src/wizard-window.vala
+++ b/src/wizard-window.vala
@@ -2,6 +2,7 @@
 using Gtk;
 
 private enum Boxes.WizardWindowPage {
+    FIRT_RUN,
     MAIN,
     CUSTOMIZATION,
     FILE_CHOOSER,
@@ -10,7 +11,7 @@
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-window.ui")]
 private class Boxes.WizardWindow : Gtk.Window, Boxes.UI {
-    public const string[] page_names = { "main", "customization", "file_chooser", "downloads" };
+    public const string[] page_names = { "first-run", "main", "customization", "file_chooser", "downloads" };
 
     public HashTable<string,Osinfo.Os> logos_table;
 
@@ -58,6 +59,11 @@ public WizardWindow (AppWindow app_window) {
         wizard.setup_ui (app_window, this);
         topbar.setup_ui (this);
 
+        // We show an Introduction page the first time Boxes runs
+        if (!app_window.first_run) {
+            page = WizardWindowPage.MAIN;
+        }
+
         foreach (var extension in InstalledMedia.supported_extensions)
             file_chooser.filter.add_pattern ("*" + extension);
 
diff --git a/src/wizard.vala b/src/wizard.vala
index 3c65b2b5..86d222b1 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -176,7 +176,7 @@ private void wizard_source_update_buttons () {
         switch (wizard_source.page) {
         case Boxes.SourcePage.MAIN:
             wizard_window.topbar.title = _("Create a Box");
-            next_button.sensitive = wizard_source.selected != null;
+            next_button.sensitive = window.first_run || wizard_source.selected != null;
             source = null;
             break;
 
@@ -694,7 +694,13 @@ public void setup_ui (AppWindow window, WizardWindow wizard_window) {
         });
         continue_button = wizard_window.topbar.continue_btn;
         continue_button.clicked.connect (() => {
-            page = page + 1;
+            if (window.first_run) {
+                continue_button.sensitive = window.first_run = false;
+
+                wizard_window.page = WizardWindowPage.MAIN;
+            } else {
+                page = page + 1;
+            }
         });
         next_button = continue_button;
         create_button = wizard_window.topbar.create_btn;


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