[gnome-boxes/nuke-old-wizard: 3/3] Nuke the old wizard



commit 6d743986bad96176313e048ae5a34b14ab5b070a
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Feb 26 16:34:29 2020 +0100

    Nuke the old wizard
    
    The new Assistant is in src/assistant/

 src/app-window.vala            |   5 -
 src/app.vala                   |   1 -
 src/assistant/index-page.vala  |  79 +++++
 src/assistant/review-page.vala |  53 +++
 src/meson.build                |   5 -
 src/wizard-downloads-page.vala |  97 -----
 src/wizard-source.vala         | 591 -------------------------------
 src/wizard-toolbar.vala        | 100 ------
 src/wizard-window.vala         | 213 -----------
 src/wizard.vala                | 786 -----------------------------------------
 10 files changed, 132 insertions(+), 1798 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index b3ed8cc5..6597a705 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -69,8 +69,6 @@
     public Notificationbar notificationbar {
         get {
             switch (ui_state) {
-            case UIState.WIZARD:
-                return wizard_window.notificationbar;
             case UIState.PROPERTIES:
                 return props_window.notificationbar;
             default:
@@ -79,7 +77,6 @@
         }
     }
 
-    public WizardWindow wizard_window;
     public PropertiesWindow  props_window;
 
     [GtkChild]
@@ -190,8 +187,6 @@ public void setup_ui () {
 
         group = new Gtk.WindowGroup ();
         group.add_window (this);
-        wizard_window = new WizardWindow (this);
-        group.add_window (wizard_window);
         props_window = new PropertiesWindow (this);
         group.add_window (props_window);
 
diff --git a/src/app.vala b/src/app.vala
index ae613deb..abbe9fbb 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -294,7 +294,6 @@ public override void shutdown () {
 
         foreach (var window in windows) {
             window.notificationbar.dismiss_all ();
-            window.wizard_window.wizard.cleanup ();
         }
         async_launcher.await_all ();
         suspend_machines ();
diff --git a/src/assistant/index-page.vala b/src/assistant/index-page.vala
index fdbe7ad0..b3e82b6f 100644
--- a/src/assistant/index-page.vala
+++ b/src/assistant/index-page.vala
@@ -168,3 +168,82 @@ private void on_download_an_os_button_clicked () {
         dialog.previous_button.label = _("Previous");
     }
 }
+
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-downloadable-entry.ui")]
+public class Boxes.WizardDownloadableEntry : Gtk.ListBoxRow {
+    public Osinfo.Os? os;
+
+    [GtkChild]
+    private Gtk.Image media_image;
+    [GtkChild]
+    private Gtk.Label title_label;
+    [GtkChild]
+    private Gtk.Label details_label;
+
+    public string title {
+        get { return title_label.get_text (); }
+        set {
+            title_label.label = value;
+            set_tooltip_text (value);
+        }
+    }
+
+    public string details {
+        get { return details_label.get_text (); }
+        set { details_label.label = value; }
+    }
+    public string url;
+
+    public WizardDownloadableEntry (Osinfo.Media media) {
+        this.from_os (media.os);
+
+        title = serialize_os_title (media);
+        details = media.os.vendor;
+
+        url = media.url;
+    }
+
+    public WizardDownloadableEntry.from_os (Osinfo.Os os) {
+        Downloader.fetch_os_logo.begin (media_image, os, 64);
+
+        this.os = os;
+    }
+}
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-media-entry.ui")]
+private class Boxes.WizardMediaEntry : Gtk.ListBoxRow {
+    public InstallerMedia media;
+
+    [GtkChild]
+    private Gtk.Image media_image;
+    [GtkChild]
+    private Gtk.Label title_label;
+    [GtkChild]
+    private Gtk.Label details_label;
+
+    public WizardMediaEntry (InstallerMedia media) {
+        this.media = media;
+
+        if (media.os != null)
+            Downloader.fetch_os_logo.begin (media_image, media.os, 64);
+
+        title_label.label = media.label;
+        if (media.os_media != null && media.os_media.live)
+            // Translators: We show 'Live' tag next or below the name of live OS media or box based on such 
media.
+            //              http://en.wikipedia.org/wiki/Live_CD
+            title_label.label += " (" +  _("Live") + ")";
+        set_tooltip_text (title_label.label);
+
+        if (media.os_media != null) {
+            var architecture = (media.os_media.architecture == "i386" || media.os_media.architecture == 
"i686") ?
+                               _("32-bit x86 system") :
+                               _("64-bit x86 system");
+            details_label.label = architecture;
+
+            if (media.os.vendor != null)
+                // Translator comment: %s is name of vendor here (e.g Canonical Ltd or Red Hat Inc)
+                details_label.label += _(" from %s").printf (media.os.vendor);
+        }
+    }
+}
diff --git a/src/assistant/review-page.vala b/src/assistant/review-page.vala
index cb8c3307..15c77182 100644
--- a/src/assistant/review-page.vala
+++ b/src/assistant/review-page.vala
@@ -122,3 +122,56 @@ public override async void next () {
         cancellable.reset ();
     }
 }
+
+
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-summary.ui")]
+private class Boxes.WizardSummary: Gtk.Grid {
+    public delegate void CustomizeFunc ();
+
+    private int current_row;
+
+    construct {
+        current_row = 0;
+    }
+
+    public void add_property (string name, string? value) {
+        if (value == null)
+            return;
+
+        var label_name = new Gtk.Label (name);
+        label_name.get_style_context ().add_class ("dim-label");
+        label_name.halign = Gtk.Align.END;
+        attach (label_name, 0, current_row, 1, 1);
+
+        var label_value = new Gtk.Label (value);
+        label_value.set_ellipsize (Pango.EllipsizeMode.END);
+        label_value.set_max_width_chars (32);
+        label_value.halign = Gtk.Align.START;
+        attach (label_value, 1, current_row, 1, 1);
+
+        current_row += 1;
+        show_all ();
+    }
+
+    public void append_customize_button (CustomizeFunc customize_func) {
+        // there is nothing to customize if review page is empty
+        if (current_row == 0)
+            return;
+
+        var button = new Gtk.Button.with_mnemonic (_("C_ustomize…"));
+        button.hexpand = true;
+        button.margin_top = 20;
+        attach (button, 0, current_row, 2, 1);
+        button.show ();
+
+        button.clicked.connect (() => { customize_func (); });
+    }
+
+    public void clear () {
+        foreach (var child in get_children ()) {
+            remove (child);
+        }
+
+        current_row = 0;
+    }
+}
diff --git a/src/meson.build b/src/meson.build
index 56e9874e..57a2ca28 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -108,11 +108,6 @@ vala_sources = [
   'ssh-display.vala',
   'welcome-tutorial.vala',
   'welcome-tutorial-page.vala',
-  'wizard-downloads-page.vala',
-  'wizard-window.vala',
-  'wizard-source.vala',
-  'wizard-toolbar.vala',
-  'wizard.vala',
   'downloader.vala',
   'empty-boxes.vala',
   'tracker-iso-query.vala',


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