DriveSetup: fix logic to enable the "change parameters" menu
Just ask the partition if its parameters can be changed, instead of trying to guess. Now the menu is always disabled. This is because none of our partitioning systems actually allow changing any of the parameters of an already created partition (they don't enable B_DISK_SYSTEM_SUPPORTS_SETTING_PARAMETERS). Fixes #11641 (but we should implement editing parameters in the intel partitionning system to set the active partition). Change-Id: I242e7f73c4188824ba0e3984c0d97172da84e9a7 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3765 Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
ace584913d
commit
76fc09c0b9
@ -664,7 +664,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
||||
fUnmountContextMenuItem->SetEnabled(false);
|
||||
fFormatContextMenuItem->SetEnabled(false);
|
||||
|
||||
if (!disk) {
|
||||
if (disk == NULL) {
|
||||
fWipeMenuItem->SetEnabled(false);
|
||||
fEjectMenuItem->SetEnabled(false);
|
||||
fSurfaceTestMenuItem->SetEnabled(false);
|
||||
@ -694,9 +694,9 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
||||
fDeleteMenuItem->SetEnabled(prepared);
|
||||
fChangeMenuItem->SetEnabled(prepared);
|
||||
|
||||
fChangeContextMenuItem->SetEnabled(prepared);
|
||||
fDeleteContextMenuItem->SetEnabled(prepared);
|
||||
fFormatContextMenuItem->SetEnabled(prepared);
|
||||
fDeleteContextMenuItem->SetEnabled(prepared);
|
||||
fChangeContextMenuItem->SetEnabled(prepared);
|
||||
|
||||
BPartition* partition = disk->FindDescendant(selectedPartition);
|
||||
|
||||
@ -750,19 +750,21 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
||||
&& partition->IsDevice()
|
||||
&& fDiskInitMenu->CountItems() > 0);
|
||||
|
||||
fChangeMenuItem->SetEnabled(notMountedAndWritable);
|
||||
fChangeMenuItem->SetEnabled(writable
|
||||
&& partition->CanEditParameters());
|
||||
fChangeContextMenuItem->SetEnabled(writable
|
||||
&& partition->CanEditParameters());
|
||||
|
||||
fDeleteMenuItem->SetEnabled(notMountedAndWritable
|
||||
&& !partition->IsDevice());
|
||||
fDeleteContextMenuItem->SetEnabled(notMountedAndWritable
|
||||
&& !partition->IsDevice());
|
||||
|
||||
fMountMenuItem->SetEnabled(!partition->IsMounted());
|
||||
fMountContextMenuItem->SetEnabled(!partition->IsMounted());
|
||||
|
||||
fFormatContextMenuItem->SetEnabled(notMountedAndWritable
|
||||
&& fFormatContextMenuItem->CountItems() > 0);
|
||||
fChangeContextMenuItem->SetEnabled(notMountedAndWritable);
|
||||
fDeleteContextMenuItem->SetEnabled(notMountedAndWritable
|
||||
&& !partition->IsDevice());
|
||||
fMountContextMenuItem->SetEnabled(notMountedAndWritable);
|
||||
|
||||
bool unMountable = false;
|
||||
if (partition->IsMounted()) {
|
||||
@ -790,12 +792,12 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
||||
fFormatContextMenuItem->SetEnabled(false);
|
||||
}
|
||||
|
||||
fOpenDiskProbeMenuItem->SetEnabled(true);
|
||||
fOpenDiskProbeContextMenuItem->SetEnabled(true);
|
||||
|
||||
if (prepared)
|
||||
disk->CancelModifications();
|
||||
|
||||
fOpenDiskProbeMenuItem->SetEnabled(true);
|
||||
fOpenDiskProbeContextMenuItem->SetEnabled(true);
|
||||
|
||||
fMountAllMenuItem->SetEnabled(true);
|
||||
}
|
||||
if (selectedPartition < 0) {
|
||||
@ -1378,9 +1380,6 @@ MainWindow::_ChangeParameters(BDiskDevice* disk, partition_id selectedPartition)
|
||||
_DisplayPartitionError(B_TRANSLATE("The panel experienced a "
|
||||
"problem!"), NULL, status);
|
||||
}
|
||||
// TODO: disk systems without an editor and support for name/type
|
||||
// changing will return B_CANCELED here -- we need to check this
|
||||
// before, and disable the menu entry instead
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user