Skip to content

Commit cd7fbfd

Browse files
committed
🚑 Fix partition sizes in the custom partitioning view
1 parent 671e62f commit cd7fbfd

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Views/PartitioningView.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
192192
partitions.add (partition);
193193
}
194194

195-
var disk_bar = new DiskBar (model, path, size, (owned) partitions);
195+
var disk_bar = new DiskBar (model, path, size, sector_size, (owned) partitions);
196196
label_sizer.add_widget (disk_bar.label);
197197
disk_list.pack_start (disk_bar);
198198
}
@@ -248,7 +248,7 @@ public class Installer.PartitioningView : AbstractInstallerView {
248248
}
249249
}
250250

251-
var disk_bar = new DiskBar (model, path, size, (owned) partitions);
251+
var disk_bar = new DiskBar (model, path, size, sector_size, (owned) partitions);
252252
label_sizer.add_widget (disk_bar.label);
253253
disk_list.pack_start (disk_bar);
254254
}

src/Widgets/DiskBar.vala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class Installer.DiskBar: Gtk.Grid {
2222
public string disk_name { get; construct; }
2323
public string disk_path { get; construct; }
2424
public uint64 size { get; construct; }
25+
public uint64 sector_size { get; construct; }
2526
public Gee.ArrayList<PartitionBar> partitions { get; construct; }
2627

2728
public Gtk.Box label;
@@ -34,13 +35,15 @@ public class Installer.DiskBar: Gtk.Grid {
3435
string model,
3536
string path,
3637
uint64 size,
38+
uint64 sector_size,
3739
Gee.ArrayList<PartitionBar> partitions
3840
) {
3941
Object (
4042
disk_name: model,
4143
disk_path: path,
4244
partitions: partitions,
43-
size: size
45+
size: size,
46+
sector_size: sector_size
4447
);
4548
}
4649

@@ -66,7 +69,7 @@ public class Installer.DiskBar: Gtk.Grid {
6669
used += partition.get_size ();
6770
}
6871

69-
return size - (used * 512);
72+
return size - (used * sector_size);
7073
}
7174

7275
private void generate_legend () {
@@ -79,7 +82,7 @@ public class Installer.DiskBar: Gtk.Grid {
7982
legend.add (legend_container);
8083

8184
foreach (PartitionBar p in partitions) {
82-
add_legend (p.path, p.get_size () * 512, Distinst.strfilesys (p.filesystem), p.vg, p.menu);
85+
add_legend (p.path, p.get_size () * sector_size, Distinst.strfilesys (p.filesystem), p.vg, p.menu);
8386
}
8487

8588
if (size / 100 < unused) {
@@ -165,7 +168,7 @@ public class Installer.DiskBar: Gtk.Grid {
165168

166169
private void update_sector_lengths (Gee.ArrayList<PartitionBar> partitions, Gtk.Allocation alloc) {
167170
var alloc_width = alloc.width;
168-
var disk_sectors = this.size / 512;
171+
var disk_sectors = this.size / sector_size;
169172

170173
int[] lengths = {};
171174
for (int x = 0; x < partitions.size; x++) {

0 commit comments

Comments
 (0)