diff --git a/src/Views/PartitioningView.vala b/src/Views/PartitioningView.vala index 52cd8d51b..98549b48f 100644 --- a/src/Views/PartitioningView.vala +++ b/src/Views/PartitioningView.vala @@ -212,8 +212,15 @@ public class Installer.PartitioningView : AbstractInstallerView { private DiskBar get_disk_bar (InstallerDaemon.Disk disk, bool lvm) { var partitions = new Gee.ArrayList (); foreach (unowned InstallerDaemon.Partition part in disk.partitions) { - var partition = new PartitionBlock (part, disk.device_path, disk.sector_size, lvm, this.set_mount, this.unset_mount, this.mount_is_set); - partition.decrypted.connect (on_partition_decrypted); + var partition = new PartitionBlock (part); + + if (part.filesystem == LUKS) { + partition.menu = new DecryptMenu (part.device_path); + ((DecryptMenu) partition.menu).decrypted.connect (on_partition_decrypted); + } else { + partition.menu = new PartitionMenu (part.device_path, disk.device_path, part.filesystem, lvm, this.set_mount, this.unset_mount, this.mount_is_set, partition); + } + partitions.add (partition); } diff --git a/src/Widgets/DiskBar.vala b/src/Widgets/DiskBar.vala index 807bb905d..9d7c84e0f 100644 --- a/src/Widgets/DiskBar.vala +++ b/src/Widgets/DiskBar.vala @@ -40,7 +40,7 @@ public class Installer.DiskBar: Gtk.Box { p.partition.device_path, p.get_partition_size () * 512, p.partition.filesystem.to_string (), - p.volume_group, + p.partition.filesystem == LVM ? p.partition.current_lvm_volume_group : null, p.menu ); } diff --git a/src/Widgets/PartitionBlock.vala b/src/Widgets/PartitionBlock.vala index 24ac56531..a3e977287 100644 --- a/src/Widgets/PartitionBlock.vala +++ b/src/Widgets/PartitionBlock.vala @@ -6,46 +6,30 @@ */ public class Installer.PartitionBlock : Adw.Bin { - public signal void decrypted (InstallerDaemon.LuksCredentials credential); - public Icon? icon { get; set; default = null; } - public bool lvm { get; construct; } - public InstallerDaemon.Partition partition { get; construct; } - public string parent_path { get; construct; } + private Gtk.Popover _menu; + public Gtk.Popover menu { + get { + return _menu; + } - public string? volume_group { get; private set; } - public Gtk.Popover menu { get; private set; } + set { + _menu = value; + _menu.set_parent (this); + _menu.position = BOTTOM; - public PartitionBlock ( - InstallerDaemon.Partition partition, - string parent_path, - uint64 sector_size, - bool lvm, - SetMount set_mount, - UnsetMount unset_mount, - MountSetFn mount_set - ) { - Object ( - lvm: lvm, - parent_path: parent_path, - partition: partition - ); + var click_gesture = new Gtk.GestureClick (); + click_gesture.released.connect (_menu.popup); - if (partition.filesystem == LUKS) { - menu = new DecryptMenu (partition.device_path); - ((DecryptMenu)menu).decrypted.connect ((creds) => decrypted (creds)); - } else { - menu = new PartitionMenu (partition.device_path, parent_path, partition.filesystem, lvm, set_mount, unset_mount, mount_set, this); + add_controller (click_gesture); } + } - menu.set_parent (this); - menu.position = BOTTOM; - - var click_gesture = new Gtk.GestureClick (); - click_gesture.released.connect (menu.popup); + public InstallerDaemon.Partition partition { get; construct; } - add_controller (click_gesture); + public PartitionBlock (InstallerDaemon.Partition partition) { + Object (partition: partition); } class construct { @@ -53,8 +37,6 @@ public class Installer.PartitionBlock : Adw.Bin { } construct { - volume_group = (partition.filesystem == LVM) ? partition.current_lvm_volume_group : null; - var image = new Gtk.Image () { halign = END, valign = END