From 957257ff68873cb023e842ebe26450808462485d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 12 Sep 2024 12:38:14 -0700 Subject: [PATCH 1/9] MainWindow: use Adw.NavigationView --- src/MainWindow.vala | 105 ++++++++++----------------- src/Views/AbstractInstallerView.vala | 1 + src/Views/CheckView.vala | 2 - src/Views/DriversView.vala | 2 - src/Views/KeyboardLayoutView.vala | 2 +- src/Views/LanguageView.vala | 2 - src/Views/PartitioningView.vala | 2 - src/Views/TryInstallView.vala | 1 - 8 files changed, 40 insertions(+), 77 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 2faf178f8..9555a047c 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -29,7 +29,7 @@ public class Installer.MainWindow : Gtk.Window { private const uint64 MINIMUM_SPACE = 15 * ONE_GB; private Gtk.Label infobar_label; - private Adw.Leaflet leaflet; + private Adw.NavigationView navigation_view; private LanguageView language_view; private TryInstallView try_install_view; private bool check_ignored = false; @@ -38,12 +38,8 @@ public class Installer.MainWindow : Gtk.Window { construct { language_view = new LanguageView (); - leaflet = new Adw.Leaflet () { - can_navigate_back = true, - can_unfold = false, - homogeneous = false - }; - leaflet.append (language_view); + navigation_view = new Adw.NavigationView (); + navigation_view.add (language_view); infobar_label = new Gtk.Label ("") { use_markup = true @@ -63,7 +59,7 @@ public class Installer.MainWindow : Gtk.Window { battery_infobar.add_css_class (Granite.STYLE_CLASS_FRAME); var overlay = new Gtk.Overlay () { - child = leaflet + child = navigation_view }; overlay.add_overlay (battery_infobar); @@ -128,136 +124,111 @@ public class Installer.MainWindow : Gtk.Window { return Source.REMOVE; }); - - leaflet.notify["visible-child"].connect (() => { - update_navigation (); - }); - - leaflet.notify["child-transition-running"].connect (() => { - update_navigation (); - }); - } - - private void update_navigation () { - if (!leaflet.child_transition_running) { - // We need to rebuild the views to reflect language changes and forking paths - if (leaflet.visible_child == language_view || leaflet.visible_child == try_install_view) { - while (leaflet.get_adjacent_child (FORWARD) != null) { - leaflet.remove (leaflet.get_adjacent_child (FORWARD)); - } - } - } } private void load_keyboard_view () { var keyboard_layout_view = new KeyboardLayoutView (); try_install_view = new TryInstallView (); - leaflet.append (keyboard_layout_view); - leaflet.append (try_install_view); + navigation_view.push (keyboard_layout_view); - leaflet.visible_child = keyboard_layout_view; + keyboard_layout_view.next_step.connect (() => { + navigation_view.push (try_install_view); + }); try_install_view.custom_step.connect (() => { - load_check_view (); - load_partitioning_view (); - load_drivers_view (); - leaflet.navigate (FORWARD); + load_check_view ("custom"); }); try_install_view.next_step.connect (() => { - load_check_view (); - load_disk_view (); - load_encrypt_view (); - load_drivers_view (); - leaflet.navigate (FORWARD); + load_check_view ("standard"); }); } private void load_disk_view () { var disk_view = new DiskView (); - leaflet.append (disk_view); + navigation_view.push (disk_view); disk_view.load.begin (MINIMUM_SPACE); - disk_view.cancel.connect (() => leaflet.navigate (BACK)); + disk_view.cancel.connect (() => navigation_view.pop ()); + disk_view.next_step.connect (() => load_encrypt_view ()); } - private void load_check_view () { + private void load_check_view (string path) { if (check_ignored) { return; } var check_view = new Installer.CheckView (); if (check_view.has_messages) { - leaflet.append (check_view); + navigation_view.push (check_view); } - check_view.cancel.connect (() => leaflet.navigate (BACK)); + check_view.cancel.connect (() => navigation_view.pop ()); check_view.next_step.connect (() => { check_ignored = true; - leaflet.navigate (FORWARD); + + if (path == "custom") { + load_partitioning_view (); + } else if (path == "standard") { + load_disk_view (); + } }); } private void load_encrypt_view () { var encrypt_view = new EncryptView (); - leaflet.append (encrypt_view); + encrypt_view.cancel.connect (() => navigation_view.pop ()); + encrypt_view.next_step.connect (load_drivers_view); - encrypt_view.cancel.connect (() => { - leaflet.visible_child = try_install_view; - }); + navigation_view.push (encrypt_view); } private void load_partitioning_view () { var partitioning_view = new PartitioningView (MINIMUM_SPACE); - leaflet.append (partitioning_view); + navigation_view.push (partitioning_view); partitioning_view.next_step.connect (() => { unowned Configuration config = Configuration.get_default (); config.luks = (owned) partitioning_view.luks; config.mounts = (owned) partitioning_view.mounts; - leaflet.navigate (FORWARD); + load_drivers_view (); }); } private void load_drivers_view () { var drivers_view = new DriversView (); - leaflet.append (drivers_view); - drivers_view.next_step.connect (() => load_progress_view ()); + + navigation_view.push (drivers_view); } private void load_progress_view () { var progress_view = new ProgressView (); - leaflet.append (progress_view); - leaflet.visible_child = progress_view; - leaflet.can_navigate_back = false; - - progress_view.on_success.connect (() => load_success_view ()); + progress_view.on_success.connect (() => { + navigation_view.push (new SuccessView ()); + }); progress_view.on_error.connect (() => { load_error_view (progress_view.get_log ()); }); progress_view.start_installation (); - } - private void load_success_view () { - var success_view = new SuccessView (); - leaflet.append (success_view); - leaflet.visible_child = success_view; + navigation_view.push (progress_view); + navigation_view.can_navigate_back = false; } private void load_error_view (string log) { var error_view = new ErrorView (log); - leaflet.append (error_view); - leaflet.visible_child = error_view; error_view.retry_install.connect (() => { - leaflet.visible_child = try_install_view; - leaflet.can_navigate_back = true; + navigation_view.pop_to_page (try_install_view); + navigation_view.can_swipe_back = true; }); + + navigation_view.push (error_view); } private void set_infobar_string () { diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index 7ffb33f9e..4120aa981 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -7,6 +7,7 @@ public abstract class AbstractInstallerView : Adw.NavigationPage { public bool cancellable { get; construct; } public signal void cancel (); + public signal void next_step (); protected Gtk.Box title_area; protected Gtk.Box content_area; diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 9f2ac71af..45755df05 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -25,8 +25,6 @@ public class Installer.CheckView : AbstractInstallerView { // Minimum 1GB public const uint64 MINIMUM_MEMORY = 1 * ONE_GB; - public signal void next_step (); - private Gtk.Box message_box; public bool has_messages { get { diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index c9cc4d94b..78c35b65a 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -16,8 +16,6 @@ */ public class DriversView : AbstractInstallerView { - public signal void next_step (); - construct { var image = new Gtk.Image.from_icon_name ("application-x-firmware") { pixel_size = 128 diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 1efe77301..9bdae8ef0 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -92,7 +92,7 @@ public class KeyboardLayoutView : AbstractInstallerView { return; } - ((Adw.Leaflet) get_parent ()).navigate (FORWARD); + next_step (); }); input_variant_widget.main_listbox.row_activated.connect ((row) => { diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 1b881241e..c25bfea0b 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -27,8 +27,6 @@ public class Installer.LanguageView : AbstractInstallerView { private VariantWidget lang_variant_widget; - public signal void next_step (); - public LanguageView () { lang_timeout = GLib.Timeout.add_seconds (3, timeout); } diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 1400e4eab..842d06dde 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -19,8 +19,6 @@ */ public class Installer.PartitioningView : AbstractInstallerView { - public signal void next_step (); - private Gtk.Button next_button; private Gtk.Button modify_partitions_button; private Gtk.Box disk_list; diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index ef3f09fe6..416be271f 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -17,7 +17,6 @@ public class Installer.TryInstallView : AbstractInstallerView { public signal void custom_step (); - public signal void next_step (); construct { var type_image = new Gtk.Image.from_icon_name (Application.get_default ().application_id) { From 6adfc8f74121f52e02cdbb038c4de787fc9cd19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 12 Sep 2024 13:07:27 -0700 Subject: [PATCH 2/9] Fix all the stuff --- src/MainWindow.vala | 40 +++++++++++++++++++++++-------- src/Views/DiskView.vala | 2 +- src/Views/DriversView.vala | 2 +- src/Views/EncryptView.vala | 2 +- src/Views/KeyboardLayoutView.vala | 2 +- src/Views/PartitioningView.vala | 2 +- src/Views/TryInstallView.vala | 2 +- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 9555a047c..9d982c1fd 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -32,6 +32,7 @@ public class Installer.MainWindow : Gtk.Window { private Adw.NavigationView navigation_view; private LanguageView language_view; private TryInstallView try_install_view; + private KeyboardLayoutView keyboard_layout_view; private bool check_ignored = false; private uint orca_timeout_id = 0; @@ -127,7 +128,7 @@ public class Installer.MainWindow : Gtk.Window { } private void load_keyboard_view () { - var keyboard_layout_view = new KeyboardLayoutView (); + keyboard_layout_view = new KeyboardLayoutView (); try_install_view = new TryInstallView (); navigation_view.push (keyboard_layout_view); @@ -160,10 +161,6 @@ public class Installer.MainWindow : Gtk.Window { } var check_view = new Installer.CheckView (); - if (check_view.has_messages) { - navigation_view.push (check_view); - } - check_view.cancel.connect (() => navigation_view.pop ()); check_view.next_step.connect (() => { @@ -175,6 +172,12 @@ public class Installer.MainWindow : Gtk.Window { load_disk_view (); } }); + + if (check_view.has_messages) { + navigation_view.push (check_view); + } else { + check_view.next_step (); + } } private void load_encrypt_view () { @@ -208,24 +211,41 @@ public class Installer.MainWindow : Gtk.Window { var progress_view = new ProgressView (); progress_view.on_success.connect (() => { - navigation_view.push (new SuccessView ()); + var success_view = new SuccessView (); + navigation_view.push (success_view); + + success_view.shown.connect (() => { + navigation_view.replace ({ success_view }); + }); }); progress_view.on_error.connect (() => { load_error_view (progress_view.get_log ()); }); - progress_view.start_installation (); + + progress_view.shown.connect (() => { + navigation_view.replace ({ progress_view }); + }); navigation_view.push (progress_view); - navigation_view.can_navigate_back = false; + progress_view.start_installation (); } private void load_error_view (string log) { var error_view = new ErrorView (log); error_view.retry_install.connect (() => { - navigation_view.pop_to_page (try_install_view); - navigation_view.can_swipe_back = true; + navigation_view.replace ({ + language_view, + keyboard_layout_view, + try_install_view, + error_view + }); + navigation_view.pop (); + }); + + error_view.shown.connect (() => { + navigation_view.replace ({ error_view }); }); navigation_view.push (error_view); diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index 6d92fa70a..b5aab7522 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -100,7 +100,7 @@ public class Installer.DiskView : AbstractInstallerView { sensitive = Installer.App.test_mode }; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD)); + next_button.clicked.connect (() => next_step ()); action_box_end.append (next_button); } diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 78c35b65a..4f1dfe2a9 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -74,7 +74,7 @@ content_area.append (message_box); var back_button = new Gtk.Button.with_label (_("Back")); - back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); var next_button = new Gtk.Button.with_label (_("Erase and Install")); next_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 9694527c5..8022fefec 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -182,7 +182,7 @@ public class EncryptView : AbstractInstallerView { Configuration.get_default ().encryption_password = pw_entry.text; } - ((Adw.Leaflet) get_parent ()).navigate (FORWARD); + next_step (); }); pw_entry.changed.connect (() => { diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 9bdae8ef0..9ccdb0efa 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -66,7 +66,7 @@ public class KeyboardLayoutView : AbstractInstallerView { next_button.activate (); }); - back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); next_button.clicked.connect (() => { unowned Gtk.ListBoxRow row = input_variant_widget.main_listbox.get_selected_row (); diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 842d06dde..404a98b4d 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -148,7 +148,7 @@ public class Installer.PartitioningView : AbstractInstallerView { action_box_end.append (back_button); action_box_end.append (next_button); - back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); next_button.clicked.connect (() => next_step ()); } diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index 416be271f..c3bd9e811 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -86,7 +86,7 @@ public class Installer.TryInstallView : AbstractInstallerView { action_box_end.append (back_button); action_box_end.append (next_button); - back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); demo_button.toggled.connect (() => { if (demo_button.active) { From 77f04d1b9c5a41f660ed6316344808b025505038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 12 Sep 2024 13:16:39 -0700 Subject: [PATCH 3/9] Fix skipping check view --- src/MainWindow.vala | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 9d982c1fd..383ecab65 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -138,11 +138,19 @@ public class Installer.MainWindow : Gtk.Window { }); try_install_view.custom_step.connect (() => { - load_check_view ("custom"); + if (check_ignored) { + load_partitioning_view (); + } else { + load_check_view ("custom"); + } }); try_install_view.next_step.connect (() => { - load_check_view ("standard"); + if (check_ignored) { + load_disk_view (); + } else { + load_check_view ("standard"); + } }); } @@ -156,10 +164,6 @@ public class Installer.MainWindow : Gtk.Window { } private void load_check_view (string path) { - if (check_ignored) { - return; - } - var check_view = new Installer.CheckView (); check_view.cancel.connect (() => navigation_view.pop ()); @@ -176,7 +180,11 @@ public class Installer.MainWindow : Gtk.Window { if (check_view.has_messages) { navigation_view.push (check_view); } else { - check_view.next_step (); + if (path == "custom") { + load_partitioning_view (); + } else if (path == "standard") { + load_disk_view (); + } } } From cffb6002738801dda937eaca97c4a5f596299484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 12 Sep 2024 13:20:38 -0700 Subject: [PATCH 4/9] Update installer.metainfo.xml.in --- data/installer.metainfo.xml.in | 1 + 1 file changed, 1 insertion(+) diff --git a/data/installer.metainfo.xml.in b/data/installer.metainfo.xml.in index 8b4a569f6..648db544d 100644 --- a/data/installer.metainfo.xml.in +++ b/data/installer.metainfo.xml.in @@ -65,6 +65,7 @@ Screen Reader ignores each view’s title text + Clicking a partition in the custom install glitches the installer window From 1bbac23da44e122faed8686fe915ac19c85401df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 13 Sep 2024 05:43:06 -0700 Subject: [PATCH 5/9] Update installer.metainfo.xml.in --- data/installer.metainfo.xml.in | 1 - 1 file changed, 1 deletion(-) diff --git a/data/installer.metainfo.xml.in b/data/installer.metainfo.xml.in index 648db544d..8b4a569f6 100644 --- a/data/installer.metainfo.xml.in +++ b/data/installer.metainfo.xml.in @@ -65,7 +65,6 @@ Screen Reader ignores each view’s title text - Clicking a partition in the custom install glitches the installer window From f09b5cb0c2c9a64e62d6dee4264ef62f94d481f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 25 Sep 2024 09:15:14 -0700 Subject: [PATCH 6/9] Don't get ancestor, use action --- src/MainWindow.vala | 9 ++++++++- src/Views/DriversView.vala | 5 +++-- src/Views/KeyboardLayoutView.vala | 6 +++--- src/Views/PartitioningView.vala | 5 +++-- src/Views/TryInstallView.vala | 6 +++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 383ecab65..7c3350094 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -22,7 +22,7 @@ public interface UPower : GLib.Object { public abstract bool on_battery { owned get; set; } } -public class Installer.MainWindow : Gtk.Window { +public class Installer.MainWindow : Gtk.ApplicationWindow { // We have to do it step by step because the vala compiler has overflows with big numbers. private const uint64 ONE_GB = 1000 * 1000 * 1000; // Minimum 15 GB @@ -67,6 +67,13 @@ public class Installer.MainWindow : Gtk.Window { child = overlay; titlebar = new Gtk.Grid () { visible = false }; + var back_action = new SimpleAction ("back", null); + back_action.activate.connect (() => { + navigation_view.pop (); + }); + + add_action (back_action); + language_view.next_step.connect (() => { // Don't prompt for screen reader if we're able to navigate without it if (orca_timeout_id != 0) { diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 0604889a9..af20ee9a2 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -72,8 +72,9 @@ content_area.append (message_box); - var back_button = new Gtk.Button.with_label (_("Back")); - back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); + var back_button = new Gtk.Button.with_label (_("Back")) { + action_name = "win.back" + }; var next_button = new Gtk.Button.with_label (_("Erase and Install")); next_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 9ccdb0efa..dc68a6e0e 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -52,7 +52,9 @@ public class KeyboardLayoutView : AbstractInstallerView { content_area.append (stack_box); - var back_button = new Gtk.Button.with_label (_("Back")); + var back_button = new Gtk.Button.with_label (_("Back")) { + action_name = "win.back" + }; var next_button = new Gtk.Button.with_label (_("Select")) { sensitive = false @@ -66,8 +68,6 @@ public class KeyboardLayoutView : AbstractInstallerView { next_button.activate (); }); - back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); - next_button.clicked.connect (() => { unowned Gtk.ListBoxRow row = input_variant_widget.main_listbox.get_selected_row (); if (row != null) { diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index aa51170b9..7e25cf20f 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -138,7 +138,9 @@ public class Installer.PartitioningView : AbstractInstallerView { modify_partitions_button = new Gtk.Button.with_label (_("Modify Partitions…")); modify_partitions_button.clicked.connect (() => open_partition_editor ()); - var back_button = new Gtk.Button.with_label (_("Back")); + var back_button = new Gtk.Button.with_label (_("Back")) { + action_name = "win.back" + }; next_button = new Gtk.Button.with_label (_("Next")); next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); @@ -148,7 +150,6 @@ public class Installer.PartitioningView : AbstractInstallerView { action_box_end.append (back_button); action_box_end.append (next_button); - back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); next_button.clicked.connect (() => next_step ()); } diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index c3bd9e811..f6e0e938d 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -76,7 +76,9 @@ public class Installer.TryInstallView : AbstractInstallerView { content_area.append (type_scrolled); - var back_button = new Gtk.Button.with_label (_("Back")); + var back_button = new Gtk.Button.with_label (_("Back")) { + action_name = "win.back" + }; var next_button = new Gtk.Button.with_label (_("Next")) { sensitive = false @@ -86,8 +88,6 @@ public class Installer.TryInstallView : AbstractInstallerView { action_box_end.append (back_button); action_box_end.append (next_button); - back_button.clicked.connect (() => ((Adw.NavigationView) get_parent ()).pop ()); - demo_button.toggled.connect (() => { if (demo_button.active) { next_button.label = demo_button.title; From 1fe7b3e6c5ba939959b028d68bec3d704c65669d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 25 Sep 2024 09:19:46 -0700 Subject: [PATCH 7/9] Cancel use back action --- src/MainWindow.vala | 3 --- src/Views/AbstractInstallerView.vala | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 7c3350094..6cf35461f 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -166,13 +166,11 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { navigation_view.push (disk_view); disk_view.load.begin (MINIMUM_SPACE); - disk_view.cancel.connect (() => navigation_view.pop ()); disk_view.next_step.connect (() => load_encrypt_view ()); } private void load_check_view (string path) { var check_view = new Installer.CheckView (); - check_view.cancel.connect (() => navigation_view.pop ()); check_view.next_step.connect (() => { check_ignored = true; @@ -197,7 +195,6 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { private void load_encrypt_view () { var encrypt_view = new EncryptView (); - encrypt_view.cancel.connect (() => navigation_view.pop ()); encrypt_view.next_step.connect (load_drivers_view); navigation_view.push (encrypt_view); diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index e48389086..f0381f460 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -6,7 +6,6 @@ public abstract class AbstractInstallerView : Adw.NavigationPage { public bool cancellable { get; construct; } - public signal void cancel (); public signal void next_step (); protected Gtk.Box title_area; @@ -62,10 +61,9 @@ public abstract class AbstractInstallerView : Adw.NavigationPage { action_area.append (action_box_end); if (cancellable) { - var cancel_button = new Gtk.Button.with_label (_("Cancel Installation")); - cancel_button.clicked.connect (() => { - cancel (); - }); + var cancel_button = new Gtk.Button.with_label (_("Cancel Installation")) { + action_name = "win.back" + }; action_box_end.append (cancel_button); } From 1c1c628b8e6f8c7b3aa6a0e73b891e015db9cb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 25 Sep 2024 09:24:15 -0700 Subject: [PATCH 8/9] Simplify checkview loading a bit --- src/MainWindow.vala | 46 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 6cf35461f..00cf32dbc 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -145,19 +145,15 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { }); try_install_view.custom_step.connect (() => { - if (check_ignored) { + if (!load_check_view ("custom")) { load_partitioning_view (); - } else { - load_check_view ("custom"); - } + }; }); try_install_view.next_step.connect (() => { - if (check_ignored) { + if (!load_check_view ("standard")) { load_disk_view (); - } else { - load_check_view ("standard"); - } + }; }); } @@ -169,28 +165,28 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { disk_view.next_step.connect (() => load_encrypt_view ()); } - private void load_check_view (string path) { - var check_view = new Installer.CheckView (); + private bool load_check_view (string path) { + if (check_ignored) { + return false; + } - check_view.next_step.connect (() => { - check_ignored = true; + var check_view = new Installer.CheckView (); + if (check_view.has_messages) { + check_view.next_step.connect (() => { + check_ignored = true; - if (path == "custom") { - load_partitioning_view (); - } else if (path == "standard") { - load_disk_view (); - } - }); + if (path == "custom") { + load_partitioning_view (); + } else if (path == "standard") { + load_disk_view (); + } + }); - if (check_view.has_messages) { navigation_view.push (check_view); - } else { - if (path == "custom") { - load_partitioning_view (); - } else if (path == "standard") { - load_disk_view (); - } + return true; } + + return false; } private void load_encrypt_view () { From 89119ed8c44f1bff4a0edd23ef33725049b86d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 25 Sep 2024 09:30:02 -0700 Subject: [PATCH 9/9] Remove path string --- src/MainWindow.vala | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 00cf32dbc..b5bc47c5a 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -145,14 +145,24 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { }); try_install_view.custom_step.connect (() => { - if (!load_check_view ("custom")) { + var check_view = load_check_view (); + if (check_view == null) { load_partitioning_view (); + } else { + check_view.next_step.connect (() => { + load_partitioning_view (); + }); }; }); try_install_view.next_step.connect (() => { - if (!load_check_view ("standard")) { + var check_view = load_check_view (); + if (check_view == null) { load_disk_view (); + } else { + check_view.next_step.connect (() => { + load_disk_view (); + }); }; }); } @@ -165,28 +175,23 @@ public class Installer.MainWindow : Gtk.ApplicationWindow { disk_view.next_step.connect (() => load_encrypt_view ()); } - private bool load_check_view (string path) { + private Installer.CheckView? load_check_view () { if (check_ignored) { - return false; + return null; } var check_view = new Installer.CheckView (); if (check_view.has_messages) { check_view.next_step.connect (() => { check_ignored = true; - - if (path == "custom") { - load_partitioning_view (); - } else if (path == "standard") { - load_disk_view (); - } }); navigation_view.push (check_view); - return true; + + return check_view; } - return false; + return null; } private void load_encrypt_view () {