[gnome-boxes] assistant: Show a spinner while populating review page



commit 28f921973ad5b05e6e39823a4d9e394c231c42f1
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Feb 11 12:02:38 2022 +0100

    assistant: Show a spinner while populating review page
    
    The review page can be a bit slow while populating because it
    queries for ISO metadata and other info that can't be fairly
    obtained in a sync call. So let's show a spinner instead of
    showing the page in a broken state.

 data/ui/assistant/pages/review-page.ui | 126 ++++++++++++++++++---------------
 src/assistant/review-page.vala         |   9 +++
 2 files changed, 78 insertions(+), 57 deletions(-)
---
diff --git a/data/ui/assistant/pages/review-page.ui b/data/ui/assistant/pages/review-page.ui
index 66a098e7..5a115b62 100644
--- a/data/ui/assistant/pages/review-page.ui
+++ b/data/ui/assistant/pages/review-page.ui
@@ -55,90 +55,102 @@ Check your BIOS settings to enable them.</property>
     </child>
 
     <child>
-      <object class="GtkListBox">
+      <object class="GtkStack" id="stack">
         <property name="visible">True</property>
-        <property name="selection-mode">none</property>
-        <style>
-          <class name="content"/>
-        </style>
-
         <child>
-          <object class="HdyActionRow" id="os_row">
-            <property name="activatable">False</property>
-            <property name="title" translatable="yes">Operating System</property>
-
-            <child>
-              <object class="GtkLabel" id="os_label">
-                <property name="visible">True</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-            </child>
-          </object>
-        </child>
-
-        <child>
-          <object class="BoxesRamRow" id="ram_row">
+          <object class="GtkSpinner" id="spinner">
             <property name="visible">True</property>
-            <property name="title" translatable="yes">Memory</property>
+            <property name="active">True</property>
           </object>
         </child>
 
         <child>
-          <object class="BoxesStorageRow" id="storage_row">
+          <object class="GtkListBox" id="listbox">
             <property name="visible">True</property>
-            <property name="title" translatable="yes">Storage limit</property>
-          </object>
-        </child>
+            <property name="selection-mode">none</property>
+            <style>
+              <class name="content"/>
+            </style>
 
-        <child>
-          <object class="HdyActionRow" id="unattended_username_row">
-            <property name="title" translatable="yes">Username</property>
+            <child>
+              <object class="HdyActionRow" id="os_row">
+                <property name="activatable">False</property>
+                <property name="title" translatable="yes">Operating System</property>
+
+                <child>
+                  <object class="GtkLabel" id="os_label">
+                    <property name="visible">True</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                </child>
+              </object>
+            </child>
 
             <child>
-              <object class="GtkLabel" id="username_label">
+              <object class="BoxesRamRow" id="ram_row">
                 <property name="visible">True</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-
+                <property name="title" translatable="yes">Memory</property>
               </object>
             </child>
-          </object>
-        </child>
-
-        <child>
-          <object class="HdyActionRow" id="unattended_password_row">
-            <property name="title" translatable="yes">Password</property>
 
             <child>
-              <object class="GtkLabel" id="password_label">
+              <object class="BoxesStorageRow" id="storage_row">
                 <property name="visible">True</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
+                <property name="title" translatable="yes">Storage limit</property>
+              </object>
+            </child>
 
+            <child>
+              <object class="HdyActionRow" id="unattended_username_row">
+                <property name="title" translatable="yes">Username</property>
+
+                <child>
+                  <object class="GtkLabel" id="username_label">
+                    <property name="visible">True</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+
+                  </object>
+                </child>
               </object>
             </child>
-          </object>
-        </child>
 
-        <child>
-          <object class="HdyActionRow" id="uefi_row">
-            <property name="visible">False</property>
-            <property name="title" translatable="yes">Enable EFI</property>
+            <child>
+              <object class="HdyActionRow" id="unattended_password_row">
+                <property name="title" translatable="yes">Password</property>
+
+                <child>
+                  <object class="GtkLabel" id="password_label">
+                    <property name="visible">True</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+
+                  </object>
+                </child>
+              </object>
+            </child>
 
             <child>
-              <object class="GtkSwitch" id="uefi_switch">
-                <property name="visible">True</property>
-                <property name="valign">center</property>
-                <signal name="notify::active" handler="on_uefi_switch_toggled"/>
+              <object class="HdyActionRow" id="uefi_row">
+                <property name="visible">False</property>
+                <property name="title" translatable="yes">Enable EFI</property>
+
+                <child>
+                  <object class="GtkSwitch" id="uefi_switch">
+                    <property name="visible">True</property>
+                    <property name="valign">center</property>
+                    <signal name="notify::active" handler="on_uefi_switch_toggled"/>
+                  </object>
+                </child>
               </object>
             </child>
+
           </object>
         </child>
-
       </object>
     </child>
   </template>
diff --git a/src/assistant/review-page.vala b/src/assistant/review-page.vala
index 76a170da..f449a53d 100644
--- a/src/assistant/review-page.vala
+++ b/src/assistant/review-page.vala
@@ -6,6 +6,12 @@
     [GtkChild]
     private unowned Gtk.InfoBar nokvm_infobar;
     [GtkChild]
+    private unowned Gtk.Stack stack;
+    [GtkChild]
+    private unowned Gtk.Spinner spinner;
+    [GtkChild]
+    private unowned Gtk.ListBox listbox;
+    [GtkChild]
     private unowned Hdy.ActionRow os_row;
     [GtkChild]
     private unowned Gtk.Label os_label;
@@ -67,6 +73,9 @@ public async void populate (LibvirtMachine machine) {
         if (App.app.supports_uefi_installs ()) {
             uefi_row.visible = install_media.supports_efi && !install_media.requires_efi;
         }
+
+        stack.set_visible_child (listbox);
+        spinner.stop ();
     }
 
     [GtkCallback]


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