Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Sep 24, 2024
2 parents 06d9901 + fe60a17 commit 33e6e0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
18 changes: 4 additions & 14 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<PartitionBlock> ();
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);
}

Expand Down Expand Up @@ -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<PartitionBlock> ();
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);
}

Expand Down
18 changes: 8 additions & 10 deletions src/Widgets/DiskBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<PartitionBlock> partitions { get; construct; }

public DiskBar (string disk_name, string disk_path, uint64 size, Gee.ArrayList<PartitionBlock> partitions) {
public DiskBar (InstallerDaemon.Disk disk, Gee.ArrayList<PartitionBlock> partitions) {
Object (
disk_name: disk_name,
disk_path: disk_path,
partitions: partitions,
size: size
disk: disk,
partitions: partitions
);
}

Expand All @@ -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);
Expand Down

0 comments on commit 33e6e0c

Please sign in to comment.