From f59dcfa549a3b9b4af812d76068ea5fac2ed49d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Wed, 25 Sep 2024 11:22:17 -0700 Subject: [PATCH 1/3] DiskBar: use constraint from constant instead of relative --- src/Widgets/DiskBar.vala | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 807bb905d..621049fa4 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -188,14 +188,11 @@ public class Installer.DiskBar: Gtk.Box { // Fill width based on partition size layout_manager.add_constraint ( - new Gtk.Constraint ( + new Gtk.Constraint.const ( widget, WIDTH, - EQ, - this, - WIDTH, - percentage, - 0, + LE, + percentage * get_width (), Gtk.ConstraintStrength.STRONG ) ); From e36656f918e701224c517600201c5ad7ea963bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 3 Oct 2024 12:06:52 -0700 Subject: [PATCH 2/3] Use guide, show unused part for testing --- src/Views/PartitioningView.vala | 2 +- src/Widgets/DiskBar.vala | 50 +++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 5092e5311..ab75f7ba1 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -364,7 +364,7 @@ public class Installer.PartitioningView : AbstractInstallerView { device_path = "/dev/nvme0n1p2", filesystem = InstallerDaemon.FileSystem.LVM, start_sector = 542968, - end_sector = 976769070, + end_sector = 376769070, sectors_used = usage_2, current_lvm_volume_group = "data" }; diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 48b679a64..5e4e790c8 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -69,6 +69,8 @@ public class Installer.DiskBar: Gtk.Box { public Gee.ArrayList partitions { get; construct; } public uint64 size { get; construct; } + private Gtk.ConstraintGuide guide; + public PartitionContainer (uint64 size, Gee.ArrayList partitions) { Object ( partitions: partitions, @@ -81,6 +83,28 @@ public class Installer.DiskBar: Gtk.Box { } construct { + guide = new Gtk.ConstraintGuide () { + max_width = 300, + min_width = 300, + nat_width = 600 + }; + + var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ()); + layout_manager.add_guide (guide); + + layout_manager.add_constraint ( + new Gtk.Constraint ( + guide, + HEIGHT, + EQ, + this, + HEIGHT, + 1.0, + 0.0, + Gtk.ConstraintStrength.REQUIRED + ) + ); + uint64 used = 0; var disk_sectors = size / 512; foreach (var partition in partitions) { @@ -100,17 +124,16 @@ public class Installer.DiskBar: Gtk.Box { var unused_bar = new Block (); unused_bar.add_css_class ("unused"); - append_partition (unused_bar, unused / size); + append_partition (unused_bar, (double) unused / size); } - var layout_manager = ((Gtk.ConstraintLayout) get_layout_manager ()); // Position last child at end layout_manager.add_constraint ( new Gtk.Constraint ( - get_last_child (), + null, END, EQ, - this, + get_last_child (), END, 1.0, 0.0, @@ -136,7 +159,7 @@ public class Installer.DiskBar: Gtk.Box { widget, HEIGHT, EQ, - this, + guide, HEIGHT, 1.0, 0.0, @@ -146,11 +169,14 @@ public class Installer.DiskBar: Gtk.Box { // Fill width based on partition size layout_manager.add_constraint ( - new Gtk.Constraint.const ( + new Gtk.Constraint ( widget, WIDTH, - LE, - percentage * get_width (), + EQ, + guide, + WIDTH, + percentage, + 0, Gtk.ConstraintStrength.STRONG ) ); @@ -160,10 +186,10 @@ public class Installer.DiskBar: Gtk.Box { // Position at start layout_manager.add_constraint ( new Gtk.Constraint ( - widget, + null, START, EQ, - this, + widget, START, 1.0, 0.0, @@ -179,8 +205,8 @@ public class Installer.DiskBar: Gtk.Box { EQ, previous_child, END, - 1.0, - 0.0, + 1, + 0, Gtk.ConstraintStrength.REQUIRED ) ); From dffea116224a66f46a134379dd39ca88c5672177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Sat, 12 Oct 2024 10:09:30 -0700 Subject: [PATCH 3/3] Update PartitioningView.vala --- 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 ab75f7ba1..5092e5311 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -364,7 +364,7 @@ public class Installer.PartitioningView : AbstractInstallerView { device_path = "/dev/nvme0n1p2", filesystem = InstallerDaemon.FileSystem.LVM, start_sector = 542968, - end_sector = 376769070, + end_sector = 976769070, sectors_used = usage_2, current_lvm_volume_group = "data" };