[gnome-boxes/simplify-assistant-landing-page: 57/64] assistant: Redesign starting page




commit d713dc48d1047dfa71da3c878dbbed661a6e01ad
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Jan 21 17:50:59 2022 +0100

    assistant: Redesign starting page
    
    This gives more emphasis to the most used buttons. This also allows
    the dialog window size to be reduced and resized to fit small
    displays.

 data/gtk-style.css                        |   6 ++
 data/ui/assistant/pages/downloads-page.ui |   7 +-
 data/ui/assistant/pages/index-page.ui     | 162 ++++++++++++++++--------------
 data/ui/assistant/vm-assistant.ui         |   4 +-
 src/app-window.vala                       |   2 +-
 src/assistant/downloads-page.vala         |   2 +
 src/assistant/index-page.vala             |   9 ++
 7 files changed, 112 insertions(+), 80 deletions(-)
---
diff --git a/data/gtk-style.css b/data/gtk-style.css
index 02bb23b0..1fa4529f 100644
--- a/data/gtk-style.css
+++ b/data/gtk-style.css
@@ -13,6 +13,12 @@
     background: black;
 }
 
+/* This replaces a separator between the recommended
+ * OS list and the buttons at the bottom. */
+.index-stack {
+    border-bottom: 1px solid @borders;
+}
+
 .boxes-product-key-entry {
     font-family: monospace;
 }
diff --git a/data/ui/assistant/pages/downloads-page.ui b/data/ui/assistant/pages/downloads-page.ui
index 6a621926..d49d5149 100644
--- a/data/ui/assistant/pages/downloads-page.ui
+++ b/data/ui/assistant/pages/downloads-page.ui
@@ -5,10 +5,8 @@
     <signal name="key-press-event" handler="on_key_pressed"/>
 
     <child>
-      <object class="GtkBox">
+      <object class="GtkScrolledWindow">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="border-width">20</property>
         <property name="margin-start">20</property>
         <property name="margin-end">20</property>
 
@@ -17,6 +15,7 @@
             <property name="visible">True</property>
             <property name="vexpand">True</property>
             <property name="selection-mode">none</property>
+            <property name="margin">20</property>
             <signal name="row-activated" handler="on_listbox_row_activated"/>
             <style>
               <class name="content"/>
@@ -30,7 +29,7 @@
     </child>
 
     <child>
-      <object class="GtkScrolledWindow">
+      <object class="GtkScrolledWindow" id="scrolled_window">
         <property name="visible">True</property>
         <property name="expand">True</property>
 
diff --git a/data/ui/assistant/pages/index-page.ui b/data/ui/assistant/pages/index-page.ui
index ba0405a5..97717ec6 100644
--- a/data/ui/assistant/pages/index-page.ui
+++ b/data/ui/assistant/pages/index-page.ui
@@ -5,107 +5,77 @@
     <property name="title" translatable="yes">Create a Virtual Machine</property>
 
     <child>
-      <object class="GtkStack" id="stack">
+      <object class="GtkBox">
         <property name="visible">True</property>
-        <signal name="notify::visible-child" handler="update_topbar"/>
+        <property name="orientation">vertical</property>
 
         <child>
-          <object class="GtkScrolledWindow" id="home_page">
+          <object class="GtkStack" id="stack">
             <property name="visible">True</property>
-            <property name="expand">True</property>
-            <property name="hscrollbar-policy">never</property>
+            <signal name="notify::visible-child" handler="update_topbar"/>
+            <style>
+              <class name="index-stack"/>
+            </style>
 
             <child>
-              <object class="GtkBox">
+              <object class="GtkScrolledWindow" id="home_page">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">30</property>
-                <property name="halign">center</property>
-                <property name="border-width">20</property>
-                <property name="margin-left">30</property>
-                <property name="margin-right">30</property>
+                <property name="hexpand">True</property>
+                <property name="min-content-height">420</property>
+                <property name="hscrollbar-policy">never</property>
 
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="wrap">True</property>
-                    <property name="max-width-chars">60</property>
-                    <property name="xalign">0</property>
-                    <property name="halign">start</property>
-                    <property name="label" translatable="yes">A new virtual machine will be created and an 
operating system installed into it. Select an operating system source to begin.</property>
-                  </object>
-                </child>
-
-                <child>
-                  <object class="HdyPreferencesGroup" id="detected_sources_section">
-                    <property name="visible">True</property>
-                    <property name="title" translatable="yes">Detected Sources</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">20</property>
+                    <property name="border-width">20</property>
 
                     <child>
-                      <object class="GtkListBox" id="source_medias">
+                      <object class="GtkLabel">
                         <property name="visible">True</property>
-                        <property name="selection-mode">none</property>
-                        <signal name="row-activated" handler="on_source_media_selected"/>
+                        <property name="wrap">True</property>
+                        <property name="max-width-chars">60</property>
+                        <property name="xalign">0</property>
+                        <property name="halign">start</property>
+                        <property name="label" translatable="yes">Select an operating system source to 
begin.</property>
                         <style>
-                          <class name="content"/>
+                          <class name="dim-label"/>
                         </style>
                       </object>
                     </child>
-                  </object>
-                </child>
-
-                <child>
-                  <object class="HdyPreferencesGroup">
-                    <property name="visible">True</property>
-                    <property name="title" translatable="yes">Featured Downloads</property>
-                    <property name="description" translatable="yes">You will be notified when the download 
has completed.</property>
 
                     <child>
-                      <object class="GtkListBox" id="featured_medias">
+                      <object class="HdyPreferencesGroup" id="detected_sources_section">
                         <property name="visible">True</property>
-                        <signal name="row-activated" handler="on_featured_media_selected"/>
-                        <style>
-                          <class name="content"/>
-                        </style>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-
-                <child>
-                  <object class="HdyPreferencesGroup">
-                    <property name="visible">True</property>
-                    <property name="title" translatable="yes">Select an OS Source</property>
-
-                    <child>
-                      <object class="HdyActionRow">
-                        <property name="visible">True</property>
-                        <property name="activatable">True</property>
-                        <property name="title" translatable="yes">Operating System Download</property>
-                        <property name="subtitle" translatable="yes">Browse and search for operating systems 
to install.</property>
-                        <signal name="activated" handler="on_download_an_os_button_clicked"/>
+                        <property name="title" translatable="yes">Detected Sources</property>
 
                         <child>
-                          <object class="GtkImage">
+                          <object class="GtkListBox" id="source_medias">
                             <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
-                           </object>
+                            <property name="selection-mode">none</property>
+                            <signal name="row-activated" handler="on_source_media_selected"/>
+                            <style>
+                              <class name="content"/>
+                            </style>
+                          </object>
                         </child>
                       </object>
                     </child>
 
                     <child>
-                      <object class="HdyActionRow">
+                      <object class="HdyPreferencesGroup">
                         <property name="visible">True</property>
-                        <property name="activatable">True</property>
-                        <property name="title" translatable="yes">Operating System Image File</property>
-                        <property name="subtitle" translatable="yes">Select a file to install a virtual 
machine.</property>
-                        <signal name="activated" handler="on_select_file_button_clicked"/>
+                        <property name="title" translatable="yes">Featured Downloads</property>
+                        <property name="description" translatable="yes">You will be notified when the 
download has completed.</property>
 
                         <child>
-                          <object class="GtkImage">
+                          <object class="GtkListBox" id="featured_medias">
                             <property name="visible">True</property>
-                            <property name="icon-name">go-next-symbolic</property>
+                            <signal name="row-activated" handler="on_featured_media_selected"/>
+                            <style>
+                              <class name="content"/>
+                            </style>
                           </object>
                         </child>
                       </object>
@@ -114,18 +84,64 @@
                 </child>
               </object>
             </child>
+
+            <child>
+              <object class="BoxesAssistantDownloadsPage" id="recommended_downloads_page">
+                <property name="visible">True</property>
+                <signal name="media-selected" handler="on_featured_media_selected"/>
+              </object>
+            </child>
           </object>
         </child>
 
         <child>
-          <object class="BoxesAssistantDownloadsPage" id="recommended_downloads_page">
+          <object class="GtkRevealer" id="panel_revealer">
             <property name="visible">True</property>
-            <signal name="media-selected" handler="on_featured_media_selected"/>
+            <property name="reveal-child">True</property>
+
+            <child>
+              <object class="HdyPreferencesGroup" id="button_panel">
+                <property name="visible">True</property>
+                <property name="margin">20</property>
+
+                <child>
+                  <object class="HdyActionRow">
+                    <property name="visible">True</property>
+                    <property name="activatable">True</property>
+                    <property name="title" translatable="yes">Operating System Download</property>
+                    <property name="subtitle" translatable="yes">Browse and search for operating systems to 
install.</property>
+                    <signal name="activated" handler="on_download_an_os_button_clicked"/>
+
+                    <child>
+                      <object class="GtkImage">
+                        <property name="visible">True</property>
+                        <property name="icon-name">go-next-symbolic</property>
+                       </object>
+                    </child>
+                  </object>
+                </child>
+
+                <child>
+                  <object class="HdyActionRow">
+                    <property name="visible">True</property>
+                    <property name="activatable">True</property>
+                    <property name="title" translatable="yes">Operating System Image File</property>
+                    <property name="subtitle" translatable="yes">Select a file to install a virtual 
machine.</property>
+                    <signal name="activated" handler="on_select_file_button_clicked"/>
+
+                    <child>
+                      <object class="GtkImage">
+                        <property name="visible">True</property>
+                        <property name="icon-name">go-next-symbolic</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
         </child>
-
       </object>
     </child>
-
   </template>
 </interface>
diff --git a/data/ui/assistant/vm-assistant.ui b/data/ui/assistant/vm-assistant.ui
index f178e100..20ed15f1 100644
--- a/data/ui/assistant/vm-assistant.ui
+++ b/data/ui/assistant/vm-assistant.ui
@@ -2,10 +2,10 @@
 <interface>
   <template class="BoxesVMAssistant" parent="GtkDialog">
     <property name="modal">True</property>
+    <property name="resizable">True</property>
     <property name="type-hint">dialog</property>
     <property name="title" translatable="yes">Create a Virtual Machine</property>
-    <property name="width-request">724</property>
-    <property name="height-request">568</property>
+    <property name="width-request">500</property>
     <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
 
     <child internal-child="vbox">
diff --git a/src/app-window.vala b/src/app-window.vala
index 482081c0..c7b17eb1 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -256,7 +256,7 @@ private void ui_state_changed () {
     }
 
     public void show_vm_assistant (string? path = null) {
-        new Boxes.VMAssistant (this, path).run ();
+        new Boxes.VMAssistant (this, path).present ();
     }
 
     public void show_welcome_tutorial () {
diff --git a/src/assistant/downloads-page.vala b/src/assistant/downloads-page.vala
index 5124e93a..ce8fe2c3 100644
--- a/src/assistant/downloads-page.vala
+++ b/src/assistant/downloads-page.vala
@@ -11,6 +11,8 @@
     private OSDatabase os_db = new OSDatabase ();
     public DownloadsSearch search { private set; get; }
 
+    [GtkChild]
+    public unowned Gtk.ScrolledWindow scrolled_window;
     [GtkChild]
     private unowned Gtk.ListBox listbox;
     [GtkChild]
diff --git a/src/assistant/index-page.vala b/src/assistant/index-page.vala
index 9c4a31af..b94701a8 100644
--- a/src/assistant/index-page.vala
+++ b/src/assistant/index-page.vala
@@ -23,6 +23,8 @@
     private unowned ListBox source_medias;
     [GtkChild]
     private unowned ListBox featured_medias;
+    [GtkChild]
+    private unowned Revealer panel_revealer;
 
     private Gtk.Button view_more_medias_button;
 
@@ -44,6 +46,11 @@
         view_more_medias_button.clicked.connect (on_expand_detected_sources_list);
         view_more_medias_button.get_style_context ().add_class ("flat");
         source_medias.add (view_more_medias_button);
+
+        home_page.bind_property ("min-content-height",
+                                 recommended_downloads_page.scrolled_window,
+                                 "min-content-height",
+                                 BindingFlags.SYNC_CREATE);
     }
 
     public void setup (VMAssistant dialog) {
@@ -106,8 +113,10 @@ private void update_topbar () {
         var titlebar = dialog.get_titlebar () as Gtk.HeaderBar;
         if (stack.visible_child == recommended_downloads_page) {
             titlebar.set_custom_title (recommended_downloads_page.search_entry);
+            panel_revealer.set_reveal_child (false);
         } else {
             titlebar.set_custom_title (null);
+            panel_revealer.set_reveal_child (true);
         }
     }
 


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