diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 09a2e76f5..a8d4880df 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -171,19 +171,14 @@ public class Installer.PartitioningView : AbstractInstallerView { } foreach (unowned InstallerDaemon.Disk disk in disks.physical_disks) { - var sector_size = disk.sector_size; - var size = disk.sectors * sector_size; - - unowned string path = disk.device_path; - var partitions = new Gee.ArrayList (); foreach (unowned InstallerDaemon.Partition part in disk.partitions) { - var partition = new PartitionBlock (part, path, sector_size, false, this.set_mount, this.unset_mount, this.mount_is_set); + var partition = new PartitionBlock (part, disk.device_path, disk.sector_size, false, this.set_mount, this.unset_mount, this.mount_is_set); partition.decrypted.connect (on_partition_decrypted); partitions.add (partition); } - var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions); + var disk_bar = new DiskBar (disk, (owned) partitions); disk_list.append (disk_bar); } @@ -224,19 +219,14 @@ public class Installer.PartitioningView : AbstractInstallerView { } private void add_logical_disk (InstallerDaemon.Disk disk) { - var sector_size = disk.sector_size; - var size = disk.sectors * sector_size; - - unowned string path = disk.device_path; - var partitions = new Gee.ArrayList (); foreach (unowned InstallerDaemon.Partition part in disk.partitions) { - var partition = new PartitionBlock (part, path, sector_size, true, this.set_mount, this.unset_mount, this.mount_is_set); + var partition = new PartitionBlock (part, disk.device_path, disk.sector_size, true, this.set_mount, this.unset_mount, this.mount_is_set); partition.decrypted.connect (on_partition_decrypted); partitions.add (partition); } - var disk_bar = new DiskBar (disk.name, path, size, (owned) partitions); + var disk_bar = new DiskBar (disk, (owned) partitions); disk_list.append (disk_bar); } diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 97c3edfd2..0c5a228d4 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -6,17 +6,13 @@ */ public class Installer.DiskBar: Gtk.Box { - public string disk_name { get; construct; } - public string disk_path { get; construct; } - public uint64 size { get; construct; } + public InstallerDaemon.Disk disk { get; construct; } public Gee.ArrayList partitions { get; construct; } - public DiskBar (string disk_name, string disk_path, uint64 size, Gee.ArrayList partitions) { + public DiskBar (InstallerDaemon.Disk disk, Gee.ArrayList partitions) { Object ( - disk_name: disk_name, - disk_path: disk_path, - partitions: partitions, - size: size + disk: disk, + partitions: partitions ); } @@ -25,8 +21,10 @@ public class Installer.DiskBar: Gtk.Box { } construct { - var name_label = new Granite.HeaderLabel (disk_name) { - secondary_text = "%s %s".printf (disk_path, GLib.format_size (size)) + var size = disk.sectors * disk.sector_size; + + var name_label = new Granite.HeaderLabel (disk.name) { + secondary_text = "%s %s".printf (disk.device_path, GLib.format_size (size)) }; var bar = new PartitionContainer (size, partitions);