fix(ui): correct mount point selection pre-fill and simplify partition creation dialog

This commit is contained in:
2026-02-03 20:57:29 +01:00
parent 848b2e7e74
commit af86d357a4
4 changed files with 13 additions and 50 deletions

View File

@@ -474,6 +474,13 @@ class PartitioningPage(Adw.Bin):
options = ["/", "/boot/efi", "[SWAP]", "None"]
dropdown = Gtk.DropDown.new_from_strings(options)
current_mp = data.get("mount_point")
if current_mp in options:
dropdown.set_selected(options.index(current_mp))
elif not current_mp:
dropdown.set_selected(options.index("None"))
box.append(Gtk.Label(label=f"Mount point for {data['name']}:"))
box.append(dropdown)
@@ -519,24 +526,6 @@ class PartitioningPage(Adw.Bin):
box.append(Gtk.Label(label="Partition Type:"))
box.append(type_dropdown)
# Filesystem dropdown
fs_options = ["ext4", "fat32", "swap"]
fs_dropdown = Gtk.DropDown.new_from_strings(fs_options)
box.append(Gtk.Label(label="Filesystem:"))
box.append(fs_dropdown)
# Auto-update FS based on Type
def on_type_changed(dropdown, pspec):
selected_type = type_names[dropdown.get_selected()]
if selected_type == "EFI System":
fs_dropdown.set_selected(1) # fat32
elif selected_type == "Swap":
fs_dropdown.set_selected(2) # swap
else:
fs_dropdown.set_selected(0) # ext4
type_dropdown.connect("notify::selected", on_type_changed)
error_label = Gtk.Label(label="")
error_label.add_css_class("error")
box.append(error_label)
@@ -545,13 +534,16 @@ class PartitioningPage(Adw.Bin):
from ...backend.disk import create_partition
selected_type = type_names[type_dropdown.get_selected()]
# Default name based on type
# Default name and fstype based on type
if selected_type == "EFI System":
name = "EFI System"
fstype = "fat32"
elif selected_type == "Swap":
name = "Swap"
fstype = "swap"
else:
name = "Linux filesystem"
fstype = "ext4"
size_text = size_entry.get_text()
try:
@@ -564,7 +556,6 @@ class PartitioningPage(Adw.Bin):
return
type_code = types[selected_type]
fstype = fs_options[fs_dropdown.get_selected()]
try:
create_partition(self.current_disk_path, size_mb, type_code, name, fstype)