From ea9d0d7c38bbf9a9a178c3c791ee7866cbf06261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 7 May 2024 11:23:06 -0700 Subject: [PATCH 01/34] AbstractInstallerView: replace ButtonBox with Boxes --- src/Views/AbstractInstallerView.vala | 40 +++++++++++++++++----------- src/Views/CheckView.vala | 2 +- src/Views/DiskView.vala | 2 +- src/Views/DriversView.vala | 4 +-- src/Views/EncryptView.vala | 6 ++--- src/Views/ErrorView.vala | 6 ++--- src/Views/KeyboardLayoutView.vala | 4 +-- src/Views/LanguageView.vala | 2 +- src/Views/PartitioningView.vala | 8 +++--- src/Views/SuccessView.vala | 4 +-- src/Views/TryInstallView.vala | 4 +-- 11 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index 4465b6440..d36127bdb 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -21,7 +21,8 @@ public abstract class AbstractInstallerView : Gtk.Box { public signal void cancel (); protected Gtk.Grid content_area; - protected Gtk.ButtonBox action_area; + protected Gtk.Box action_box_start; + protected Gtk.Box action_box_end; protected AbstractInstallerView (bool cancellable = false) { Object (cancellable: cancellable); @@ -36,29 +37,38 @@ public abstract class AbstractInstallerView : Gtk.Box { orientation = Gtk.Orientation.VERTICAL }; - action_area = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL) { - layout_style = Gtk.ButtonBoxStyle.END, - margin_end = 10, - margin_start = 10, - spacing = 6 + action_box_end = new Gtk.Box (HORIZONTAL, 6) { + halign = END, + hexpand = true, + homogeneous = true }; - if (cancellable) { - var cancel_button = new Gtk.Button.with_label (_("Cancel Installation")); - cancel_button.clicked.connect (() => { - cancel (); - }); + action_box_start = new Gtk.Box (HORIZONTAL, 6) { + homogeneous = true + }; - action_area.add (cancel_button); - } + var action_area = new Gtk.Box (HORIZONTAL, 12) { + margin_start = 10, + margin_end = 10 + }; + action_area.add (action_box_start); if (Installer.App.test_mode) { var test_label = new Gtk.Label (_("Test Mode")); test_label.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR); action_area.add (test_label); - action_area.set_child_non_homogeneous (test_label, true); - action_area.set_child_secondary (test_label, true); + } + + action_area.add (action_box_end); + + if (cancellable) { + var cancel_button = new Gtk.Button.with_label (_("Cancel Installation")); + cancel_button.clicked.connect (() => { + cancel (); + }); + + action_box_end.add (cancel_button); } orientation = VERTICAL; diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 9b042801b..4fd4b03c3 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -86,7 +86,7 @@ public class Installer.CheckView : AbstractInstallerView { ignore_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); ignore_button.clicked.connect (() => next_step ()); - action_area.add (ignore_button); + action_box_end.add (ignore_button); bool minimum_specs = true; diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index f2a6ed7e3..f0bad0b15 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -111,7 +111,7 @@ public class Installer.DiskView : AbstractInstallerView { next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); next_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (FORWARD)); - action_area.add (next_button); + action_box_end.add (next_button); show_all (); } diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 62ebf083d..204e71aa1 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -105,8 +105,8 @@ next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); next_button.clicked.connect (() => next_step ()); - action_area.add (back_button); - action_area.add (next_button); + action_box_end.add (back_button); + action_box_end.add (next_button); drivers_check.toggled.connect (() => { unowned var configuration = Configuration.get_default (); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 83e30952f..db88ae8a0 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -170,9 +170,9 @@ public class EncryptView : AbstractInstallerView { }; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - action_area.add (back_button); - action_area.add (encrypt_button); - action_area.add (next_button); + action_box_end.add (back_button); + action_box_end.add (encrypt_button); + action_box_end.add (next_button); next_button.grab_focus (); diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index 23990f8a1..7e331b734 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -119,9 +119,9 @@ public class ErrorView : AbstractInstallerView { var install_button = new Gtk.Button.with_label (_("Try Installing Again")); install_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - action_area.add (restart_button); - action_area.add (demo_button); - action_area.add (install_button); + action_box_end.add (restart_button); + action_box_end.add (demo_button); + action_box_end.add (install_button); restart_button.clicked.connect (Utils.restart); diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 81f7db05e..db44a2fc2 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -59,8 +59,8 @@ public class KeyboardLayoutView : AbstractInstallerView { }; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - action_area.add (back_button); - action_area.add (next_button); + action_box_end.add (back_button); + action_box_end.add (next_button); input_variant_widget.main_listbox.set_sort_func ((row1, row2) => { return ((LayoutRow) row1).layout.description.collate (((LayoutRow) row2).layout.description); diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 535a44126..c58fe7bf2 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -114,7 +114,7 @@ public class Installer.LanguageView : AbstractInstallerView { next_button.sensitive = false; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - action_area.add (next_button); + action_box_end.add (next_button); lang_variant_widget.main_listbox.row_selected.connect (row_selected); lang_variant_widget.main_listbox.select_row (lang_variant_widget.main_listbox.get_row_at_index (0)); diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index a36309e78..358931766 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -127,11 +127,9 @@ public class Installer.PartitioningView : AbstractInstallerView { next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); next_button.sensitive = false; - action_area.add (modify_partitions_button); - action_area.set_child_secondary (modify_partitions_button, true); - action_area.set_child_non_homogeneous (modify_partitions_button, true); - action_area.add (back_button); - action_area.add (next_button); + action_box_start.add (modify_partitions_button); + action_box_end.add (back_button); + action_box_end.add (next_button); back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); next_button.clicked.connect (() => next_step ()); diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index b4eaf9cb8..fbfea9743 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -67,8 +67,8 @@ public class SuccessView : AbstractInstallerView { restart_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); restart_button.clicked.connect (Utils.restart); - action_area.add (shutdown_button); - action_area.add (restart_button); + action_box_end.add (shutdown_button); + action_box_end.add (restart_button); update_secondary_label (); diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index 2215931a2..f20ec8728 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -88,8 +88,8 @@ public class Installer.TryInstallView : AbstractInstallerView { }; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - action_area.add (back_button); - action_area.add (next_button); + action_box_end.add (back_button); + action_box_end.add (next_button); back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); From d7e5f8fac75c171e5326f6e34c1226afbf843e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 14 Feb 2024 10:58:51 -0800 Subject: [PATCH 02/34] bump deps --- meson.build | 6 +++--- src/meson.build | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 0eaf4bad7..1bea0fa30 100644 --- a/meson.build +++ b/meson.build @@ -15,11 +15,11 @@ i18n = import('i18n') distinst_dep = dependency('distinst') glib_dep = dependency('glib-2.0', version: '>=2.74') gobject_dep = dependency('gobject-2.0') -gtk_dep = dependency('gtk+-3.0') +gtk_dep = dependency('gtk4') gee_dep = dependency('gee-0.8') gio_dep = dependency('gio-2.0') -granite_dep = dependency('granite', version: '>=0.5') -handy_dep = dependency('libhandy-1', version: '>=0.90.0') +granite_dep = dependency('granite-7', version: '>=7.4.0') +adw_dep = dependency('libadwaita-1', version: '>=1.0.0') json_glib_dep = dependency('json-glib-1.0') xml2_dep = dependency('libxml-2.0') pwquality_dep = dependency('pwquality') diff --git a/src/meson.build b/src/meson.build index e03557d41..53cf75e6f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -59,7 +59,7 @@ gui_dependencies = [ gobject_dep, granite_dep, gtk_dep, - handy_dep, + adw_dep, json_glib_dep, pwquality_dep, xml2_dep From e916c62f9572660a425022518212fa0e2e19afc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 14 Feb 2024 13:56:44 -0800 Subject: [PATCH 03/34] Replace Deck with Leaflet --- src/MainWindow.vala | 73 ++++++++++++++++--------------- src/Views/DiskView.vala | 2 +- src/Views/DriversView.vala | 2 +- src/Views/EncryptView.vala | 2 +- src/Views/KeyboardLayoutView.vala | 4 +- src/Views/PartitioningView.vala | 2 +- src/Views/TryInstallView.vala | 2 +- src/Widgets/VariantWidget.vala | 7 +-- 8 files changed, 48 insertions(+), 46 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 202ab6661..3c8b4b416 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -22,14 +22,14 @@ public interface UPower : GLib.Object { public abstract bool on_battery { owned get; set; } } -public class Installer.MainWindow : Hdy.Window { +public class Installer.MainWindow : Gtk.Window { // 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 private const uint64 MINIMUM_SPACE = 15 * ONE_GB; private Gtk.Label infobar_label; - private Hdy.Deck deck; + private Adw.Leaflet leaflet; private LanguageView language_view; private TryInstallView try_install_view; private bool check_ignored = false; @@ -38,10 +38,11 @@ public class Installer.MainWindow : Hdy.Window { construct { language_view = new LanguageView (); - deck = new Hdy.Deck () { - can_swipe_back = true + leaflet = new Adw.Leaflet () { + can_navigate_back = true, + can_unfold = false }; - deck.add (language_view); + leaflet.add (language_view); infobar_label = new Gtk.Label ("") { use_markup = true @@ -61,7 +62,7 @@ public class Installer.MainWindow : Hdy.Window { battery_infobar.get_style_context ().add_class ("frame"); var overlay = new Gtk.Overlay () { - child = deck + child = leaflet }; overlay.add_overlay (battery_infobar); @@ -126,21 +127,21 @@ public class Installer.MainWindow : Hdy.Window { return Source.REMOVE; }); - deck.notify["visible-child"].connect (() => { + leaflet.notify["visible-child"].connect (() => { update_navigation (); }); - deck.notify["transition-running"].connect (() => { + leaflet.notify["transition-running"].connect (() => { update_navigation (); }); } private void update_navigation () { - if (!deck.transition_running) { + if (!leaflet.transition_running) { // We need to rebuild the views to reflect language changes and forking paths - if (deck.visible_child == language_view || deck.visible_child == try_install_view) { - while (deck.get_adjacent_child (FORWARD) != null) { - deck.remove (deck.get_adjacent_child (FORWARD)); + 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)); } } } @@ -150,16 +151,16 @@ public class Installer.MainWindow : Hdy.Window { var keyboard_layout_view = new KeyboardLayoutView (); try_install_view = new TryInstallView (); - deck.add (keyboard_layout_view); - deck.add (try_install_view); + leaflet.add (keyboard_layout_view); + leaflet.add (try_install_view); - deck.visible_child = keyboard_layout_view; + leaflet.visible_child = keyboard_layout_view; try_install_view.custom_step.connect (() => { load_check_view (); load_partitioning_view (); load_drivers_view (); - deck.navigate (FORWARD); + leaflet.navigate (FORWARD); }); try_install_view.next_step.connect (() => { @@ -167,16 +168,16 @@ public class Installer.MainWindow : Hdy.Window { load_disk_view (); load_encrypt_view (); load_drivers_view (); - deck.navigate (FORWARD); + leaflet.navigate (FORWARD); }); } private void load_disk_view () { var disk_view = new DiskView (); - deck.add (disk_view); + leaflet.add (disk_view); disk_view.load.begin (MINIMUM_SPACE); - disk_view.cancel.connect (() => deck.navigate (BACK)); + disk_view.cancel.connect (() => leaflet.navigate (BACK)); } private void load_check_view () { @@ -186,41 +187,41 @@ public class Installer.MainWindow : Hdy.Window { var check_view = new Installer.CheckView (); if (check_view.has_messages) { - deck.add (check_view); + leaflet.add (check_view); } - check_view.cancel.connect (() => deck.navigate (BACK)); + check_view.cancel.connect (() => leaflet.navigate (BACK)); check_view.next_step.connect (() => { check_ignored = true; - deck.navigate (FORWARD); + leaflet.navigate (FORWARD); }); } private void load_encrypt_view () { var encrypt_view = new EncryptView (); - deck.add (encrypt_view); + leaflet.add (encrypt_view); encrypt_view.cancel.connect (() => { - deck.visible_child = try_install_view; + leaflet.visible_child = try_install_view; }); } private void load_partitioning_view () { var partitioning_view = new PartitioningView (MINIMUM_SPACE); - deck.add (partitioning_view); + leaflet.add (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; - deck.navigate (FORWARD); + leaflet.navigate (FORWARD); }); } private void load_drivers_view () { var drivers_view = new DriversView (); - deck.add (drivers_view); + leaflet.add (drivers_view); drivers_view.next_step.connect (() => load_progress_view ()); } @@ -228,9 +229,9 @@ public class Installer.MainWindow : Hdy.Window { private void load_progress_view () { var progress_view = new ProgressView (); - deck.add (progress_view); - deck.visible_child = progress_view; - deck.can_swipe_back = false; + leaflet.add (progress_view); + leaflet.visible_child = progress_view; + leaflet.can_swipe_back = false; progress_view.on_success.connect (() => load_success_view ()); @@ -242,18 +243,18 @@ public class Installer.MainWindow : Hdy.Window { private void load_success_view () { var success_view = new SuccessView (); - deck.add (success_view); - deck.visible_child = success_view; + leaflet.add (success_view); + leaflet.visible_child = success_view; } private void load_error_view (string log) { var error_view = new ErrorView (log); - deck.add (error_view); - deck.visible_child = error_view; + leaflet.add (error_view); + leaflet.visible_child = error_view; error_view.retry_install.connect (() => { - deck.visible_child = try_install_view; - deck.can_swipe_back = true; + leaflet.visible_child = try_install_view; + leaflet.can_swipe_back = true; }); } diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index f2a6ed7e3..9d801cdf7 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -109,7 +109,7 @@ public class Installer.DiskView : AbstractInstallerView { sensitive = Installer.App.test_mode }; next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - next_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (FORWARD)); + next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD)); action_area.add (next_button); diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 62ebf083d..355d24f34 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -99,7 +99,7 @@ content_area.attach (message_grid, 1, 0, 1, 2); var back_button = new Gtk.Button.with_label (_("Back")); - back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); var next_button = new Gtk.Button.with_label (_("Erase and Install")); next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 83e30952f..7bb12eebc 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -199,7 +199,7 @@ public class EncryptView : AbstractInstallerView { Configuration.get_default ().encryption_password = pw_entry.text; } - ((Hdy.Deck) get_parent ()).navigate (FORWARD); + ((Adw.Leaflet) get_parent ()).navigate (FORWARD); }); pw_entry.changed.connect (() => { diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index a7da33e50..bae09792a 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -82,7 +82,7 @@ public class KeyboardLayoutView : AbstractInstallerView { next_button.activate (); }); - back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (BACK)); + back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); next_button.clicked.connect (() => { unowned Gtk.ListBoxRow row = input_variant_widget.main_listbox.get_selected_row (); @@ -107,7 +107,7 @@ public class KeyboardLayoutView : AbstractInstallerView { return; } - ((Hdy.Deck) get_parent ()).navigate (FORWARD); + ((Adw.Leaflet) get_parent ()).navigate (FORWARD); }); input_variant_widget.main_listbox.row_activated.connect ((row) => { diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index a36309e78..4ab0fb782 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -133,7 +133,7 @@ public class Installer.PartitioningView : AbstractInstallerView { action_area.add (back_button); action_area.add (next_button); - back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); + back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); next_button.clicked.connect (() => next_step ()); show_all (); diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index 2215931a2..92faf2151 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -91,7 +91,7 @@ public class Installer.TryInstallView : AbstractInstallerView { action_area.add (back_button); action_area.add (next_button); - back_button.clicked.connect (() => ((Hdy.Deck) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); + back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); demo_button.clicked.connect (() => { if (demo_button.active) { diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index c48884f6a..6cbfabbb6 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -24,7 +24,7 @@ public class VariantWidget : Gtk.Frame { private Gtk.Button back_button; private Gtk.Box variant_box; private Gtk.Label variant_title; - private Hdy.Deck deck; + private Adw.Leaflet deck; construct { main_listbox = new Gtk.ListBox (); @@ -68,8 +68,9 @@ public class VariantWidget : Gtk.Frame { variant_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); variant_box.add (variant_scrolled); - deck = new Hdy.Deck () { - can_swipe_back = true + deck = new Adw.Leaflet () { + can_navigate_back = true, + can_unfold = false }; deck.add (main_scrolled); deck.add (variant_box); From bcd4f5feaa0603f51faa4fea6108330cc2765bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:29:11 -0700 Subject: [PATCH 04/34] Minor API adjustments --- src/Widgets/DiskGrid.vala | 2 +- src/Widgets/InstallTypeGrid.vala | 2 +- src/Widgets/PartitionBar.vala | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala index 6a377be03..5aa872144 100644 --- a/src/Widgets/DiskGrid.vala +++ b/src/Widgets/DiskGrid.vala @@ -17,7 +17,7 @@ * Authored by: Corentin Noël */ -public class Installer.DiskButton : Gtk.RadioButton { +public class Installer.DiskButton : Gtk.CheckButton { public string disk_name { get; construct; } public string icon_name { get; construct; } public string disk_path { get; construct; } diff --git a/src/Widgets/InstallTypeGrid.vala b/src/Widgets/InstallTypeGrid.vala index 0a7e50b41..89df7aa59 100644 --- a/src/Widgets/InstallTypeGrid.vala +++ b/src/Widgets/InstallTypeGrid.vala @@ -17,7 +17,7 @@ * Authored by: Cassidy James Blaede */ -public class Installer.InstallTypeButton : Gtk.RadioButton { +public class Installer.InstallTypeButton : Gtk.CheckButton { public string title { get; construct; } public string icon_name { get; construct; } public string subtitle { get; construct; } diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index fa0193326..92822fc7d 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -5,7 +5,7 @@ * Authored by: Michael Aaron Murphy */ -public class Installer.PartitionBar : Gtk.EventBox { +public class Installer.PartitionBar : Gtk.Box { public signal void decrypted (InstallerDaemon.LuksCredentials credential); public Icon? icon { get; set; default = null; } @@ -17,7 +17,7 @@ public class Installer.PartitionBar : Gtk.EventBox { public string? volume_group { get; private set; } public Gtk.Popover menu { get; private set; } - private Gtk.GestureMultiPress click_gesture; + private Gtk.GestureClick click_gesture; public PartitionBar ( InstallerDaemon.Partition partition, @@ -44,8 +44,10 @@ public class Installer.PartitionBar : Gtk.EventBox { menu.relative_to = this; menu.position = BOTTOM; - click_gesture = new Gtk.GestureMultiPress (this); + click_gesture = new Gtk.GestureClickPress (); click_gesture.released.connect (menu.popup); + + add_controller (click_gesture); } class construct { @@ -61,7 +63,7 @@ public class Installer.PartitionBar : Gtk.EventBox { valign = END }; - add (image); + append (image); hexpand = true; tooltip_text = partition.device_path; From 5b79d84670165336270fa38f9e389887ccf340a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:32:11 -0700 Subject: [PATCH 05/34] Use add_css_class, Granite.STYLE_CLASS --- src/MainWindow.vala | 2 +- src/Views/AbstractInstallerView.vala | 2 +- src/Views/CheckView.vala | 10 +++++----- src/Views/DiskView.vala | 6 +++--- src/Views/DriversView.vala | 18 +++++++++--------- src/Views/EncryptView.vala | 10 +++++----- src/Views/ErrorView.vala | 6 +++--- src/Views/KeyboardLayoutView.vala | 8 ++++---- src/Views/LanguageView.vala | 8 ++++---- src/Views/PartitioningView.vala | 4 ++-- src/Views/ProgressView.vala | 4 ++-- src/Views/SuccessView.vala | 6 +++--- src/Views/TryInstallView.vala | 4 ++-- src/Widgets/DecryptMenu.vala | 4 ++-- src/Widgets/DiskBar.vala | 6 +++--- src/Widgets/DiskGrid.vala | 4 ++-- src/Widgets/InstallTypeGrid.vala | 4 ++-- src/Widgets/PartitionBar.vala | 2 +- src/Widgets/Terminal.vala | 4 ++-- src/Widgets/VariantWidget.vala | 4 ++-- 20 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 3c8b4b416..49370387b 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -59,7 +59,7 @@ public class Installer.MainWindow : Gtk.Window { valign = Gtk.Align.END }; battery_infobar.get_content_area ().add (infobar_label); - battery_infobar.get_style_context ().add_class ("frame"); + battery_infobar.add_css_class ("frame"); var overlay = new Gtk.Overlay () { child = leaflet diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index d36127bdb..6f2758f14 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -55,7 +55,7 @@ public abstract class AbstractInstallerView : Gtk.Box { if (Installer.App.test_mode) { var test_label = new Gtk.Label (_("Test Mode")); - test_label.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR); + test_label.add_css_class (Granite.STYLE_CLASS_ERROR); action_area.add (test_label); } diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 4fd4b03c3..9453df9c5 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -50,7 +50,7 @@ public class Installer.CheckView : AbstractInstallerView { var title_label = new Gtk.Label (_("Before Installing")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var beta_view = new CheckView ( _("Pre-Release Version"), @@ -83,7 +83,7 @@ public class Installer.CheckView : AbstractInstallerView { content_area.attach (message_box, 1, 0, 1, 2); var ignore_button = new Gtk.Button.with_label (_("Install Anyway")); - ignore_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + ignore_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); ignore_button.clicked.connect (() => next_step ()); action_box_end.add (ignore_button); @@ -188,7 +188,7 @@ public class Installer.CheckView : AbstractInstallerView { wrap = true, xalign = 0 }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var description_label = new Gtk.Label (description) { max_width_chars = 1, // Make Gtk wrap, but not expand the window @@ -212,13 +212,13 @@ public class Installer.CheckView : AbstractInstallerView { hexpand = true, xalign = 0 }; - recommended_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + recommended_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); var your_device_label = new Gtk.Label (_("Your Device:")) { hexpand = true, xalign = 0 }; - your_device_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + your_device_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); var processor_1 = new Gtk.Label (_("Processor:")) { xalign = 1 diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index bcb11a6b0..bb2bf1e95 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -46,7 +46,7 @@ public class Installer.DiskView : AbstractInstallerView { var install_label = new Gtk.Label (_("Select a Drive")) { valign = Gtk.Align.START }; - install_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + install_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var install_desc_label = new Gtk.Label ( _("This will erase all data on the selected drive. If you have not backed your data up, you can cancel the installation and use Demo Mode.") @@ -74,7 +74,7 @@ public class Installer.DiskView : AbstractInstallerView { max_width_chars = 45, wrap = true }; - load_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + load_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var load_box = new Gtk.Box (VERTICAL, 12) { halign = CENTER, @@ -108,7 +108,7 @@ public class Installer.DiskView : AbstractInstallerView { // Make sure we can skip this view in Test Mode sensitive = Installer.App.test_mode }; - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD)); action_box_end.add (next_button); diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index ea3d2f56a..583c2ee8a 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -27,18 +27,18 @@ var title_label = new Gtk.Label (_("Additional Drivers")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var description_label = new Gtk.Label (_("Broadcom® Wi-Fi adapters, NVIDIA® graphics, and some virtual machines may not function properly without additional drivers. Most devices do not require additional drivers.")) { max_width_chars = 1, // Make Gtk wrap, but not expand the window wrap = true, xalign = 0 }; - description_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + description_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var warning_image = new Gtk.Image.from_icon_name ("security-low-symbolic", LARGE_TOOLBAR); - warning_image.get_style_context ().add_class ("accent"); - warning_image.get_style_context ().add_class ("yellow"); + warning_image.add_css_class ("accent"); + warning_image.add_css_class ("yellow"); var warning_label = new Gtk.Label (_("Proprietary drivers contain private code that can't be reviewed. Security and other updates are dependent on the driver vendor.")) { hexpand = true, @@ -48,8 +48,8 @@ }; var internet_image = new Gtk.Image.from_icon_name ("network-wireless-symbolic", LARGE_TOOLBAR); - internet_image.get_style_context ().add_class ("accent"); - internet_image.get_style_context ().add_class ("blue"); + internet_image.add_css_class ("accent"); + internet_image.add_css_class ("blue"); var internet_label = new Gtk.Label (_("An Internet connection is required to install NVIDIA® graphics drivers.")) { hexpand = true, @@ -59,8 +59,8 @@ }; var install_later_image = new Gtk.Image.from_icon_name ("system-software-install-symbolic", LARGE_TOOLBAR); - install_later_image.get_style_context ().add_class ("accent"); - install_later_image.get_style_context ().add_class ("purple"); + install_later_image.add_css_class ("accent"); + install_later_image.add_css_class ("purple"); var install_later_label = new Gtk.Label (_("Proprietary drivers can be installed later through AppCenter, but an Internet connection will be required for all drivers.")) { hexpand = true, @@ -102,7 +102,7 @@ back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); var next_button = new Gtk.Button.with_label (_("Erase and Install")); - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); next_button.clicked.connect (() => next_step ()); action_box_end.add (back_button); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index da1a9fdea..eda945456 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -51,7 +51,7 @@ public class EncryptView : AbstractInstallerView { var title_label = new Gtk.Label (_("Enable Drive Encryption")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var details_label = new Gtk.Label (_("Encrypt this device's drive if required for added protection, but be sure you understand:")) { hexpand = true, @@ -59,7 +59,7 @@ public class EncryptView : AbstractInstallerView { wrap = true, xalign = 0 }; - details_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + details_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var protect_image = new Gtk.Image.from_icon_name ("security-high-symbolic", Gtk.IconSize.LARGE_TOOLBAR); @@ -114,7 +114,7 @@ public class EncryptView : AbstractInstallerView { var pw_label = new Granite.HeaderLabel (_("Choose Encryption Password")); pw_error_revealer = new ErrorRevealer ("."); - pw_error_revealer.label_widget.get_style_context ().add_class (Gtk.STYLE_CLASS_WARNING); + pw_error_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_WARNING); pw_entry = new ValidatedEntry (); pw_entry.visibility = false; @@ -133,7 +133,7 @@ public class EncryptView : AbstractInstallerView { }; confirm_entry_revealer = new ErrorRevealer ("."); - confirm_entry_revealer.label_widget.get_style_context ().add_class (Gtk.STYLE_CLASS_ERROR); + confirm_entry_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_ERROR); var password_box = new Gtk.Box (VERTICAL, 3); password_box.add (description); @@ -168,7 +168,7 @@ public class EncryptView : AbstractInstallerView { next_button = new Gtk.Button.with_label (_(SKIP_STRING)) { can_default = true }; - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); action_box_end.add (back_button); action_box_end.add (encrypt_button); diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index 7e331b734..6f1c8033c 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -32,7 +32,7 @@ public class ErrorView : AbstractInstallerView { var title_label = new Gtk.Label (_("Could Not Install")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var description_label = new Gtk.Label (_("Installing %s failed, possibly due to a hardware error. The device may not restart properly. You can try the following:").printf (Utils.get_pretty_name ())) { margin_bottom = 12, @@ -79,7 +79,7 @@ public class ErrorView : AbstractInstallerView { label = _("Details"), margin_top = 12 }; - terminal_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT); var buffer = new Gtk.TextBuffer (null) { text = log @@ -117,7 +117,7 @@ public class ErrorView : AbstractInstallerView { var demo_button = new Gtk.Button.with_label (_("Try Demo Mode")); var install_button = new Gtk.Button.with_label (_("Try Installing Again")); - install_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + install_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); action_box_end.add (restart_button); action_box_end.add (demo_button); diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 41c265d93..eefd37c7c 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -30,7 +30,7 @@ public class KeyboardLayoutView : AbstractInstallerView { var title_label = new Gtk.Label (_("Select Keyboard Layout")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); input_variant_widget = new VariantWidget (); @@ -57,7 +57,7 @@ public class KeyboardLayoutView : AbstractInstallerView { var next_button = new Gtk.Button.with_label (_("Select")) { sensitive = false }; - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); action_box_end.add (back_button); action_box_end.add (next_button); @@ -225,7 +225,7 @@ public class KeyboardLayoutView : AbstractInstallerView { margin_start = 6, xalign = 0 }; - label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); add (label); show_all (); @@ -252,7 +252,7 @@ public class KeyboardLayoutView : AbstractInstallerView { margin_start = 6, xalign = 0 }; - label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); add (label); show_all (); diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index c58fe7bf2..53b1a7fe5 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -49,7 +49,7 @@ public class Installer.LanguageView : AbstractInstallerView { select_stack = new Gtk.Stack (); select_stack.valign = Gtk.Align.START; - select_stack.get_style_context ().add_class ("h2"); + select_stack.add_css_class ("h2"); select_stack.transition_type = Gtk.StackTransitionType.CROSSFADE; select_stack.add (select_label); @@ -112,7 +112,7 @@ public class Installer.LanguageView : AbstractInstallerView { next_button = new Gtk.Button.with_label (_("Select")); next_button.sensitive = false; - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); action_box_end.add (next_button); @@ -324,7 +324,7 @@ public class Installer.LanguageView : AbstractInstallerView { ellipsize = Pango.EllipsizeMode.END, xalign = 0 }; - label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); var box = new Gtk.Box (HORIZONTAL, 6) { margin_top = 6, @@ -368,7 +368,7 @@ public class Installer.LanguageView : AbstractInstallerView { image.icon_size = Gtk.IconSize.BUTTON; var label = new Gtk.Label (country_entry.name); - label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); label.xalign = 0; var box = new Gtk.Box (HORIZONTAL, 6) { diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index f2f2f5150..a7696ed38 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -93,7 +93,7 @@ public class Installer.PartitioningView : AbstractInstallerView { load_spinner.start (); var load_label = new Gtk.Label (_("Getting the current configuration…")); - load_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + load_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var load_box = new Gtk.Box (VERTICAL, 12) { hexpand = true, @@ -124,7 +124,7 @@ public class Installer.PartitioningView : AbstractInstallerView { var back_button = new Gtk.Button.with_label (_("Back")); next_button = new Gtk.Button.with_label (_("Next")); - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); next_button.sensitive = false; action_box_start.add (modify_partitions_button); diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 313f07909..e50901987 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -75,13 +75,13 @@ public class ProgressView : AbstractInstallerView { image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic", Gtk.IconSize.SMALL_TOOLBAR), tooltip_text = _("Show log") }; - terminal_button.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT); progressbar_label = new Gtk.Label (null) { use_markup = true, xalign = 0 }; - progressbar_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + progressbar_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); progressbar = new Gtk.ProgressBar () { hexpand = true diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index fbfea9743..c6b22036a 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -29,7 +29,7 @@ public class SuccessView : AbstractInstallerView { var title_label = new Gtk.Label (_("Continue Setting Up")) { valign = Gtk.Align.START }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var primary_label = new Gtk.Label (_("%s has been installed").printf (Utils.get_pretty_name ())) { hexpand = true, @@ -37,7 +37,7 @@ public class SuccessView : AbstractInstallerView { wrap = true, xalign = 0 }; - primary_label.get_style_context ().add_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + primary_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); secondary_label = new Gtk.Label (null) { max_width_chars = 1, // Make Gtk wrap, but not expand the window @@ -64,7 +64,7 @@ public class SuccessView : AbstractInstallerView { shutdown_button.clicked.connect (Utils.shutdown); var restart_button = new Gtk.Button.with_label (_("Restart Device")); - restart_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + restart_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); restart_button.clicked.connect (Utils.restart); action_box_end.add (shutdown_button); diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index be1dcf3b5..a278928a9 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -28,7 +28,7 @@ public class Installer.TryInstallView : AbstractInstallerView { var type_label = new Gtk.Label (_("Try or Install")) { valign = Gtk.Align.START }; - type_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + type_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); // Force the user to make a conscious selection, not spam "Next" var no_selection = new Gtk.RadioButton (null) { @@ -86,7 +86,7 @@ public class Installer.TryInstallView : AbstractInstallerView { var next_button = new Gtk.Button.with_label (_("Next")) { sensitive = false }; - next_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); action_box_end.add (back_button); action_box_end.add (next_button); diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index 1d0cccf53..83566fd6f 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -61,7 +61,7 @@ public class Installer.DecryptMenu: Gtk.Popover { overlay.add_overlay (overlay_image); var primary_label = new Gtk.Label (_("Decrypt This Partition")); - primary_label.get_style_context ().add_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + primary_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); primary_label.halign = Gtk.Align.START; var secondary_label = new Gtk.Label (_("Enter the partition's encryption password and set a device name for the decrypted partition.")); @@ -106,7 +106,7 @@ public class Installer.DecryptMenu: Gtk.Popover { decrypt_button = new Gtk.Button.with_label (_("Decrypt")); decrypt_button.halign = Gtk.Align.END; decrypt_button.sensitive = false; - decrypt_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + decrypt_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); decrypt_button.clicked.connect (() => { decrypt.begin (pv_entry.get_text ()); }); diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index ef43a29ba..5b4b1ddbf 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -56,7 +56,7 @@ public class Installer.DiskBar: Gtk.Grid { }; unowned var size_label_context = size_label.get_style_context (); - size_label_context.add_class (Gtk.STYLE_CLASS_DIM_LABEL); + size_label_context.add_class (Granite.STYLE_CLASS_DIM_LABEL); size_label_context.add_class (Granite.STYLE_CLASS_SMALL_LABEL); var label = new Gtk.Grid (); @@ -105,14 +105,14 @@ public class Installer.DiskBar: Gtk.Grid { hexpand = true, vexpand = true }; - unused_bar.get_style_context ().add_class ("unused"); + unused_bar.add_css_class ("unused"); bar.add (unused_bar); } column_spacing = 12; hexpand = true; - get_style_context ().add_class (Granite.STYLE_CLASS_STORAGEBAR); + add_css_class (Granite.STYLE_CLASS_STORAGEBAR); attach (label, 0, 1); attach (legend, 1, 0); attach (bar, 1, 1); diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala index 5aa872144..721bae2ab 100644 --- a/src/Widgets/DiskGrid.vala +++ b/src/Widgets/DiskGrid.vala @@ -33,7 +33,7 @@ public class Installer.DiskButton : Gtk.CheckButton { } construct { - get_style_context ().add_class ("image-button"); + add_css_class ("image-button"); var disk_image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG) { use_fallback = true @@ -44,7 +44,7 @@ public class Installer.DiskButton : Gtk.CheckButton { halign = Gtk.Align.START, valign = Gtk.Align.END }; - name_label.get_style_context ().add_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + name_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); var size_label = new Gtk.Label ("%s %s".printf (disk_path, GLib.format_size (size))) { ellipsize = Pango.EllipsizeMode.MIDDLE, diff --git a/src/Widgets/InstallTypeGrid.vala b/src/Widgets/InstallTypeGrid.vala index 89df7aa59..d3a1a69b9 100644 --- a/src/Widgets/InstallTypeGrid.vala +++ b/src/Widgets/InstallTypeGrid.vala @@ -31,7 +31,7 @@ public class Installer.InstallTypeButton : Gtk.CheckButton { } construct { - get_style_context ().add_class ("image-button"); + add_css_class ("image-button"); var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG); @@ -39,7 +39,7 @@ public class Installer.InstallTypeButton : Gtk.CheckButton { hexpand = true, xalign = 0 }; - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); var subtitle_label = new Gtk.Label (subtitle) { max_width_chars = 1, // Make Gtk wrap, but not expand the window diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index 92822fc7d..9612e0198 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -67,7 +67,7 @@ public class Installer.PartitionBar : Gtk.Box { hexpand = true; tooltip_text = partition.device_path; - get_style_context ().add_class (Distinst.strfilesys (partition.filesystem)); + add_css_class (Distinst.strfilesys (partition.filesystem)); bind_property ("icon", image, "gicon", SYNC_CREATE); } diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala index d27e5fd7e..cfbf72a28 100644 --- a/src/Widgets/Terminal.vala +++ b/src/Widgets/Terminal.vala @@ -44,14 +44,14 @@ public class Installer.Terminal : Gtk.ScrolledWindow { pixels_below_lines = 3, wrap_mode = Gtk.WrapMode.WORD }; - view.get_style_context ().remove_class (Gtk.STYLE_CLASS_VIEW); + view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); hscrollbar_policy = Gtk.PolicyType.NEVER; hexpand = true; vexpand = true; min_content_height = 120; add (view); - get_style_context ().add_class (Granite.STYLE_CLASS_TERMINAL); + add_css_class (Granite.STYLE_CLASS_TERMINAL); view.size_allocate.connect (() => attempt_scroll ()); } diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index 6cbfabbb6..1e0af0578 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -50,7 +50,7 @@ public class VariantWidget : Gtk.Frame { margin_bottom = 6, margin_start = 6 }; - back_button.get_style_context ().add_class (Granite.STYLE_CLASS_BACK_BUTTON); + back_button.add_css_class (Granite.STYLE_CLASS_BACK_BUTTON); variant_title = new Gtk.Label (null); variant_title.ellipsize = Pango.EllipsizeMode.END; @@ -63,7 +63,7 @@ public class VariantWidget : Gtk.Frame { header_box.set_center_widget (variant_title); variant_box = new Gtk.Box (VERTICAL, 0); - variant_box.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); + variant_box.add_css_class (Granite.STYLE_CLASS_VIEW); variant_box.add (header_box); variant_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); variant_box.add (variant_scrolled); From e42ff113aaaf3b4cc2e6bc40ad57cba934bf1d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:34:21 -0700 Subject: [PATCH 06/34] Remove show_all --- src/Application.vala | 2 +- src/Views/CheckView.vala | 4 ---- src/Views/DiskView.vala | 3 --- src/Views/DriversView.vala | 2 -- src/Views/EncryptView.vala | 1 - src/Views/ErrorView.vala | 2 -- src/Views/KeyboardLayoutView.vala | 4 ---- src/Views/LanguageView.vala | 3 --- src/Views/PartitioningView.vala | 4 ---- src/Views/ProgressView.vala | 2 -- src/Views/SuccessView.vala | 2 -- src/Views/TryInstallView.vala | 2 -- src/Widgets/DecryptMenu.vala | 2 -- src/Widgets/DiskBar.vala | 2 -- src/Widgets/PartitionMenu.vala | 1 - 15 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index f398a34bb..3a8b76090 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -41,7 +41,7 @@ public class Installer.App : Gtk.Application { icon_name = application_id, title = _("Install %s").printf (Utils.get_pretty_name ()) }; - window.show_all (); + window.present (); add_window (window); weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default (); diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 9453df9c5..429060ccc 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -119,8 +119,6 @@ public class Installer.CheckView : AbstractInstallerView { if (!minimum_specs) { message_box.add (specs_view); } - - show_all (); } private int get_frequency () { @@ -202,8 +200,6 @@ public class Installer.CheckView : AbstractInstallerView { attach (image, 0, 0, 1, 2); attach (title_label, 1, 0); attach (description_label, 1, 1); - - show_all (); } } diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index bb2bf1e95..a660e4357 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -112,8 +112,6 @@ public class Installer.DiskView : AbstractInstallerView { next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD)); action_box_end.add (next_button); - - show_all (); } public async void load (uint64 minimum_disk_size) { @@ -183,7 +181,6 @@ public class Installer.DiskView : AbstractInstallerView { disk_box.add (disk_button); } - disk_box.show_all (); load_stack.set_visible_child_name ("disk"); } } diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 583c2ee8a..4cb0ad8cf 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -112,7 +112,5 @@ unowned var configuration = Configuration.get_default (); configuration.install_drivers = drivers_check.active; }); - - show_all (); } } diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index eda945456..c9d3b9631 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -213,7 +213,6 @@ public class EncryptView : AbstractInstallerView { update_next_button (); }); - show_all (); back_button.hide (); } diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index 6f1c8033c..f4c414948 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -135,7 +135,5 @@ public class ErrorView : AbstractInstallerView { terminal_view.attempt_scroll (); } }); - - show_all (); } } diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index eefd37c7c..5799680d9 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -183,8 +183,6 @@ public class KeyboardLayoutView : AbstractInstallerView { input_variant_widget.main_listbox.add (new LayoutRow (layout)); } - show_all (); - Idle.add_once (() => { string? country = Configuration.get_default ().country; if (country != null) { @@ -228,7 +226,6 @@ public class KeyboardLayoutView : AbstractInstallerView { label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); add (label); - show_all (); } } @@ -255,7 +252,6 @@ public class KeyboardLayoutView : AbstractInstallerView { label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); add (label); - show_all (); } } } diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 53b1a7fe5..4e2e419b4 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -93,7 +93,6 @@ public class Installer.LanguageView : AbstractInstallerView { margin_bottom = 3, margin_start = 6 }; - separator.show_all (); row.set_header (separator); } } @@ -255,7 +254,6 @@ public class Installer.LanguageView : AbstractInstallerView { lang_variant_widget.variant_listbox.select_row (lang_variant_widget.variant_listbox.get_row_at_index (0)); - lang_variant_widget.variant_listbox.show_all (); Environment.set_variable ("LANGUAGE", lang_entry.get_code (), true); Intl.textdomain (Build.GETTEXT_PACKAGE); lang_variant_widget.show_variants (_("Languages"), "%s".printf (lang_entry.name)); @@ -276,7 +274,6 @@ public class Installer.LanguageView : AbstractInstallerView { Environment.set_variable ("LANGUAGE", ((LangRow) row).lang_entry.get_code (), true); Intl.textdomain (Build.GETTEXT_PACKAGE); select_label = new Gtk.Label (_("Select a Language")); - select_label.show_all (); select_stack.add (select_label); select_stack.set_visible_child (select_label); diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index a7696ed38..5954d279e 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -133,8 +133,6 @@ public class Installer.PartitioningView : AbstractInstallerView { back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); next_button.clicked.connect (() => next_step ()); - - show_all (); } private async void load_disks () { @@ -170,8 +168,6 @@ public class Installer.PartitioningView : AbstractInstallerView { add_logical_disk (disk); } - disk_list.show_all (); - load_stack.set_visible_child_name ("disk"); } diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index e50901987..32a2f78a7 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -104,8 +104,6 @@ public class ProgressView : AbstractInstallerView { logo_stack.visible_child = logo_overlay; } }); - - show_all (); } public string get_log () { diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index c6b22036a..b6c9f6695 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -87,8 +87,6 @@ public class SuccessView : AbstractInstallerView { return Source.CONTINUE; }); - - show_all (); } private void update_secondary_label () { diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index a278928a9..df74fc5f1 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -123,7 +123,5 @@ public class Installer.TryInstallView : AbstractInstallerView { custom_step (); } }); - - show_all (); } } diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index 83566fd6f..b5b835b77 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -41,7 +41,6 @@ public class Installer.DecryptMenu: Gtk.Popover { }; create_decrypt_view (); add (stack); - stack.show_all (); } private void create_decrypt_view () { @@ -182,7 +181,6 @@ public class Installer.DecryptMenu: Gtk.Popover { var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6); box.add (label); box.add (info); - box.show_all (); stack.add (box); stack.visible_child = box; diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 5b4b1ddbf..feec87b9a 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -116,8 +116,6 @@ public class Installer.DiskBar: Gtk.Grid { attach (label, 0, 1); attach (legend, 1, 0); attach (bar, 1, 1); - - show_all (); } private void add_legend (string ppath, uint64 size, string fs, string? vg, Gtk.Popover? menu) { diff --git a/src/Widgets/PartitionMenu.vala b/src/Widgets/PartitionMenu.vala index 18654f18d..a7c9597e7 100644 --- a/src/Widgets/PartitionMenu.vala +++ b/src/Widgets/PartitionMenu.vala @@ -136,7 +136,6 @@ public class Installer.PartitionMenu : Gtk.Popover { }; grid.attach (use_partition, 0, 0); grid.attach (bottom_revealer, 0, 1); - grid.show_all (); add (grid); From 2e152bea5dd636016e58b9a72ee88bdf0c04a26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:37:14 -0700 Subject: [PATCH 07/34] box.append --- src/Views/AbstractInstallerView.vala | 2 +- src/Views/CheckView.vala | 8 ++++---- src/Views/DiskView.vala | 10 +++++----- src/Views/DriversView.vala | 4 ++-- src/Views/EncryptView.vala | 22 +++++++++++----------- src/Views/ErrorView.vala | 6 +++--- src/Views/KeyboardLayoutView.vala | 4 ++-- src/Views/LanguageView.vala | 16 ++++++++-------- src/Views/PartitioningView.vala | 8 ++++---- src/Views/SuccessView.vala | 4 ++-- src/Views/TryInstallView.vala | 12 ++++++------ src/Widgets/DecryptMenu.vala | 4 ++-- src/Widgets/DiskBar.vala | 2 +- src/Widgets/VariantWidget.vala | 8 ++++---- 14 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index 6f2758f14..d00bddfca 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -68,7 +68,7 @@ public abstract class AbstractInstallerView : Gtk.Box { cancel (); }); - action_box_end.add (cancel_button); + action_box_end.append (cancel_button); } orientation = VERTICAL; diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 429060ccc..59fdc411c 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -86,7 +86,7 @@ public class Installer.CheckView : AbstractInstallerView { ignore_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); ignore_button.clicked.connect (() => next_step ()); - action_box_end.add (ignore_button); + action_box_end.append (ignore_button); bool minimum_specs = true; @@ -106,18 +106,18 @@ public class Installer.CheckView : AbstractInstallerView { var dis = new DataInputStream (@is); if ("daily" in dis.read_line ()) { - message_box.add (beta_view); + message_box.append (beta_view); } } catch (Error e) { critical ("Couldn't read apt sources: %s", e.message); } if (get_vm ()) { - message_box.add (vm_view); + message_box.append (vm_view); } if (!minimum_specs) { - message_box.add (specs_view); + message_box.append (specs_view); } } diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index a660e4357..e9917f514 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -80,8 +80,8 @@ public class Installer.DiskView : AbstractInstallerView { halign = CENTER, valign = CENTER }; - load_box.add (load_spinner); - load_box.add (load_label); + load_box.append (load_spinner); + load_box.append (load_label); load_stack = new Gtk.Stack () { transition_type = Gtk.StackTransitionType.CROSSFADE @@ -111,7 +111,7 @@ public class Installer.DiskView : AbstractInstallerView { next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); next_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (FORWARD)); - action_box_end.add (next_button); + action_box_end.append (next_button); } public async void load (uint64 minimum_disk_size) { @@ -173,12 +173,12 @@ public class Installer.DiskView : AbstractInstallerView { foreach (DiskButton disk_button in enabled_buttons) { disk_button.group = no_selection; - disk_box.add (disk_button); + disk_box.append (disk_button); } foreach (DiskButton disk_button in disabled_buttons) { disk_button.group = no_selection; - disk_box.add (disk_button); + disk_box.append (disk_button); } load_stack.set_visible_child_name ("disk"); diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index 4cb0ad8cf..f03340a94 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -105,8 +105,8 @@ next_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); next_button.clicked.connect (() => next_step ()); - action_box_end.add (back_button); - action_box_end.add (next_button); + action_box_end.append (back_button); + action_box_end.append (next_button); drivers_check.toggled.connect (() => { unowned var configuration = Configuration.get_default (); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index c9d3b9631..ec7bc1768 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -136,14 +136,14 @@ public class EncryptView : AbstractInstallerView { confirm_entry_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_ERROR); var password_box = new Gtk.Box (VERTICAL, 3); - password_box.add (description); - password_box.add (pw_label); - password_box.add (pw_entry); - password_box.add (pw_levelbar); - password_box.add (pw_error_revealer); - password_box.add (confirm_label); - password_box.add (confirm_entry); - password_box.add (confirm_entry_revealer); + password_box.append (description); + password_box.append (pw_label); + password_box.append (pw_entry); + password_box.append (pw_levelbar); + password_box.append (pw_error_revealer); + password_box.append (confirm_label); + password_box.append (confirm_entry); + password_box.append (confirm_entry_revealer); var stack = new Gtk.Stack () { vhomogeneous = false, @@ -170,9 +170,9 @@ public class EncryptView : AbstractInstallerView { }; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - action_box_end.add (back_button); - action_box_end.add (encrypt_button); - action_box_end.add (next_button); + action_box_end.append (back_button); + action_box_end.append (encrypt_button); + action_box_end.append (next_button); next_button.grab_focus (); diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index f4c414948..f74554d92 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -119,9 +119,9 @@ public class ErrorView : AbstractInstallerView { var install_button = new Gtk.Button.with_label (_("Try Installing Again")); install_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - action_box_end.add (restart_button); - action_box_end.add (demo_button); - action_box_end.add (install_button); + action_box_end.append (restart_button); + action_box_end.append (demo_button); + action_box_end.append (install_button); restart_button.clicked.connect (Utils.restart); diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index 5799680d9..c78163749 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -59,8 +59,8 @@ public class KeyboardLayoutView : AbstractInstallerView { }; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - action_box_end.add (back_button); - action_box_end.add (next_button); + action_box_end.append (back_button); + action_box_end.append (next_button); input_variant_widget.main_listbox.set_sort_func ((row1, row2) => { return ((LayoutRow) row1).layout.description.collate (((LayoutRow) row2).layout.description); diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 4e2e419b4..323c9ad17 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -102,18 +102,18 @@ public class Installer.LanguageView : AbstractInstallerView { if (lang_entry.key in preferred_langs) { var pref_langrow = new LangRow (lang_entry.value); pref_langrow.preferred_row = true; - lang_variant_widget.main_listbox.add (pref_langrow); + lang_variant_widget.main_listbox.append (pref_langrow); } var langrow = new LangRow (lang_entry.value); - lang_variant_widget.main_listbox.add (langrow); + lang_variant_widget.main_listbox.append (langrow); } next_button = new Gtk.Button.with_label (_("Select")); next_button.sensitive = false; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - action_box_end.add (next_button); + action_box_end.append (next_button); lang_variant_widget.main_listbox.row_selected.connect (row_selected); lang_variant_widget.main_listbox.select_row (lang_variant_widget.main_listbox.get_row_at_index (0)); @@ -249,7 +249,7 @@ public class Installer.LanguageView : AbstractInstallerView { lang_variant_widget.clear_variants (); lang_variant_widget.variant_listbox.row_selected.connect (variant_row_selected); foreach (var country in countries) { - lang_variant_widget.variant_listbox.add (new CountryRow (country)); + lang_variant_widget.variant_listbox.append (new CountryRow (country)); } lang_variant_widget.variant_listbox.select_row (lang_variant_widget.variant_listbox.get_row_at_index (0)); @@ -329,8 +329,8 @@ public class Installer.LanguageView : AbstractInstallerView { margin_bottom = 6, margin_start = 6 }; - box.add (label); - box.add (image); + box.append (label); + box.append (image); child = box; } @@ -374,8 +374,8 @@ public class Installer.LanguageView : AbstractInstallerView { margin_bottom = 6, margin_start = 6 }; - box.add (label); - box.add (image); + box.append (label); + box.append (image); child = box; } diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 5954d279e..dd459b8cb 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -101,8 +101,8 @@ public class Installer.PartitioningView : AbstractInstallerView { valign = CENTER, halign = CENTER }; - load_box.add (load_spinner); - load_box.add (load_label); + load_box.append (load_spinner); + load_box.append (load_label); load_stack = new Gtk.Stack (); load_stack.transition_type = Gtk.StackTransitionType.CROSSFADE; @@ -128,8 +128,8 @@ public class Installer.PartitioningView : AbstractInstallerView { next_button.sensitive = false; action_box_start.add (modify_partitions_button); - action_box_end.add (back_button); - action_box_end.add (next_button); + action_box_end.append (back_button); + action_box_end.append (next_button); back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (Hdy.NavigationDirection.BACK)); next_button.clicked.connect (() => next_step ()); diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index b6c9f6695..ae0bff262 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -67,8 +67,8 @@ public class SuccessView : AbstractInstallerView { restart_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); restart_button.clicked.connect (Utils.restart); - action_box_end.add (shutdown_button); - action_box_end.add (restart_button); + action_box_end.append (shutdown_button); + action_box_end.append (restart_button); update_secondary_label (); diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index df74fc5f1..6166eaec7 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -62,10 +62,10 @@ public class Installer.TryInstallView : AbstractInstallerView { var type_box = new Gtk.Box (VERTICAL, 6) { valign = CENTER }; - type_box.add (demo_button); - type_box.add (clean_install_button); - type_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); - type_box.add (custom_button); + type_box.append (demo_button); + type_box.append (clean_install_button); + type_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); + type_box.append (custom_button); var type_scrolled = new Gtk.ScrolledWindow (null, null) { child = type_box, @@ -88,8 +88,8 @@ public class Installer.TryInstallView : AbstractInstallerView { }; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); - action_box_end.add (back_button); - action_box_end.add (next_button); + action_box_end.append (back_button); + action_box_end.append (next_button); back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index b5b835b77..a0c9dfd47 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -179,8 +179,8 @@ public class Installer.DecryptMenu: Gtk.Popover { var info = new Gtk.Label (_("LUKS volume was decrypted")); var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6); - box.add (label); - box.add (info); + box.append (label); + box.append (info); stack.add (box); stack.visible_child = box; diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index feec87b9a..3ba956296 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -152,7 +152,7 @@ public class Installer.DiskBar: Gtk.Grid { private Gtk.Widget set_menu (Gtk.Widget widget, Gtk.Popover? menu) { if (menu != null) { var event_box = new Gtk.EventBox (); - event_box.add (widget); + event_box.append (widget); event_box.add_events (Gdk.EventMask.BUTTON_PRESS_MASK); event_box.button_press_event.connect (() => { menu.popup (); diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index 1e0af0578..1d5fc7d89 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -59,14 +59,14 @@ public class VariantWidget : Gtk.Frame { var header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); header_box.hexpand = true; - header_box.add (back_button); + header_box.append (back_button); header_box.set_center_widget (variant_title); variant_box = new Gtk.Box (VERTICAL, 0); variant_box.add_css_class (Granite.STYLE_CLASS_VIEW); - variant_box.add (header_box); - variant_box.add (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); - variant_box.add (variant_scrolled); + variant_box.append (header_box); + variant_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); + variant_box.append (variant_scrolled); deck = new Adw.Leaflet () { can_navigate_back = true, From 5b02220078972f750a45e1dc7143dc11ac9bc720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:44:00 -0700 Subject: [PATCH 08/34] Remove IconSize --- src/Views/CheckView.vala | 5 +++-- src/Views/DiskView.vala | 4 ++-- src/Views/DriversView.vala | 14 ++++++++++---- src/Views/EncryptView.vala | 16 +++++++++++----- src/Views/ErrorView.vala | 10 +++++----- src/Views/KeyboardLayoutView.vala | 2 +- src/Views/LanguageView.vala | 4 +--- src/Views/ProgressView.vala | 2 +- src/Views/SuccessView.vala | 2 +- src/Views/TryInstallView.vala | 2 +- src/Widgets/DecryptMenu.vala | 8 ++++++-- src/Widgets/DiskGrid.vala | 3 ++- src/Widgets/InstallTypeGrid.vala | 4 +++- 13 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index 59fdc411c..cdfc326ee 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -42,7 +42,7 @@ public class Installer.CheckView : AbstractInstallerView { } construct { - var image = new Gtk.Image.from_icon_name ("io.elementary.installer.caution", Gtk.IconSize.DIALOG) { + var image = new Gtk.Image.from_icon_name ("io.elementary.installer.caution") { pixel_size = 128, valign = Gtk.Align.END }; @@ -176,7 +176,8 @@ public class Installer.CheckView : AbstractInstallerView { private class CheckView : Gtk.Grid { public CheckView (string title, string description, string icon_name) { - var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DND) { + var image = new Gtk.Image.from_icon_name (icon_name) { + icon_size = LARGE, valign = Gtk.Align.START }; diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index e9917f514..b7f8cb809 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -27,11 +27,11 @@ public class Installer.DiskView : AbstractInstallerView { } construct { - var install_image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.DIALOG) { + var install_image = new Gtk.Image.from_icon_name ("drive-harddisk") { pixel_size = 128 }; - var install_badge = new Gtk.Image.from_icon_name ("io.elementary.installer.emblem-downloads", Gtk.IconSize.DND) { + var install_badge = new Gtk.Image.from_icon_name ("io.elementary.installer.emblem-downloads") { pixel_size = 64, halign = Gtk.Align.END, valign = Gtk.Align.END diff --git a/src/Views/DriversView.vala b/src/Views/DriversView.vala index f03340a94..2680d5be7 100644 --- a/src/Views/DriversView.vala +++ b/src/Views/DriversView.vala @@ -19,7 +19,7 @@ public signal void next_step (); construct { - var image = new Gtk.Image.from_icon_name ("application-x-firmware", Gtk.IconSize.INVALID) { + var image = new Gtk.Image.from_icon_name ("application-x-firmware") { pixel_size = 128, valign = Gtk.Align.END }; @@ -36,7 +36,9 @@ }; description_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); - var warning_image = new Gtk.Image.from_icon_name ("security-low-symbolic", LARGE_TOOLBAR); + var warning_image = new Gtk.Image.from_icon_name ("security-low-symbolic") { + pixel_size = 24 + }; warning_image.add_css_class ("accent"); warning_image.add_css_class ("yellow"); @@ -47,7 +49,9 @@ xalign = 0 }; - var internet_image = new Gtk.Image.from_icon_name ("network-wireless-symbolic", LARGE_TOOLBAR); + var internet_image = new Gtk.Image.from_icon_name ("network-wireless-symbolic") { + pixel_size = 24 + }; internet_image.add_css_class ("accent"); internet_image.add_css_class ("blue"); @@ -58,7 +62,9 @@ xalign = 0 }; - var install_later_image = new Gtk.Image.from_icon_name ("system-software-install-symbolic", LARGE_TOOLBAR); + var install_later_image = new Gtk.Image.from_icon_name ("system-software-install-symbolic") { + pixel_size = 24 + }; install_later_image.add_css_class ("accent"); install_later_image.add_css_class ("purple"); diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index ec7bc1768..8c821bde8 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -30,11 +30,11 @@ public class EncryptView : AbstractInstallerView { } construct { - var image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.INVALID) { + var image = new Gtk.Image.from_icon_name ("drive-harddisk") { pixel_size = 128 }; - var overlay_image = new Gtk.Image.from_icon_name ("security-high", Gtk.IconSize.INVALID) { + var overlay_image = new Gtk.Image.from_icon_name ("security-high") { pixel_size = 64, halign = Gtk.Align.END, valign = Gtk.Align.END @@ -61,7 +61,9 @@ public class EncryptView : AbstractInstallerView { }; details_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); - var protect_image = new Gtk.Image.from_icon_name ("security-high-symbolic", Gtk.IconSize.LARGE_TOOLBAR); + var protect_image = new Gtk.Image.from_icon_name ("security-high-symbolic") { + pixel_size = 24 + }; var protect_label = new Gtk.Label (_("Data will only be protected from others with physical access to this device when it is shut down.")) { hexpand = true, @@ -70,7 +72,9 @@ public class EncryptView : AbstractInstallerView { xalign = 0 }; - var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic", Gtk.IconSize.LARGE_TOOLBAR); + var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic") { + pixel_size = 24 + }; var restart_label = new Gtk.Label (_("The encryption password will be required each time this device is turned on. Store it somewhere safe.")) { hexpand = true, @@ -79,7 +83,9 @@ public class EncryptView : AbstractInstallerView { xalign = 0 }; - var keyboard_image = new Gtk.Image.from_icon_name ("input-keyboard-symbolic", Gtk.IconSize.LARGE_TOOLBAR); + var keyboard_image = new Gtk.Image.from_icon_name ("input-keyboard-symbolic") { + pixel_size = 24 + }; var keyboard_label = new Gtk.Label (_("A built-in or USB keyboard will be required to type the encryption password each time this device is turned on.")) { hexpand = true, diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index f74554d92..73347b26d 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -24,7 +24,7 @@ public class ErrorView : AbstractInstallerView { } construct { - var image = new Gtk.Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG) { + var image = new Gtk.Image.from_icon_name ("dialog-error") { pixel_size = 128, valign = Gtk.Align.END }; @@ -41,7 +41,7 @@ public class ErrorView : AbstractInstallerView { xalign = 0 }; - var redo_image = new Gtk.Image.from_icon_name ("edit-undo-symbolic", Gtk.IconSize.MENU) { + var redo_image = new Gtk.Image.from_icon_name ("edit-undo-symbolic") { margin_start = 6 }; @@ -52,7 +52,7 @@ public class ErrorView : AbstractInstallerView { xalign = 0 }; - var demo_image = new Gtk.Image.from_icon_name ("document-properties-symbolic", Gtk.IconSize.MENU) { + var demo_image = new Gtk.Image.from_icon_name ("document-properties-symbolic") { margin_start = 6 }; @@ -62,7 +62,7 @@ public class ErrorView : AbstractInstallerView { xalign = 0 }; - var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic", Gtk.IconSize.MENU) { + var restart_image = new Gtk.Image.from_icon_name ("system-reboot-symbolic") { margin_start = 6 }; @@ -75,7 +75,7 @@ public class ErrorView : AbstractInstallerView { var terminal_button = new Gtk.ToggleButton () { always_show_image = true, halign = Gtk.Align.START, - image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic", Gtk.IconSize.SMALL_TOOLBAR), + image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic"), label = _("Details"), margin_top = 12 }; diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index c78163749..b9cad496a 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -22,7 +22,7 @@ public class KeyboardLayoutView : AbstractInstallerView { construct { keyboard_settings = new GLib.Settings ("org.gnome.desktop.input-sources"); - var image = new Gtk.Image.from_icon_name ("input-keyboard", Gtk.IconSize.DIALOG) { + var image = new Gtk.Image.from_icon_name ("input-keyboard") { pixel_size = 128, valign = Gtk.Align.END }; diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 323c9ad17..0c95a521f 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -38,7 +38,7 @@ public class Installer.LanguageView : AbstractInstallerView { preferred_langs.add (lang); } - var image = new Gtk.Image.from_icon_name ("preferences-desktop-locale", Gtk.IconSize.DIALOG) { + var image = new Gtk.Image.from_icon_name ("preferences-desktop-locale") { pixel_size = 128, valign = Gtk.Align.END }; @@ -315,7 +315,6 @@ public class Installer.LanguageView : AbstractInstallerView { image = new Gtk.Image (); image.hexpand = true; image.halign = Gtk.Align.END; - image.icon_size = Gtk.IconSize.BUTTON; var label = new Gtk.Label (lang_entry.name) { ellipsize = Pango.EllipsizeMode.END, @@ -362,7 +361,6 @@ public class Installer.LanguageView : AbstractInstallerView { image = new Gtk.Image (); image.hexpand = true; image.halign = Gtk.Align.END; - image.icon_size = Gtk.IconSize.BUTTON; var label = new Gtk.Label (country_entry.name); label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 32a2f78a7..37526ebd3 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -72,7 +72,7 @@ public class ProgressView : AbstractInstallerView { var terminal_button = new Gtk.ToggleButton () { halign = Gtk.Align.END, - image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic", Gtk.IconSize.SMALL_TOOLBAR), + image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic"), tooltip_text = _("Show log") }; terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT); diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index ae0bff262..883fc5689 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -21,7 +21,7 @@ public class SuccessView : AbstractInstallerView { private Gtk.Label secondary_label; construct { - var image = new Gtk.Image.from_icon_name ("process-completed", Gtk.IconSize.DIALOG) { + var image = new Gtk.Image.from_icon_name ("process-completed") { pixel_size = 128, valign = Gtk.Align.END }; diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index 6166eaec7..df9b969e5 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -20,7 +20,7 @@ public class Installer.TryInstallView : AbstractInstallerView { public signal void next_step (); construct { - var type_image = new Gtk.Image.from_icon_name (Application.get_default ().application_id, Gtk.IconSize.DIALOG) { + var type_image = new Gtk.Image.from_icon_name (Application.get_default ().application_id) { pixel_size = 128, valign = Gtk.Align.END }; diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index a0c9dfd47..ac9c7a09c 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -44,10 +44,14 @@ public class Installer.DecryptMenu: Gtk.Popover { } private void create_decrypt_view () { - var image = new Gtk.Image.from_icon_name ("drive-harddisk", Gtk.IconSize.DIALOG); + var image = new Gtk.Image.from_icon_name ("drive-harddisk") { + pixel_size = 48 + }; image.valign = Gtk.Align.START; - var overlay_image = new Gtk.Image.from_icon_name ("dialog-password", Gtk.IconSize.DND); + var overlay_image = new Gtk.Image.from_icon_name ("dialog-password") { + icon_size = LARGE + }; overlay_image.halign = Gtk.Align.END; overlay_image.valign = Gtk.Align.END; diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala index 721bae2ab..5b53d0c6b 100644 --- a/src/Widgets/DiskGrid.vala +++ b/src/Widgets/DiskGrid.vala @@ -35,7 +35,8 @@ public class Installer.DiskButton : Gtk.CheckButton { construct { add_css_class ("image-button"); - var disk_image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG) { + var disk_image = new Gtk.Image.from_icon_name (icon_name) { + pixel_size = 48, use_fallback = true }; diff --git a/src/Widgets/InstallTypeGrid.vala b/src/Widgets/InstallTypeGrid.vala index d3a1a69b9..8f28c6586 100644 --- a/src/Widgets/InstallTypeGrid.vala +++ b/src/Widgets/InstallTypeGrid.vala @@ -33,7 +33,9 @@ public class Installer.InstallTypeButton : Gtk.CheckButton { construct { add_css_class ("image-button"); - var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG); + var image = new Gtk.Image.from_icon_name (icon_name) { + pixel_size = 48 + }; var title_label = new Gtk.Label (title) { hexpand = true, From 9da35d84b2b39afb4725a4a1fa7e7b6a1d13720a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:45:32 -0700 Subject: [PATCH 09/34] button.icon_name --- src/Views/ErrorView.vala | 2 +- src/Views/ProgressView.vala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index 73347b26d..d95153e4f 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -75,7 +75,7 @@ public class ErrorView : AbstractInstallerView { var terminal_button = new Gtk.ToggleButton () { always_show_image = true, halign = Gtk.Align.START, - image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic"), + icon_name = "utilities-terminal-symbolic", label = _("Details"), margin_top = 12 }; diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 37526ebd3..b7445d922 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -72,7 +72,7 @@ public class ProgressView : AbstractInstallerView { var terminal_button = new Gtk.ToggleButton () { halign = Gtk.Align.END, - image = new Gtk.Image.from_icon_name ("utilities-terminal-symbolic"), + icon_name = "utilities-terminal-symbolic", tooltip_text = _("Show log") }; terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT); From 1be7169a79e68dedecd1677ce2f344d448d4c057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:48:19 -0700 Subject: [PATCH 10/34] fix some stack adds --- src/Views/DiskView.vala | 2 +- src/Views/EncryptView.vala | 4 ++-- src/Views/LanguageView.vala | 4 ++-- src/Views/ProgressView.vala | 4 ++-- src/Widgets/DecryptMenu.vala | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index b7f8cb809..e742e2cbe 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -86,7 +86,7 @@ public class Installer.DiskView : AbstractInstallerView { load_stack = new Gtk.Stack () { transition_type = Gtk.StackTransitionType.CROSSFADE }; - load_stack.add (load_box); + load_stack.add_child (load_box); load_stack.add_named (disk_scrolled, "disk"); var title_grid = new Gtk.Grid () { diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 8c821bde8..43fabce47 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -157,8 +157,8 @@ public class EncryptView : AbstractInstallerView { valign = Gtk.Align.CENTER, vexpand = true }; - stack.add (choice_grid); - stack.add (password_box); + stack.add_child (choice_grid); + stack.add_child (password_box); content_area.column_homogeneous = true; content_area.margin_end = 12; diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 0c95a521f..690b6110c 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -51,7 +51,7 @@ public class Installer.LanguageView : AbstractInstallerView { select_stack.valign = Gtk.Align.START; select_stack.add_css_class ("h2"); select_stack.transition_type = Gtk.StackTransitionType.CROSSFADE; - select_stack.add (select_label); + select_stack.add_child (select_label); select_stack.notify["transition-running"].connect (() => { if (!select_stack.transition_running) { @@ -274,7 +274,7 @@ public class Installer.LanguageView : AbstractInstallerView { Environment.set_variable ("LANGUAGE", ((LangRow) row).lang_entry.get_code (), true); Intl.textdomain (Build.GETTEXT_PACKAGE); select_label = new Gtk.Label (_("Select a Language")); - select_stack.add (select_label); + select_stack.add_child (select_label); select_stack.set_visible_child (select_label); if (current_lang != null) { diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index b7445d922..e47862466 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -67,8 +67,8 @@ public class ProgressView : AbstractInstallerView { var logo_stack = new Gtk.Stack () { transition_type = Gtk.StackTransitionType.OVER_UP_DOWN }; - logo_stack.add (logo_overlay); - logo_stack.add (terminal_view); + logo_stack.add_child (logo_overlay); + logo_stack.add_child (terminal_view); var terminal_button = new Gtk.ToggleButton () { halign = Gtk.Align.END, diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index ac9c7a09c..e2122094d 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -125,7 +125,7 @@ public class Installer.DecryptMenu: Gtk.Popover { decrypt_view.attach (pv_entry, 1, 2); decrypt_view.attach (decrypt_button, 0, 3, 2); - stack.add (decrypt_view); + stack.add_child (decrypt_view); stack.visible_child = decrypt_view; pass_entry.grab_focus_without_selecting (); } @@ -186,7 +186,7 @@ public class Installer.DecryptMenu: Gtk.Popover { box.append (label); box.append (info); - stack.add (box); + stack.add_child (box); stack.visible_child = box; } From dd54b59ca1e2bc7b1592b0ea46843b8e39ff0a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:49:09 -0700 Subject: [PATCH 11/34] ScrolledWindow --- src/Views/DiskView.vala | 2 +- src/Views/PartitioningView.vala | 2 +- src/Views/TryInstallView.vala | 2 +- src/Widgets/DiskBar.vala | 2 +- src/Widgets/VariantWidget.vala | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index e742e2cbe..bfb17395b 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -58,7 +58,7 @@ public class Installer.DiskView : AbstractInstallerView { disk_box = new Gtk.Box (VERTICAL, 6); - var disk_scrolled = new Gtk.ScrolledWindow (null, null) { + var disk_scrolled = new Gtk.ScrolledWindow () { child = disk_box, hscrollbar_policy = Gtk.PolicyType.NEVER, propagate_natural_height = true diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index dd459b8cb..e61fa089e 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -82,7 +82,7 @@ public class Installer.PartitioningView : AbstractInstallerView { valign = Gtk.Align.CENTER }; - var disk_scroller = new Gtk.ScrolledWindow (null, null); + var disk_scroller = new Gtk.ScrolledWindow (); disk_scroller.hexpand = true; disk_scroller.hscrollbar_policy = Gtk.PolicyType.NEVER; disk_scroller.add (disk_list); diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index df9b969e5..045d629b1 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -67,7 +67,7 @@ public class Installer.TryInstallView : AbstractInstallerView { type_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); type_box.append (custom_button); - var type_scrolled = new Gtk.ScrolledWindow (null, null) { + var type_scrolled = new Gtk.ScrolledWindow () { child = type_box, hscrollbar_policy = NEVER, propagate_natural_height = true diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 3ba956296..e9beafad4 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -84,7 +84,7 @@ public class Installer.DiskBar: Gtk.Grid { legend_container.halign = Gtk.Align.CENTER; legend_container.margin_bottom = 9; - var legend = new Gtk.ScrolledWindow (null, null); + var legend = new Gtk.ScrolledWindow (); legend.vscrollbar_policy = Gtk.PolicyType.NEVER; legend.add (legend_container); diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index 1d5fc7d89..88264cc3d 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -29,7 +29,7 @@ public class VariantWidget : Gtk.Frame { construct { main_listbox = new Gtk.ListBox (); - var main_scrolled = new Gtk.ScrolledWindow (null, null) { + var main_scrolled = new Gtk.ScrolledWindow () { child = main_listbox, hscrollbar_policy = NEVER }; @@ -37,7 +37,7 @@ public class VariantWidget : Gtk.Frame { variant_listbox = new Gtk.ListBox (); variant_listbox.activate_on_single_click = false; - var variant_scrolled = new Gtk.ScrolledWindow (null, null) { + var variant_scrolled = new Gtk.ScrolledWindow () { child = variant_listbox, hscrollbar_policy = NEVER, vexpand = true From 72b6c6328b0aca6bfbce29220789569a3e4a4475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 11:54:58 -0700 Subject: [PATCH 12/34] Leafle stuff --- src/MainWindow.vala | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 49370387b..586570282 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -42,7 +42,7 @@ public class Installer.MainWindow : Gtk.Window { can_navigate_back = true, can_unfold = false }; - leaflet.add (language_view); + leaflet.append (language_view); infobar_label = new Gtk.Label ("") { use_markup = true @@ -151,8 +151,8 @@ public class Installer.MainWindow : Gtk.Window { var keyboard_layout_view = new KeyboardLayoutView (); try_install_view = new TryInstallView (); - leaflet.add (keyboard_layout_view); - leaflet.add (try_install_view); + leaflet.append (keyboard_layout_view); + leaflet.append (try_install_view); leaflet.visible_child = keyboard_layout_view; @@ -174,7 +174,7 @@ public class Installer.MainWindow : Gtk.Window { private void load_disk_view () { var disk_view = new DiskView (); - leaflet.add (disk_view); + leaflet.append (disk_view); disk_view.load.begin (MINIMUM_SPACE); disk_view.cancel.connect (() => leaflet.navigate (BACK)); @@ -187,7 +187,7 @@ public class Installer.MainWindow : Gtk.Window { var check_view = new Installer.CheckView (); if (check_view.has_messages) { - leaflet.add (check_view); + leaflet.append (check_view); } check_view.cancel.connect (() => leaflet.navigate (BACK)); @@ -200,7 +200,7 @@ public class Installer.MainWindow : Gtk.Window { private void load_encrypt_view () { var encrypt_view = new EncryptView (); - leaflet.add (encrypt_view); + leaflet.append (encrypt_view); encrypt_view.cancel.connect (() => { leaflet.visible_child = try_install_view; @@ -209,7 +209,7 @@ public class Installer.MainWindow : Gtk.Window { private void load_partitioning_view () { var partitioning_view = new PartitioningView (MINIMUM_SPACE); - leaflet.add (partitioning_view); + leaflet.append (partitioning_view); partitioning_view.next_step.connect (() => { unowned Configuration config = Configuration.get_default (); @@ -221,7 +221,7 @@ public class Installer.MainWindow : Gtk.Window { private void load_drivers_view () { var drivers_view = new DriversView (); - leaflet.add (drivers_view); + leaflet.append (drivers_view); drivers_view.next_step.connect (() => load_progress_view ()); } @@ -229,9 +229,9 @@ public class Installer.MainWindow : Gtk.Window { private void load_progress_view () { var progress_view = new ProgressView (); - leaflet.add (progress_view); + leaflet.append (progress_view); leaflet.visible_child = progress_view; - leaflet.can_swipe_back = false; + leaflet.can_navigate_back = false; progress_view.on_success.connect (() => load_success_view ()); @@ -243,18 +243,18 @@ public class Installer.MainWindow : Gtk.Window { private void load_success_view () { var success_view = new SuccessView (); - leaflet.add (success_view); + leaflet.append (success_view); leaflet.visible_child = success_view; } private void load_error_view (string log) { var error_view = new ErrorView (log); - leaflet.add (error_view); + leaflet.append (error_view); leaflet.visible_child = error_view; error_view.retry_install.connect (() => { leaflet.visible_child = try_install_view; - leaflet.can_swipe_back = true; + leaflet.can_navigate_back = true; }); } From a9a04b79443f8ab706d339f8d93b147c5af5f6d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 12:16:16 -0700 Subject: [PATCH 13/34] More stuff --- src/Views/PartitioningView.vala | 26 ++++++++++++-------------- src/Widgets/DiskBar.vala | 26 +++++++++----------------- src/Widgets/DiskGrid.vala | 2 +- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index dc5f622b1..ee1605ee7 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -23,7 +23,7 @@ public class Installer.PartitioningView : AbstractInstallerView { private Gtk.Button next_button; private Gtk.Button modify_partitions_button; - private Gtk.Grid disk_list; + private Gtk.Box disk_list; private Gtk.Stack load_stack; private string required_description; @@ -50,7 +50,7 @@ public class Installer.PartitioningView : AbstractInstallerView { luks = new Gee.ArrayList (); var title_label = new Gtk.Label (_("Select Partitions")); - title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); var format_row = new DescriptionRow ( _("Selecting “Format” will erase all data on the selected partition."), @@ -86,16 +86,14 @@ public class Installer.PartitioningView : AbstractInstallerView { margin_end = 12, margin_start = 12 }; - description_box.add (format_row); - description_box.add (required_row); - description_box.add (recommended_row); + description_box.append (format_row); + description_box.append (required_row); + description_box.append (recommended_row); - disk_list = new Gtk.Grid () { + disk_list = new Gtk.Box (VERTICAL, 24) { margin_end = 12, margin_start = 12, - row_spacing = 24, - orientation = VERTICAL, - valign = Gtk.Align.CENTER + valign = CENTER }; var disk_scroller = new Gtk.ScrolledWindow () { @@ -177,7 +175,7 @@ public class Installer.PartitioningView : AbstractInstallerView { } var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions); - disk_list.add (disk_bar); + disk_list.append (disk_bar); } foreach (unowned InstallerDaemon.Disk disk in disks.logical_disks) { @@ -226,7 +224,7 @@ public class Installer.PartitioningView : AbstractInstallerView { } var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions); - disk_list.add (disk_bar); + disk_list.append (disk_bar); } private void validate_status () { @@ -339,11 +337,11 @@ public class Installer.PartitioningView : AbstractInstallerView { private class DescriptionRow : Gtk.Box { public DescriptionRow (string description, string icon_name, string color) { - var image = new Gtk.Image.from_icon_name (icon_name, MENU) { + var image = new Gtk.Image.from_icon_name (icon_name) { valign = Gtk.Align.START }; - image.get_style_context ().add_class (Granite.STYLE_CLASS_ACCENT); - image.get_style_context ().add_class (color); + image.add_css_class (Granite.STYLE_CLASS_ACCENT); + image.add_css_class (color); var description_label = new Gtk.Label (description) { hexpand = true, diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index ac5f82ab8..e731895e0 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -27,26 +27,18 @@ public class Installer.DiskBar: Gtk.Box { } construct { - var name_label = new Granite.HeaderLabel (disk_name); - - var size_label = new Gtk.Label ("%s %s".printf (disk_path, GLib.format_size (size))) { - xalign = 0 + var name_label = new Granite.HeaderLabel (disk_name) { + secondary_text = "%s %s".printf (disk_path, GLib.format_size (size)) }; - size_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - size_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); - - var label_box = new Gtk.Box (VERTICAL, 0); - label_box.append (name_label); - label_box.append (size_label); - var bar = new Gtk.Grid (); + var bar = new Gtk.Box (HORIZONTAL, 0); bar.size_allocate.connect ((alloc) => { update_sector_lengths (partitions, alloc); }); foreach (PartitionBar part in partitions) { - bar.add (part); + bar.append (part); } legend_box = new Gtk.Box (VERTICAL, 6) { @@ -84,7 +76,7 @@ public class Installer.DiskBar: Gtk.Box { orientation = VERTICAL; hexpand = true; spacing = 12; - append (label_box); + append (name_label ); append (bar); append (legend_box); } @@ -93,8 +85,8 @@ public class Installer.DiskBar: Gtk.Box { var fill_round = new Block () { valign = CENTER }; - fill_round.get_style_context ().add_class ("legend"); - fill_round.get_style_context ().add_class (fs); + fill_round.add_css_class ("legend"); + fill_round.add_css_class (fs); var format_size = GLib.format_size (size); @@ -105,8 +97,8 @@ public class Installer.DiskBar: Gtk.Box { ) { halign = START, }; - info.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); - info.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + info.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + info.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); info.use_markup = true; var path = new Gtk.Label (ppath) { diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala index 5b53d0c6b..a088f7f5d 100644 --- a/src/Widgets/DiskGrid.vala +++ b/src/Widgets/DiskGrid.vala @@ -64,7 +64,7 @@ public class Installer.DiskButton : Gtk.CheckButton { grid.attach (name_label, 1, 0); grid.attach (size_label, 1, 1); - add (grid); + child = grid; notify["active"].connect (() => { if (active) { From 16563a8c2a5ec07c7372ab3b31135a7493149e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 12:18:05 -0700 Subject: [PATCH 14/34] more box adds --- src/Views/AbstractInstallerView.vala | 6 +++--- src/Views/PartitioningView.vala | 6 +++--- src/Widgets/DiskBar.vala | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index 44cd5b472..d4ebf3dd1 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -51,17 +51,17 @@ public abstract class AbstractInstallerView : Gtk.Box { margin_start = 10, margin_end = 10 }; - action_area.add (action_box_start); + action_area.append (action_box_start); action_area.add_css_class ("button-box"); if (Installer.App.test_mode) { var test_label = new Gtk.Label (_("Test Mode")); test_label.add_css_class (Gtk.STYLE_CLASS_ERROR); - action_area.add (test_label); + action_area.append (test_label); } - action_area.add (action_box_end); + action_area.append (action_box_end); if (cancellable) { var cancel_button = new Gtk.Button.with_label (_("Cancel Installation")); diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index ee1605ee7..6ebdc2536 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -141,7 +141,7 @@ public class Installer.PartitioningView : AbstractInstallerView { next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); next_button.sensitive = false; - action_box_start.add (modify_partitions_button); + action_box_start.append (modify_partitions_button); action_box_end.append (back_button); action_box_end.append (next_button); @@ -352,8 +352,8 @@ public class Installer.PartitioningView : AbstractInstallerView { }; spacing = 12; - add (image); - add (description_label); + append (image); + append (description_label); } } } diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index e731895e0..13ff1151a 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -122,7 +122,7 @@ public class Installer.DiskBar: Gtk.Box { }); } - legend_box.add (event_box); + legend_box.append (event_box); } private void update_sector_lengths (Gee.ArrayList partitions, Gtk.Allocation alloc) { From 8d3539eddc3b0fb373a4ce7f89ad19a051494e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 12:34:12 -0700 Subject: [PATCH 15/34] ErrorRevealer --- src/MainWindow.vala | 2 +- src/Views/EncryptView.vala | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 586570282..2d78c2514 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -58,7 +58,7 @@ public class Installer.MainWindow : Gtk.Window { halign = Gtk.Align.START, // Can't cover action area; need to select language valign = Gtk.Align.END }; - battery_infobar.get_content_area ().add (infobar_label); + battery_infobar.add_child (infobar_label); battery_infobar.add_css_class ("frame"); var overlay = new Gtk.Overlay () { diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 43fabce47..20af54bb3 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -291,25 +291,24 @@ public class EncryptView : AbstractInstallerView { } private class ErrorRevealer : Gtk.Revealer { - public Gtk.Label label_widget; - - public string label { - set { - label_widget.label = "%s".printf (value); - } - } + public Gtk.Label label_widget { get; private set; } + public string label { get; set; } public ErrorRevealer (string label) { - label_widget = new Gtk.Label ("%s".printf (label)); - label_widget.halign = Gtk.Align.END; - label_widget.justify = Gtk.Justification.RIGHT; - label_widget.max_width_chars = 55; - label_widget.use_markup = true; - label_widget.wrap = true; - label_widget.xalign = 1; + label_widget = new Gtk.Label (label) { + halign = Gtk.Align.END, + justify = Gtk.Justification.RIGHT, + max_width_chars = 55, + use_markup = true, + wrap = true, + xalign = 1 + }; + label_widget.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); transition_type = Gtk.RevealerTransitionType.CROSSFADE; - add (label_widget); + child = label_widget; + + label_widget.bind_property ("label", this, "label"); } } } From cbf4ee6753b52dfb10e70366b8593062cce788a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 12:59:59 -0700 Subject: [PATCH 16/34] Simplify buffer scrolling --- src/Views/DiskView.vala | 4 ++-- src/Views/EncryptView.vala | 4 ++-- src/Views/ProgressView.vala | 8 +++----- src/Widgets/Terminal.vala | 19 +++---------------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/Views/DiskView.vala b/src/Views/DiskView.vala index bfb17395b..e8db9c05f 100644 --- a/src/Views/DiskView.vala +++ b/src/Views/DiskView.vala @@ -156,7 +156,7 @@ public class Installer.DiskView : AbstractInstallerView { disabled_buttons += disk_button; } else { - disk_button.clicked.connect (() => { + disk_button.toggled.connect (() => { if (disk_button.active) { next_button.sensitive = true; } @@ -167,7 +167,7 @@ public class Installer.DiskView : AbstractInstallerView { } // Force the user to make a conscious selection, not spam "Next" - var no_selection = new Gtk.RadioButton (null) { + var no_selection = new Gtk.CheckButton () { active = true }; diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 20af54bb3..3fddc1f2f 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -172,7 +172,7 @@ public class EncryptView : AbstractInstallerView { var encrypt_button = new Gtk.Button.with_label (_("Choose Password")); next_button = new Gtk.Button.with_label (_(SKIP_STRING)) { - can_default = true + receives_default = true }; next_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); @@ -276,7 +276,7 @@ public class EncryptView : AbstractInstallerView { private void update_next_button () { if (pw_entry.is_valid && confirm_entry.is_valid) { next_button.sensitive = true; - next_button.has_default = true; + ((Gtk.Window) get_root ()).default_widget = next_button; } else { next_button.sensitive = false; } diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index e47862466..cea75121c 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -33,7 +33,7 @@ public class ProgressView : AbstractInstallerView { logo_icon_name = "distributor-logo"; } - var logo = new Hdy.Avatar (192, "", false) { + var logo = new Adw.Avatar (192, "", false) { // In case the wallpaper can't be loaded, we don't want an icon or text icon_name = "invalid-icon-name", // We need this for the shadow to not get clipped by Gtk.Overlay @@ -49,10 +49,8 @@ public class ProgressView : AbstractInstallerView { icon_name = logo_icon_name + "-symbolic", pixel_size = 192 }; - - unowned var icon_style_context = icon.get_style_context (); - icon_style_context.add_class ("logo"); - icon_style_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + icon.add_css_class ("logo"); + icon.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); var logo_overlay = new Gtk.Overlay () { child = logo, diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala index cfbf72a28..9fef9f5f3 100644 --- a/src/Widgets/Terminal.vala +++ b/src/Widgets/Terminal.vala @@ -22,7 +22,6 @@ public class Installer.Terminal : Gtk.ScrolledWindow { public Gtk.TextBuffer buffer { get; construct; } private Gtk.TextView view; - private double prev_upper_adj = 0; public string log { owned get { @@ -50,25 +49,13 @@ public class Installer.Terminal : Gtk.ScrolledWindow { hexpand = true; vexpand = true; min_content_height = 120; - add (view); + child = view; add_css_class (Granite.STYLE_CLASS_TERMINAL); - view.size_allocate.connect (() => attempt_scroll ()); + buffer.changed.connect (attempt_scroll); } public void attempt_scroll () { - var adj = vadjustment; - - var units_from_end = prev_upper_adj - adj.page_size - adj.value; - var view_size_difference = adj.upper - prev_upper_adj; - if (view_size_difference < 0) { - view_size_difference = 0; - } - - if (prev_upper_adj <= adj.page_size || units_from_end <= 50) { - adj.value = adj.upper; - } - - prev_upper_adj = adj.upper; + view.scroll_mark_onscreen (buffer.get_mark ("end")); } } From 981e33d406f991eb6ebb6dbb01d46425b90c11bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:02:52 -0700 Subject: [PATCH 17/34] more --- src/Views/ErrorView.vala | 14 ++++++++++---- src/Views/PartitioningView.vala | 2 +- src/Widgets/Terminal.vala | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index d95153e4f..d71fa9bd5 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -72,14 +72,20 @@ public class ErrorView : AbstractInstallerView { xalign = 0 }; + var terminal_button_label = new Gtk.Label (_("Details")); + + var terminal_button_box = new Gtk.Box (HORIZONTAL, 0); + terminal_button_box.append (new Gtk.Image.from_icon_name ("utilities-terminal-symbolic")); + terminal_button_box.append (terminal_button_label); + var terminal_button = new Gtk.ToggleButton () { - always_show_image = true, halign = Gtk.Align.START, - icon_name = "utilities-terminal-symbolic", - label = _("Details"), + has_frame = false, + child = terminal_button_box, margin_top = 12 }; - terminal_button.add_css_class (Granite.STYLE_CLASS_FLAT); + + terminal_button_label.mnemonic_widget = terminal_button; var buffer = new Gtk.TextBuffer (null) { text = log diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 6ebdc2536..1c1d2fdc9 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -145,7 +145,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 (Hdy.NavigationDirection.BACK)); + back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); next_button.clicked.connect (() => next_step ()); } diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala index 9fef9f5f3..aaa335bc9 100644 --- a/src/Widgets/Terminal.vala +++ b/src/Widgets/Terminal.vala @@ -43,7 +43,7 @@ public class Installer.Terminal : Gtk.ScrolledWindow { pixels_below_lines = 3, wrap_mode = Gtk.WrapMode.WORD }; - view.get_style_context ().remove_class (Granite.STYLE_CLASS_VIEW); + view.remove_css_class (Granite.STYLE_CLASS_VIEW); hscrollbar_policy = Gtk.PolicyType.NEVER; hexpand = true; From 998bc418eaa2e0737c30f5792f1ba685abcc6b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:23:43 -0700 Subject: [PATCH 18/34] Almost done --- src/Application.vala | 13 +++---------- src/Views/AbstractInstallerView.vala | 6 +++--- src/Views/CheckView.vala | 2 +- src/Views/KeyboardLayoutView.vala | 25 ++++++++++++++----------- src/Views/LanguageView.vala | 23 +++++++++++++---------- src/Views/SuccessView.vala | 2 +- src/Views/TryInstallView.vala | 8 ++++---- src/Widgets/DecryptMenu.vala | 4 ++-- src/Widgets/DiskBar.vala | 8 ++++---- src/Widgets/DiskGrid.vala | 2 +- src/Widgets/InstallTypeGrid.vala | 4 ++-- src/Widgets/PartitionBar.vala | 6 +++--- src/Widgets/PartitionMenu.vala | 4 ++-- src/Widgets/VariantWidget.vala | 24 +++++++++++------------- 14 files changed, 64 insertions(+), 67 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index ac5d5dd14..b2e931a11 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -32,19 +32,12 @@ public class Installer.App : Gtk.Application { public override void startup () { base.startup (); - var css_provider = new Gtk.CssProvider (); - css_provider.load_from_resource ("io/elementary/installer/Application.css"); - - Gtk.StyleContext.add_provider_for_screen ( - Gdk.Screen.get_default (), - css_provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION - ); + Granite.init (); var css_fallback = new Gtk.CssProvider (); css_fallback.load_from_resource ("io/elementary/installer/disk-bar-fallback.css"); - Gtk.StyleContext.add_provider_for_screen ( - Gdk.Screen.get_default (), + Gtk.StyleContext.add_provider_for_display ( + Gdk.Display.get_default (), css_fallback, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION ); diff --git a/src/Views/AbstractInstallerView.vala b/src/Views/AbstractInstallerView.vala index d4ebf3dd1..7c3808d3f 100644 --- a/src/Views/AbstractInstallerView.vala +++ b/src/Views/AbstractInstallerView.vala @@ -56,7 +56,7 @@ public abstract class AbstractInstallerView : Gtk.Box { if (Installer.App.test_mode) { var test_label = new Gtk.Label (_("Test Mode")); - test_label.add_css_class (Gtk.STYLE_CLASS_ERROR); + test_label.add_css_class (Granite.STYLE_CLASS_ERROR); action_area.append (test_label); } @@ -76,7 +76,7 @@ public abstract class AbstractInstallerView : Gtk.Box { spacing = 24; margin_top = 12; margin_bottom = 12; - add (content_area); - add (action_area); + append (content_area); + append (action_area); } } diff --git a/src/Views/CheckView.vala b/src/Views/CheckView.vala index cdfc326ee..687f94f58 100644 --- a/src/Views/CheckView.vala +++ b/src/Views/CheckView.vala @@ -30,7 +30,7 @@ public class Installer.CheckView : AbstractInstallerView { private Gtk.Box message_box; public bool has_messages { get { - return message_box.get_children ().length () > 0; + return message_box.get_first_child != null; } } diff --git a/src/Views/KeyboardLayoutView.vala b/src/Views/KeyboardLayoutView.vala index b9cad496a..948f350eb 100644 --- a/src/Views/KeyboardLayoutView.vala +++ b/src/Views/KeyboardLayoutView.vala @@ -42,8 +42,8 @@ public class KeyboardLayoutView : AbstractInstallerView { }; var stack_box = new Gtk.Box (VERTICAL, 12); - stack_box.add (input_variant_widget); - stack_box.add (keyboard_test_entry); + stack_box.append (input_variant_widget); + stack_box.append (keyboard_test_entry); content_area.column_homogeneous = true; content_area.margin_end = 12; @@ -118,9 +118,9 @@ public class KeyboardLayoutView : AbstractInstallerView { } input_variant_widget.clear_variants (); - input_variant_widget.variant_listbox.add (new VariantRow (null, _("Default"))); + input_variant_widget.variant_listbox.append (new VariantRow (null, _("Default"))); foreach (var variant in variants.entries) { - input_variant_widget.variant_listbox.add (new VariantRow (variant.key, variant.value)); + input_variant_widget.variant_listbox.append (new VariantRow (variant.key, variant.value)); } input_variant_widget.variant_listbox.select_row (input_variant_widget.variant_listbox.get_row_at_index (0)); @@ -180,23 +180,26 @@ public class KeyboardLayoutView : AbstractInstallerView { }); foreach (var layout in KeyboardLayoutHelper.get_layouts ()) { - input_variant_widget.main_listbox.add (new LayoutRow (layout)); + input_variant_widget.main_listbox.append (new LayoutRow (layout)); } Idle.add_once (() => { - string? country = Configuration.get_default ().country; + unowned string? country = Configuration.get_default ().country; if (country != null) { - string default_layout = country.down (); + var default_layout = country.down (); - foreach (weak Gtk.Widget child in input_variant_widget.main_listbox.get_children ()) { + var child = input_variant_widget.main_listbox.get_first_child (); + while (child != null) { if (child is LayoutRow) { - weak LayoutRow row = (LayoutRow) child; + unowned var row = (LayoutRow) child; if (row.layout.name == default_layout) { input_variant_widget.main_listbox.select_row (row); row.grab_focus (); break; } } + + child = child.get_next_sibling (); } } }); @@ -225,7 +228,7 @@ public class KeyboardLayoutView : AbstractInstallerView { }; label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); - add (label); + child = label; } } @@ -251,7 +254,7 @@ public class KeyboardLayoutView : AbstractInstallerView { }; label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); - add (label); + child = label; } } } diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index 690b6110c..c1af46866 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -55,11 +55,7 @@ public class Installer.LanguageView : AbstractInstallerView { select_stack.notify["transition-running"].connect (() => { if (!select_stack.transition_running) { - select_stack.get_children ().foreach ((child) => { - if (child != select_stack.get_visible_child ()) { - child.destroy (); - } - }); + select_stack.remove (select_stack.get_visible_child ().get_prev_sibling ()); } }); @@ -197,11 +193,12 @@ public class Installer.LanguageView : AbstractInstallerView { lang_variant_widget.variant_listbox.row_selected.connect (variant_row_selected); var current_lang = Environment.get_variable ("LANGUAGE"); - var lang_entry = ((LangRow) row).lang_entry; + unowned var lang_entry = ((LangRow) row).lang_entry; Environment.set_variable ("LANGUAGE", lang_entry.get_code (), true); Intl.textdomain (Build.GETTEXT_PACKAGE); - foreach (Gtk.Widget child in lang_variant_widget.main_listbox.get_children ()) { + var child = lang_variant_widget.main_listbox.get_first_child (); + while (child != null) { if (child is LangRow) { var lang_row = (LangRow) child; if (lang_row.lang_entry.get_code () == lang_entry.get_code ()) { @@ -210,6 +207,8 @@ public class Installer.LanguageView : AbstractInstallerView { lang_row.selected = false; } } + + child = child.get_next_sibling (); } if (current_lang != null) { @@ -222,16 +221,20 @@ public class Installer.LanguageView : AbstractInstallerView { } private void variant_row_selected (Gtk.ListBoxRow? row) { - var country_entry = ((CountryRow) row).country_entry; - foreach (Gtk.Widget child in lang_variant_widget.variant_listbox.get_children ()) { + unowned var country_entry = ((CountryRow) row).country_entry; + + var child = lang_variant_widget.variant_listbox.get_first_child (); + while (child != null) { if (child is CountryRow) { - var country_row = (CountryRow) child; + unowned var country_row = (CountryRow) child; if (country_row.country_entry.alpha_2 == country_entry.alpha_2) { country_row.selected = true; } else { country_row.selected = false; } } + + child = child.get_next_sibling (); } next_button.sensitive = true; diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index 883fc5689..a007d9153 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -37,7 +37,7 @@ public class SuccessView : AbstractInstallerView { wrap = true, xalign = 0 }; - primary_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + primary_label.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL); secondary_label = new Gtk.Label (null) { max_width_chars = 1, // Make Gtk wrap, but not expand the window diff --git a/src/Views/TryInstallView.vala b/src/Views/TryInstallView.vala index 045d629b1..18e8f7022 100644 --- a/src/Views/TryInstallView.vala +++ b/src/Views/TryInstallView.vala @@ -31,7 +31,7 @@ public class Installer.TryInstallView : AbstractInstallerView { type_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL); // Force the user to make a conscious selection, not spam "Next" - var no_selection = new Gtk.RadioButton (null) { + var no_selection = new Gtk.CheckButton () { active = true }; @@ -93,21 +93,21 @@ public class Installer.TryInstallView : AbstractInstallerView { back_button.clicked.connect (() => ((Adw.Leaflet) get_parent ()).navigate (BACK)); - demo_button.clicked.connect (() => { + demo_button.toggled.connect (() => { if (demo_button.active) { next_button.label = demo_button.title; next_button.sensitive = true; } }); - clean_install_button.clicked.connect (() => { + clean_install_button.toggled.connect (() => { if (clean_install_button.active) { next_button.label = clean_install_button.title; next_button.sensitive = true; } }); - custom_button.clicked.connect (() => { + custom_button.toggled.connect (() => { if (custom_button.active) { next_button.label = _("Custom Install"); next_button.sensitive = true; diff --git a/src/Widgets/DecryptMenu.vala b/src/Widgets/DecryptMenu.vala index e2122094d..ae651d43c 100644 --- a/src/Widgets/DecryptMenu.vala +++ b/src/Widgets/DecryptMenu.vala @@ -40,7 +40,7 @@ public class Installer.DecryptMenu: Gtk.Popover { margin_start = 12 }; create_decrypt_view (); - add (stack); + child = stack; } private void create_decrypt_view () { @@ -64,7 +64,7 @@ public class Installer.DecryptMenu: Gtk.Popover { overlay.add_overlay (overlay_image); var primary_label = new Gtk.Label (_("Decrypt This Partition")); - primary_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + primary_label.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL); primary_label.halign = Gtk.Align.START; var secondary_label = new Gtk.Label (_("Enter the partition's encryption password and set a device name for the decrypted partition.")); diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 13ff1151a..b8d0a7a9b 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -48,7 +48,7 @@ public class Installer.DiskBar: Gtk.Box { foreach (PartitionBar p in partitions) { add_legend ( p.partition.device_path, - p.get_size () * 512, + p.get_partition_size () * 512, Distinst.strfilesys (p.partition.filesystem), p.volume_group, p.menu @@ -57,7 +57,7 @@ public class Installer.DiskBar: Gtk.Box { uint64 used = 0; foreach (PartitionBar partition in partitions) { - used += partition.get_size (); + used += partition.get_partition_size (); } var unused = size - (used * 512); @@ -70,7 +70,7 @@ public class Installer.DiskBar: Gtk.Box { }; unused_bar.add_css_class ("unused"); - bar.add (unused_bar); + bar.append (unused_bar); } orientation = VERTICAL; @@ -159,7 +159,7 @@ public class Installer.DiskBar: Gtk.Box { } alloc_width -= requested; - disk_sectors -= part.get_size (); + disk_sectors -= part.get_partition_size (); lengths += requested; } diff --git a/src/Widgets/DiskGrid.vala b/src/Widgets/DiskGrid.vala index a088f7f5d..4e46185ad 100644 --- a/src/Widgets/DiskGrid.vala +++ b/src/Widgets/DiskGrid.vala @@ -45,7 +45,7 @@ public class Installer.DiskButton : Gtk.CheckButton { halign = Gtk.Align.START, valign = Gtk.Align.END }; - name_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + name_label.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL); var size_label = new Gtk.Label ("%s %s".printf (disk_path, GLib.format_size (size))) { ellipsize = Pango.EllipsizeMode.MIDDLE, diff --git a/src/Widgets/InstallTypeGrid.vala b/src/Widgets/InstallTypeGrid.vala index 8f28c6586..1a8723474 100644 --- a/src/Widgets/InstallTypeGrid.vala +++ b/src/Widgets/InstallTypeGrid.vala @@ -41,7 +41,7 @@ public class Installer.InstallTypeButton : Gtk.CheckButton { hexpand = true, xalign = 0 }; - title_label.add_css_class (Granite.STYLE_CLASS_PRIMARY_LABEL); + title_label.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL); var subtitle_label = new Gtk.Label (subtitle) { max_width_chars = 1, // Make Gtk wrap, but not expand the window @@ -61,6 +61,6 @@ public class Installer.InstallTypeButton : Gtk.CheckButton { grid.attach (title_label, 1, 0); grid.attach (subtitle_label, 1, 1); - add (grid); + child = grid; } } diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index 9612e0198..2ac099b27 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -41,7 +41,7 @@ public class Installer.PartitionBar : Gtk.Box { menu = new PartitionMenu (partition.device_path, parent_path, partition.filesystem, lvm, set_mount, unset_mount, mount_set, this); } - menu.relative_to = this; + menu.set_parent (this); menu.position = BOTTOM; click_gesture = new Gtk.GestureClickPress (); @@ -72,12 +72,12 @@ public class Installer.PartitionBar : Gtk.Box { bind_property ("icon", image, "gicon", SYNC_CREATE); } - public uint64 get_size () { + public uint64 get_partition_size () { return partition.end_sector - partition.start_sector; } public int calculate_length (int alloc_width, uint64 disk_sectors) { - var percent = ((double) get_size () / (double) disk_sectors); + var percent = ((double) get_partition_size () / (double) disk_sectors); var request = alloc_width * percent; if (request < 20) request = 20; return (int) request; diff --git a/src/Widgets/PartitionMenu.vala b/src/Widgets/PartitionMenu.vala index a7c9597e7..659ada23d 100644 --- a/src/Widgets/PartitionMenu.vala +++ b/src/Widgets/PartitionMenu.vala @@ -137,7 +137,7 @@ public class Installer.PartitionMenu : Gtk.Popover { grid.attach (use_partition, 0, 0); grid.attach (bottom_revealer, 0, 1); - add (grid); + child = grid; custom.visible = false; @@ -267,7 +267,7 @@ public class Installer.PartitionMenu : Gtk.Popover { partition_path, parent_disk, mount, - partition_bar.get_size (), + partition_bar.get_partition_size (), (format_partition.active ? InstallerDaemon.MountFlags.FORMAT : 0) + (is_lvm ? InstallerDaemon.MountFlags.LVM : 0), filesystem, diff --git a/src/Widgets/VariantWidget.vala b/src/Widgets/VariantWidget.vala index bf39019da..cad8fdb0a 100644 --- a/src/Widgets/VariantWidget.vala +++ b/src/Widgets/VariantWidget.vala @@ -12,7 +12,7 @@ public class VariantWidget : Gtk.Frame { private Gtk.Button back_button; private Gtk.Box variant_box; private Gtk.Label variant_title; - private Adw.Leaflet deck; + private Adw.Leaflet leaflet; construct { main_listbox = new Gtk.ListBox (); @@ -49,11 +49,11 @@ public class VariantWidget : Gtk.Frame { wrap = true }; - var header_box = new Gtk.CenterBox (HORIZONTAL, 0) { + var header_box = new Gtk.CenterBox () { + start_widget = back_button, + center_widget = variant_title, hexpand = true }; - header_box.pack_start (back_button); - header_box.set_center_widget (variant_title); variant_box = new Gtk.Box (VERTICAL, 0); variant_box.add_css_class (Granite.STYLE_CLASS_VIEW); @@ -61,32 +61,30 @@ public class VariantWidget : Gtk.Frame { variant_box.append (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); variant_box.append (variant_scrolled); - deck = new Adw.Leaflet () { + leaflet = new Adw.Leaflet () { can_navigate_back = true, can_unfold = false }; - deck.add (main_scrolled); - deck.add (variant_box); + leaflet.append (main_scrolled); + leaflet.append (variant_box); - child = deck; + child = leaflet; vexpand = true; back_button.clicked.connect (() => { going_to_main (); - deck.navigate (BACK); + leaflet.navigate (BACK); }); } public void show_variants (string back_button_label, string variant_title_label) { back_button.label = back_button_label; variant_title.label = variant_title_label; - deck.visible_child = variant_box; + leaflet.visible_child = variant_box; } public void clear_variants () { - variant_listbox.get_children ().foreach ((child) => { - child.destroy (); - }); + variant_listbox.remove_all (); } } From 6a31af6169ff17843ac0e12a02c94c6f6beec15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:34:36 -0700 Subject: [PATCH 19/34] Couple last things --- src/MainWindow.vala | 4 ++-- src/Views/ProgressView.vala | 2 +- src/Widgets/DiskBar.vala | 13 +++++-------- src/Widgets/PartitionBar.vala | 4 +--- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 2d78c2514..5d3bcb864 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -131,13 +131,13 @@ public class Installer.MainWindow : Gtk.Window { update_navigation (); }); - leaflet.notify["transition-running"].connect (() => { + leaflet.notify["child-transition-running"].connect (() => { update_navigation (); }); } private void update_navigation () { - if (!leaflet.transition_running) { + 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) { diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index cea75121c..fe06afade 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -42,7 +42,7 @@ public class ProgressView : AbstractInstallerView { margin_bottom = 6, margin_start = 6 }; - logo.loadable_icon = new FileIcon (File.new_for_uri ("resource://io/elementary/installer/wallpaper.jpg")); + logo.custom_image = Gdk.Texture.from_file (File.new_for_uri ("resource://io/elementary/installer/wallpaper.jpg")); logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); var icon = new Gtk.Image () { diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index b8d0a7a9b..c881d8ff9 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -112,17 +112,14 @@ public class Installer.DiskBar: Gtk.Box { legend.attach (path, 1, 0); legend.attach (info, 1, 1); - var event_box = new Gtk.EventBox (); - event_box.add (legend); - if (menu != null) { - event_box.button_press_event.connect (() => { - menu.popup (); - return true; - }); + var click_gesture = new Gtk.GestureClick (); + click_gesture.released.connect (menu.popup); + + legend.add_controller (click_gesture); } - legend_box.append (event_box); + legend_box.append (legend); } private void update_sector_lengths (Gee.ArrayList partitions, Gtk.Allocation alloc) { diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index 2ac099b27..5c9c63e2a 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -17,8 +17,6 @@ public class Installer.PartitionBar : Gtk.Box { public string? volume_group { get; private set; } public Gtk.Popover menu { get; private set; } - private Gtk.GestureClick click_gesture; - public PartitionBar ( InstallerDaemon.Partition partition, string parent_path, @@ -44,7 +42,7 @@ public class Installer.PartitionBar : Gtk.Box { menu.set_parent (this); menu.position = BOTTOM; - click_gesture = new Gtk.GestureClickPress (); + var click_gesture = new Gtk.GestureClick (); click_gesture.released.connect (menu.popup); add_controller (click_gesture); From 9c98c817dc640f87ab9741784de795cd9b57c5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:40:45 -0700 Subject: [PATCH 20/34] Make compile --- src/Views/PartitioningView.vala | 6 +++++- src/Widgets/DiskBar.vala | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 1c1d2fdc9..d0d1f2a99 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -203,7 +203,11 @@ public class Installer.PartitioningView : AbstractInstallerView { public void reset_view () { debug ("Resetting partitioning view"); - disk_list.get_children ().foreach ((child) => child.destroy ()); + + while (disk_list.get_first_child () != null) { + disk_list.remove (disk_list.get_first_child ()); + } + mounts.clear (); luks.clear (); next_button.sensitive = false; diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index c881d8ff9..56c58ea7c 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -33,9 +33,9 @@ public class Installer.DiskBar: Gtk.Box { var bar = new Gtk.Box (HORIZONTAL, 0); - bar.size_allocate.connect ((alloc) => { - update_sector_lengths (partitions, alloc); - }); + // bar.size_allocate.connect ((alloc) => { + // update_sector_lengths (partitions, alloc); + // }); foreach (PartitionBar part in partitions) { bar.append (part); @@ -166,7 +166,7 @@ public class Installer.DiskBar: Gtk.Box { new_alloc.height = alloc.height; for (int x = 0; x < partitions.size; x++) { new_alloc.width = lengths[x]; - partitions[x].size_allocate (new_alloc); + partitions[x].allocate_size (new_alloc, 0); new_alloc.x += new_alloc.width; } } From 067f227c033e0d6fb0b606194b24d49884eea63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:46:34 -0700 Subject: [PATCH 21/34] Fix bad subclasses --- src/Views/EncryptView.vala | 24 +++++++++++++++++------- src/Widgets/Terminal.vala | 16 ++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/Views/EncryptView.vala b/src/Views/EncryptView.vala index 3fddc1f2f..a85f53a61 100644 --- a/src/Views/EncryptView.vala +++ b/src/Views/EncryptView.vala @@ -290,14 +290,19 @@ public class EncryptView : AbstractInstallerView { } } - private class ErrorRevealer : Gtk.Revealer { + private class ErrorRevealer : Gtk.Box { + public bool reveal_child { get; set; } public Gtk.Label label_widget { get; private set; } - public string label { get; set; } + public string label { get; construct set; } public ErrorRevealer (string label) { + Object (label: label); + } + + construct { label_widget = new Gtk.Label (label) { - halign = Gtk.Align.END, - justify = Gtk.Justification.RIGHT, + halign = END, + justify = RIGHT, max_width_chars = 55, use_markup = true, wrap = true, @@ -305,10 +310,15 @@ public class EncryptView : AbstractInstallerView { }; label_widget.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); - transition_type = Gtk.RevealerTransitionType.CROSSFADE; - child = label_widget; + var revealer = new Gtk.Revealer () { + child = label_widget, + transition_type = CROSSFADE + }; + + append (revealer); - label_widget.bind_property ("label", this, "label"); + bind_property ("reveal-child", revealer, "reveal-child"); + bind_property ("label", label_widget, "label"); } } } diff --git a/src/Widgets/Terminal.vala b/src/Widgets/Terminal.vala index aaa335bc9..d24621fb9 100644 --- a/src/Widgets/Terminal.vala +++ b/src/Widgets/Terminal.vala @@ -17,7 +17,7 @@ * Authored by: Michael Aaron Murphy */ -public class Installer.Terminal : Gtk.ScrolledWindow { +public class Installer.Terminal : Gtk.Box { public signal void toggled (bool active); public Gtk.TextBuffer buffer { get; construct; } @@ -45,13 +45,17 @@ public class Installer.Terminal : Gtk.ScrolledWindow { }; view.remove_css_class (Granite.STYLE_CLASS_VIEW); - hscrollbar_policy = Gtk.PolicyType.NEVER; - hexpand = true; - vexpand = true; - min_content_height = 120; - child = view; + var scrolled_window = new Gtk.ScrolledWindow () { + child = view, + hexpand = true, + vexpand = true, + hscrollbar_policy = NEVER, + min_content_height = 120 + }; add_css_class (Granite.STYLE_CLASS_TERMINAL); + append (scrolled_window); + buffer.changed.connect (attempt_scroll); } From 1d7886a900d29c551a026a995db394741c23ca40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 28 May 2024 13:50:48 -0700 Subject: [PATCH 22/34] Fix titlebar and h2 label --- src/MainWindow.vala | 1 + src/Views/LanguageView.vala | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 5d3bcb864..9cca9a1e2 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -67,6 +67,7 @@ public class Installer.MainWindow : Gtk.Window { overlay.add_overlay (battery_infobar); child = overlay; + titlebar = new Gtk.Label (null); language_view.next_step.connect (() => { // Don't prompt for screen reader if we're able to navigate without it diff --git a/src/Views/LanguageView.vala b/src/Views/LanguageView.vala index c1af46866..6b81d2cbf 100644 --- a/src/Views/LanguageView.vala +++ b/src/Views/LanguageView.vala @@ -49,7 +49,7 @@ public class Installer.LanguageView : AbstractInstallerView { select_stack = new Gtk.Stack (); select_stack.valign = Gtk.Align.START; - select_stack.add_css_class ("h2"); + select_stack.add_css_class (Granite.STYLE_CLASS_H2_LABEL); select_stack.transition_type = Gtk.StackTransitionType.CROSSFADE; select_stack.add_child (select_label); From 27a8afd8c10d4475ae455e9350a0bf2ba7003bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 29 May 2024 08:35:53 -0700 Subject: [PATCH 23/34] update css class syntax --- src/Widgets/DescriptionRow.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widgets/DescriptionRow.vala b/src/Widgets/DescriptionRow.vala index 76391aa31..057189132 100644 --- a/src/Widgets/DescriptionRow.vala +++ b/src/Widgets/DescriptionRow.vala @@ -21,8 +21,8 @@ public class DescriptionRow : Gtk.Box { pixel_size = 24, valign = START }; - image.get_style_context ().add_class (Granite.STYLE_CLASS_ACCENT); - image.get_style_context ().add_class (color); + image.add_css_class (Granite.STYLE_CLASS_ACCENT); + image.add_css_class (color); var description_label = new Gtk.Label (description) { hexpand = true, From 8ff834c340dc2138b1beb91520c78b838d050e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 29 May 2024 08:37:10 -0700 Subject: [PATCH 24/34] texture directly from resource --- src/Views/ProgressView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index fe06afade..7de4128d0 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -42,7 +42,7 @@ public class ProgressView : AbstractInstallerView { margin_bottom = 6, margin_start = 6 }; - logo.custom_image = Gdk.Texture.from_file (File.new_for_uri ("resource://io/elementary/installer/wallpaper.jpg")); + logo.custom_image = Gdk.Texture.from_resource ("resource://io/elementary/installer/wallpaper.jpg"); logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); var icon = new Gtk.Image () { From 49c23d9f7396707b3419d2a8884f6a757744ff20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 29 May 2024 08:46:23 -0700 Subject: [PATCH 25/34] Fix progressview css --- data/Application.css | 122 +++++++++++++++++ data/ProgressView.css | 146 --------------------- data/io.elementary.installer.gresource.xml | 1 - src/Views/ProgressView.vala | 14 +- 4 files changed, 124 insertions(+), 159 deletions(-) delete mode 100644 data/ProgressView.css diff --git a/data/Application.css b/data/Application.css index e1e1d4003..f9a9c864d 100644 --- a/data/Application.css +++ b/data/Application.css @@ -1,3 +1,125 @@ .button-box button { min-width: 86px; /* https://github.com/elementary/granite/issues/577#issuecomment-1318979272 */ } + +.logo { + animation: rainbow-bg 30s linear infinite; + background-image: linear-gradient( + to bottom, + alpha(@BLUEBERRY_500, 0.25), + alpha(@BLUEBERRY_700, 0.75) + ); + border-radius: 50%; + box-shadow: + inset 0 -2px 0 0 alpha(@highlight_color, 0.2), + inset 0 2px 0 0 alpha(@highlight_color, 0.3), + inset 2px 0 0 0 alpha(@highlight_color, 0.07), + inset -2px 0 0 0 alpha(@highlight_color, 0.07), + inset 0 0 0 1px alpha(black, 0.7); + color: white; + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@BLUEBERRY_900, 0.2); + -gtk-icon-style: symbolic; +} + +@keyframes rainbow-bg { + from { + background-image: linear-gradient( + to bottom, + alpha(@BLUEBERRY_500, 0.25), + alpha(@BLUEBERRY_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@BLUEBERRY_900, 0.2); + } + + 12.5% { + background-image: linear-gradient( + to bottom, + alpha(@MINT_500, 0.25), + alpha(@MINT_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@MINT_900, 0.2); + } + + 25% { + background-image: linear-gradient( + to bottom, + alpha(@LIME_500, 0.25), + alpha(@LIME_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@LIME_900, 0.2); + } + + 37.5% { + background-image: linear-gradient( + to bottom, + alpha(@BANANA_500, 0.25), + alpha(@BANANA_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@BANANA_900, 0.2); + } + + 50% { + background-image: linear-gradient( + to bottom, + alpha(@ORANGE_500, 0.25), + alpha(@ORANGE_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@ORANGE_900, 0.2); + } + + 62.5% { + background-image: linear-gradient( + to bottom, + alpha(@STRAWBERRY_500, 0.25), + alpha(@STRAWBERRY_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@STRAWBERRY_900, 0.2); + } + + 75% { + background-image: linear-gradient( + to bottom, + alpha(@BUBBLEGUM_500, 0.25), + alpha(@BUBBLEGUM_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@BUBBLEGUM_900, 0.2); + } + + 87.5% { + background-image: linear-gradient( + to bottom, + alpha(@GRAPE_500, 0.25), + alpha(@GRAPE_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@GRAPE_900, 0.2); + } + + to { + background-image: linear-gradient( + to bottom, + alpha(@BLUEBERRY_500, 0.25), + alpha(@BLUEBERRY_700, 0.75) + ); + -gtk-icon-shadow: + 0 1px 1px alpha(black, 0.3), + 0 2px 3px alpha(@BLUEBERRY_900, 0.2); + } +} diff --git a/data/ProgressView.css b/data/ProgressView.css deleted file mode 100644 index af5d04e76..000000000 --- a/data/ProgressView.css +++ /dev/null @@ -1,146 +0,0 @@ -avatar.image { - animation: rainbow-bg 30s linear infinite; - background-image: linear-gradient( - to bottom, - alpha(@BLUEBERRY_500, 0.25), - alpha(@BLUEBERRY_700, 0.75) - ); -} - -.logo { - animation: rainbow-shadow 30s linear infinite; - color: white; - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@BLUEBERRY_900, 0.2); -} - -@keyframes rainbow-bg { - from { - background-image: linear-gradient( - to bottom, - alpha(@BLUEBERRY_500, 0.25), - alpha(@BLUEBERRY_700, 0.75) - ); - } - - 12.5% { - background-image: linear-gradient( - to bottom, - alpha(@MINT_500, 0.25), - alpha(@MINT_700, 0.75) - ); - } - - 25% { - background-image: linear-gradient( - to bottom, - alpha(@LIME_500, 0.25), - alpha(@LIME_700, 0.75) - ); - } - - 37.5% { - background-image: linear-gradient( - to bottom, - alpha(@BANANA_500, 0.25), - alpha(@BANANA_700, 0.75) - ); - } - - 50% { - background-image: linear-gradient( - to bottom, - alpha(@ORANGE_500, 0.25), - alpha(@ORANGE_700, 0.75) - ); - } - - 62.5% { - background-image: linear-gradient( - to bottom, - alpha(@STRAWBERRY_500, 0.25), - alpha(@STRAWBERRY_700, 0.75) - ); - } - - 75% { - background-image: linear-gradient( - to bottom, - alpha(@BUBBLEGUM_500, 0.25), - alpha(@BUBBLEGUM_700, 0.75) - ); - } - - 87.5% { - background-image: linear-gradient( - to bottom, - alpha(@GRAPE_500, 0.25), - alpha(@GRAPE_700, 0.75) - ); - } - - to { - background-image: linear-gradient( - to bottom, - alpha(@BLUEBERRY_500, 0.25), - alpha(@BLUEBERRY_700, 0.75) - ); - } -} - -@keyframes rainbow-shadow { - from { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@BLUEBERRY_900, 0.2); - } - - 12.5% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@MINT_900, 0.2); - } - - 25% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@LIME_900, 0.2); - } - - 37.5% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@BANANA_900, 0.2); - } - - 50% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@ORANGE_900, 0.2); - } - - 62.5% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@STRAWBERRY_900, 0.2); - } - - 75% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@BUBBLEGUM_900, 0.2); - } - - 87.5% { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@GRAPE_900, 0.2); - } - - to { - -gtk-icon-shadow: - 0 1px 1px alpha(black, 0.3), - 0 2px 3px alpha(@BLUEBERRY_900, 0.2); - } -} diff --git a/data/io.elementary.installer.gresource.xml b/data/io.elementary.installer.gresource.xml index e08676d4d..a43779f25 100644 --- a/data/io.elementary.installer.gresource.xml +++ b/data/io.elementary.installer.gresource.xml @@ -3,7 +3,6 @@ Application.css disk-bar-fallback.css - ProgressView.css wallpaper.jpg diff --git a/src/Views/ProgressView.vala b/src/Views/ProgressView.vala index 7de4128d0..258fcc164 100644 --- a/src/Views/ProgressView.vala +++ b/src/Views/ProgressView.vala @@ -25,9 +25,6 @@ public class ProgressView : AbstractInstallerView { private const int NUM_STEP = 5; construct { - var style_provider = new Gtk.CssProvider (); - style_provider.load_from_resource ("io/elementary/installer/ProgressView.css"); - var logo_icon_name = Environment.get_os_info ("LOGO"); if (logo_icon_name == "" || logo_icon_name == null) { logo_icon_name = "distributor-logo"; @@ -35,22 +32,15 @@ public class ProgressView : AbstractInstallerView { var logo = new Adw.Avatar (192, "", false) { // In case the wallpaper can't be loaded, we don't want an icon or text - icon_name = "invalid-icon-name", - // We need this for the shadow to not get clipped by Gtk.Overlay - margin_top = 6, - margin_end = 6, - margin_bottom = 6, - margin_start = 6 + icon_name = "invalid-icon-name" }; - logo.custom_image = Gdk.Texture.from_resource ("resource://io/elementary/installer/wallpaper.jpg"); - logo.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + logo.custom_image = Gdk.Texture.from_resource ("/io/elementary/installer/wallpaper.jpg"); var icon = new Gtk.Image () { icon_name = logo_icon_name + "-symbolic", pixel_size = 192 }; icon.add_css_class ("logo"); - icon.get_style_context ().add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); var logo_overlay = new Gtk.Overlay () { child = logo, From ea109cf6f389134b86291bb2f075811eb274357a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 29 May 2024 08:48:57 -0700 Subject: [PATCH 26/34] Fix bad merge in error view --- src/Views/ErrorView.vala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Views/ErrorView.vala b/src/Views/ErrorView.vala index 8ef9c4b51..fcfea6ed3 100644 --- a/src/Views/ErrorView.vala +++ b/src/Views/ErrorView.vala @@ -79,16 +79,14 @@ public class ErrorView : AbstractInstallerView { terminal_button_box.append (terminal_button_label); var terminal_button = new Gtk.ToggleButton () { - halign = Gtk.Align.START, - has_frame = false, child = terminal_button_box, + halign = START, + has_frame = false, margin_top = 12 }; terminal_button_label.mnemonic_widget = terminal_button; - terminal_button_label.mnemonic_widget = terminal_button; - var buffer = new Gtk.TextBuffer (null) { text = log }; From 1ae3517d4f32e89259f807f6e99102bc9a1ab158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 29 May 2024 09:04:12 -0700 Subject: [PATCH 27/34] Isolate view size --- src/MainWindow.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 9cca9a1e2..375284052 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -40,7 +40,8 @@ public class Installer.MainWindow : Gtk.Window { leaflet = new Adw.Leaflet () { can_navigate_back = true, - can_unfold = false + can_unfold = false, + homogeneous = false }; leaflet.append (language_view); From 3417fc7ce1737327649d7f5fbbc0857e9918447b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 5 Jun 2024 15:19:22 -0700 Subject: [PATCH 28/34] fix title area --- src/MainWindow.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 375284052..ab4451da3 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -68,7 +68,7 @@ public class Installer.MainWindow : Gtk.Window { overlay.add_overlay (battery_infobar); child = overlay; - titlebar = new Gtk.Label (null); + titlebar = new Gtk.Grid () { visible = false }; language_view.next_step.connect (() => { // Don't prompt for screen reader if we're able to navigate without it From 12f99ec611ba133755688bcae6a6957cbf57dde7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 6 Jun 2024 15:15:12 -0700 Subject: [PATCH 29/34] Fix gradient direction --- src/Widgets/DiskBar.vala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 56c58ea7c..eff317662 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -79,6 +79,9 @@ public class Installer.DiskBar: Gtk.Box { append (name_label ); append (bar); append (legend_box); + + // Lie about orientation for styling reasons + css_classes = {"horizontal"}; } private void add_legend (string ppath, uint64 size, string fs, string? vg, Gtk.Popover? menu) { From 95d1a5bebcee73ec809210ba25339faaef8798b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 6 Jun 2024 16:55:01 -0700 Subject: [PATCH 30/34] Use constraint layout for partitionbar --- src/Widgets/DiskBar.vala | 179 +++++++++++++++++++++++----------- src/Widgets/PartitionBar.vala | 7 -- 2 files changed, 120 insertions(+), 66 deletions(-) diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index eff317662..c97690352 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -31,15 +31,7 @@ public class Installer.DiskBar: Gtk.Box { secondary_text = "%s %s".printf (disk_path, GLib.format_size (size)) }; - var bar = new Gtk.Box (HORIZONTAL, 0); - - // bar.size_allocate.connect ((alloc) => { - // update_sector_lengths (partitions, alloc); - // }); - - foreach (PartitionBar part in partitions) { - bar.append (part); - } + var bar = new PartitionContainer (size, partitions); legend_box = new Gtk.Box (VERTICAL, 6) { halign = START @@ -63,14 +55,6 @@ public class Installer.DiskBar: Gtk.Box { var unused = size - (used * 512); if (size / 100 < unused) { add_legend ("unused", unused, "unused", null, null); - - var unused_bar = new Block () { - hexpand = true, - vexpand = true - }; - unused_bar.add_css_class ("unused"); - - bar.append (unused_bar); } orientation = VERTICAL; @@ -125,52 +109,129 @@ public class Installer.DiskBar: Gtk.Box { legend_box.append (legend); } - private void update_sector_lengths (Gee.ArrayList partitions, Gtk.Allocation alloc) { - var alloc_width = alloc.width; - var disk_sectors = this.size / 512; - - int[] lengths = {}; - for (int x = 0; x < partitions.size; x++) { - var part = partitions[x]; - var requested = part.calculate_length (alloc_width, disk_sectors); - - var excess = requested - alloc_width; - while (excess > 0) { - var reduce_by = x / excess; - if (reduce_by == 0) reduce_by = 1; - - // Begin by resizing all partitions over 20px wide. - bool excess_modified = false; - for (int y = 0; excess > 0 && y < x; y++) { - if (lengths[y] <= 20) continue; - lengths[y] -= reduce_by; - excess -= reduce_by; - excess_modified = true; - } - - // In case all are below that width, shrink beyond limit. - if (!excess_modified) { - for (int y = 0; excess > 0 && y < x; y++) { - lengths[y] -= reduce_by; - excess -= reduce_by; - excess_modified = true; - } - } + private class PartitionContainer : Gtk.Widget { + public Gee.ArrayList partitions { get; construct; } + public uint64 size { get; construct; } + + public PartitionContainer (uint64 size, Gee.ArrayList partitions) { + Object ( + partitions: partitions, + size: size + ); + } + + class construct { + set_layout_manager_type (typeof (Gtk.ConstraintLayout)); + } + + construct { + uint64 used = 0; + var disk_sectors = size / 512; + foreach (var partition in partitions) { + double percent_requested = (double) partition.get_partition_size () / disk_sectors; + percent_requested = percent_requested.clamp (0.01, 0.99); + + used += partition.get_partition_size (); + + append_partition ( + partition, + percent_requested + ); + } + + var unused = size - (used * 512); + if (size / 100 < unused) { + var unused_bar = new Block (); + unused_bar.add_css_class ("unused"); + + append_partition (unused_bar, 1.0); } - alloc_width -= requested; - disk_sectors -= part.get_partition_size (); - lengths += requested; + var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ()); + // Position last child at end + layout_manager.add_constraint ( + new Gtk.Constraint ( + get_last_child (), + END, + EQ, + this, + END, + 1.0, + 0.0, + Gtk.ConstraintStrength.REQUIRED + ) + ); } - var new_alloc = Gtk.Allocation (); - new_alloc.x = alloc.x; - new_alloc.y = alloc.y; - new_alloc.height = alloc.height; - for (int x = 0; x < partitions.size; x++) { - new_alloc.width = lengths[x]; - partitions[x].allocate_size (new_alloc, 0); - new_alloc.x += new_alloc.width; + ~PartitionContainer () { + while (get_first_child () != null) { + get_first_child ().unparent (); + } + } + + private void append_partition (Gtk.Widget widget, double percentage) { + widget.set_parent (this); + + var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ()); + + // Fill height of this + layout_manager.add_constraint ( + new Gtk.Constraint ( + widget, + HEIGHT, + EQ, + this, + HEIGHT, + 1.0, + 0.0, + Gtk.ConstraintStrength.REQUIRED + ) + ); + + // Fill width based on partition size + layout_manager.add_constraint ( + new Gtk.Constraint ( + widget, + WIDTH, + EQ, + this, + WIDTH, + percentage, + 0, + Gtk.ConstraintStrength.STRONG + ) + ); + + var previous_child = widget.get_prev_sibling (); + if (previous_child == null) { + // Position at start + layout_manager.add_constraint ( + new Gtk.Constraint ( + widget, + START, + EQ, + this, + START, + 1.0, + 0.0, + Gtk.ConstraintStrength.REQUIRED + ) + ); + } else { + // Position end to end + layout_manager.add_constraint ( + new Gtk.Constraint ( + widget, + START, + EQ, + previous_child, + END, + 1.0, + 0.0, + Gtk.ConstraintStrength.REQUIRED + ) + ); + } } } diff --git a/src/Widgets/PartitionBar.vala b/src/Widgets/PartitionBar.vala index 5c9c63e2a..219ec8518 100644 --- a/src/Widgets/PartitionBar.vala +++ b/src/Widgets/PartitionBar.vala @@ -73,11 +73,4 @@ public class Installer.PartitionBar : Gtk.Box { public uint64 get_partition_size () { return partition.end_sector - partition.start_sector; } - - public int calculate_length (int alloc_width, uint64 disk_sectors) { - var percent = ((double) get_partition_size () / (double) disk_sectors); - var request = alloc_width * percent; - if (request < 20) request = 20; - return (int) request; - } } From 3d076ddc159289acd61b72fbfc886db6d82e25a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 6 Jun 2024 16:59:41 -0700 Subject: [PATCH 31/34] Better unused size --- src/Widgets/DiskBar.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index c97690352..3641d11e5 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -144,7 +144,7 @@ public class Installer.DiskBar: Gtk.Box { var unused_bar = new Block (); unused_bar.add_css_class ("unused"); - append_partition (unused_bar, 1.0); + append_partition (unused_bar, unused / size); } var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ()); From 39aed2424d99932da984d21ff44127a6663bcf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 6 Jun 2024 17:09:38 -0700 Subject: [PATCH 32/34] Remove leftover css --- data/disk-bar-fallback.css | 5 ----- 1 file changed, 5 deletions(-) diff --git a/data/disk-bar-fallback.css b/data/disk-bar-fallback.css index 5464e619c..c2326a221 100644 --- a/data/disk-bar-fallback.css +++ b/data/disk-bar-fallback.css @@ -93,8 +93,3 @@ levelbar block image { 0 1px 1px alpha(#000, 0.2), 0 1px 3px alpha(#000, 0.1); } - -levelbar .h4 { - opacity: 1; - padding: 0; -} From 6599c1386b7d33f4cf00de277c5afb40f59e855d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 19 Jun 2024 17:11:35 -0700 Subject: [PATCH 33/34] Style constant --- src/MainWindow.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ab4451da3..2faf178f8 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -60,7 +60,7 @@ public class Installer.MainWindow : Gtk.Window { valign = Gtk.Align.END }; battery_infobar.add_child (infobar_label); - battery_infobar.add_css_class ("frame"); + battery_infobar.add_css_class (Granite.STYLE_CLASS_FRAME); var overlay = new Gtk.Overlay () { child = leaflet From ba3a4dba2c674413e085fa62d834a09ac40b1590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Fri, 21 Jun 2024 14:06:14 -0700 Subject: [PATCH 34/34] Update README and CI --- .github/workflows/ci.yml | 10 ++++++---- README.md | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b35af735c..5bd86320b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,11 +23,13 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y desktop-file-utils gettext libdistinst-dev libgtk-3-dev libgee-0.8-dev libgranite-dev libhandy-1-dev libxml2-dev libjson-glib-dev libpwquality-dev libxml2-utils meson valac - - name: Build + apt install -y desktop-file-utils gettext libadwaita-1-dev libdistinst-dev libgee-0.8-dev libgranite-7-dev libgtk-4-dev libxml2-dev libjson-glib-dev libpwquality-dev libxml2-utils meson valac + - name: Build and Test + env: + DESTDIR: out run: | - meson build - ninja -C build + meson setup build + ninja -C build install lint: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 1d9dba723..47c4aa6d4 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ You'll need the following dependencies: - gettext - gparted - libgnomekbd-dev - - libgranite-dev >= 0.5 - - libgtk-3-dev + - libgranite-7-dev >=7.4.0 + - libgtk-4-dev - libgee-0.8-dev - - libhandy-1-dev + - libadwaita-1-dev >=1.0.0 - libjson-glib-dev - libpwquality-dev - libxml2-dev