From 0d20f45a8c4703061ce7afc4a4d8204534729576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 13:47:18 -0700 Subject: [PATCH 1/4] ParititioningView: make description easier to read --- src/Views/PartitioningView.vala | 92 ++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 25 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index a36309e78..f911ef16b 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -49,7 +49,14 @@ public class Installer.PartitioningView : AbstractInstallerView { mounts = new Gee.ArrayList (); luks = new Gee.ArrayList (); - var base_description = _("Select which partitions to use across all drives. Selecting \"Format\" will erase ALL data on the selected partition."); + var title_label = new Gtk.Label (_("Select Partitions")); + title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + + var format_row = new ListRow ( + _("Selecting “Format” will erase ALL data on the selected partition."), + "dialog-warning-symbolic", + "orange" + ); var bootloader = Daemon.get_default ().bootloader_detect (); switch (bootloader) { @@ -63,33 +70,48 @@ public class Installer.PartitioningView : AbstractInstallerView { break; } - var recommended_description = _("It is also recommended to select a Swap partition."); - - var full_description = "%s %s %s".printf ( - base_description, + var required_row = new ListRow ( required_description, - recommended_description + "emblem-system-symbolic", + "orange" ); - var description = new Gtk.Label (full_description); - description.max_width_chars = 72; - description.use_markup = true; - description.wrap = true; + var recommended_row = new ListRow ( + _("It is also recommended to select a Swap partition."), + "dialog-information-symbolic", + "blue" + ); + + var description_box = new Gtk.Box (VERTICAL, 12) { + margin_top = 12, + margin_end = 12, + margin_bottom = 12, + margin_start = 12 + }; + description_box.add (format_row); + description_box.add (required_row); + description_box.add (recommended_row); disk_list = new Gtk.Grid () { + margin_top = 12, + margin_end = 12, + margin_bottom = 12, + margin_start = 12, row_spacing = 24, orientation = Gtk.Orientation.VERTICAL, valign = Gtk.Align.CENTER }; - var disk_scroller = new Gtk.ScrolledWindow (null, null); - disk_scroller.hexpand = true; - disk_scroller.hscrollbar_policy = Gtk.PolicyType.NEVER; - disk_scroller.add (disk_list); + var disk_scroller = new Gtk.ScrolledWindow (null, null) { + child = disk_list, + hexpand = true, + hscrollbar_policy = NEVER + }; - var load_spinner = new Gtk.Spinner (); - load_spinner.halign = Gtk.Align.CENTER; - load_spinner.valign = Gtk.Align.CENTER; + var load_spinner = new Gtk.Spinner () { + halign = CENTER, + valign = CENTER + }; load_spinner.start (); var load_label = new Gtk.Label (_("Getting the current configuration…")); @@ -104,17 +126,15 @@ public class Installer.PartitioningView : AbstractInstallerView { load_box.add (load_spinner); load_box.add (load_label); - load_stack = new Gtk.Stack (); - load_stack.transition_type = Gtk.StackTransitionType.CROSSFADE; + load_stack = new Gtk.Stack () { + transition_type = CROSSFADE + }; load_stack.add_named (load_box, "loading"); load_stack.add_named (disk_scroller, "disk"); - content_area.margin_top = 12; - content_area.margin_end = 12; - content_area.margin_bottom = 12; - content_area.margin_start = 12; - content_area.attach (description, 0, 0); - content_area.attach (load_stack, 0, 1); + content_area.attach (title_label, 0, 0); + content_area.attach (description_box, 0, 1); + content_area.attach (load_stack, 0, 2); load_disks.begin (); @@ -326,4 +346,26 @@ public class Installer.PartitioningView : AbstractInstallerView { array[index] = array[array.size - 1]; return array.remove_at (array.size - 1); } + + private class ListRow : Gtk.Box { + public ListRow (string description, string icon_name, string color) { + var image = new Gtk.Image.from_icon_name (icon_name, MENU) { + valign = Gtk.Align.START + }; + image.get_style_context ().add_class (Granite.STYLE_CLASS_ACCENT); + image.get_style_context ().add_class (color); + + var description_label = new Gtk.Label (description) { + hexpand = true, + max_width_chars = 1, // Make Gtk wrap, but not expand the window + use_markup = true, + wrap = true, + xalign = 0 + }; + + spacing = 12; + add (image); + add (description_label); + } + } } From 0fc3ad8affb0638a9b11702bbc4f1d47c9300dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 13:48:41 -0700 Subject: [PATCH 2/4] Better name for row --- src/Views/PartitioningView.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index f911ef16b..5ad856da3 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -52,7 +52,7 @@ public class Installer.PartitioningView : AbstractInstallerView { var title_label = new Gtk.Label (_("Select Partitions")); title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); - var format_row = new ListRow ( + var format_row = new DescriptionRow ( _("Selecting “Format” will erase ALL data on the selected partition."), "dialog-warning-symbolic", "orange" @@ -70,13 +70,13 @@ public class Installer.PartitioningView : AbstractInstallerView { break; } - var required_row = new ListRow ( + var required_row = new DescriptionRow ( required_description, "emblem-system-symbolic", "orange" ); - var recommended_row = new ListRow ( + var recommended_row = new DescriptionRow ( _("It is also recommended to select a Swap partition."), "dialog-information-symbolic", "blue" @@ -347,8 +347,8 @@ public class Installer.PartitioningView : AbstractInstallerView { return array.remove_at (array.size - 1); } - private class ListRow : Gtk.Box { - public ListRow (string description, string icon_name, string color) { + 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) { valign = Gtk.Align.START }; From 42ab0493d9c63d845c7aa61cca3ce7c063fd48e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 13:50:23 -0700 Subject: [PATCH 3/4] Don't use caps for emphasis --- src/Views/PartitioningView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 5ad856da3..443dc626a 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -53,7 +53,7 @@ public class Installer.PartitioningView : AbstractInstallerView { title_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); var format_row = new DescriptionRow ( - _("Selecting “Format” will erase ALL data on the selected partition."), + _("Selecting “Format” will erase all data on the selected partition."), "dialog-warning-symbolic", "orange" ); From 48e8f8cc6b511cbc44cc2f73d9fb9c19d8862bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 14 May 2024 13:58:08 -0700 Subject: [PATCH 4/4] Fix extra vertical space usage --- src/Views/PartitioningView.vala | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 443dc626a..918e8e05b 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -83,9 +83,7 @@ public class Installer.PartitioningView : AbstractInstallerView { ); var description_box = new Gtk.Box (VERTICAL, 12) { - margin_top = 12, margin_end = 12, - margin_bottom = 12, margin_start = 12 }; description_box.add (format_row); @@ -93,12 +91,10 @@ public class Installer.PartitioningView : AbstractInstallerView { description_box.add (recommended_row); disk_list = new Gtk.Grid () { - margin_top = 12, margin_end = 12, - margin_bottom = 12, margin_start = 12, row_spacing = 24, - orientation = Gtk.Orientation.VERTICAL, + orientation = VERTICAL, valign = Gtk.Align.CENTER };