Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Sep 30, 2024
2 parents d49b0c8 + eae9af3 commit aa8667a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
11 changes: 9 additions & 2 deletions src/Views/PartitioningView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,15 @@ public class Installer.PartitioningView : AbstractInstallerView {
private DiskBar get_disk_bar (InstallerDaemon.Disk disk, bool lvm) {
var partitions = new Gee.ArrayList<PartitionBlock> ();
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);
}

Expand Down
47 changes: 16 additions & 31 deletions src/Widgets/PartitionBlock.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +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 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 {
Expand Down

0 comments on commit aa8667a

Please sign in to comment.