MainWindow::_UpdateMenus():
* Don't fall back to the disk device, if no partition was selected. No idea why that was done. It led to operations (like initialize) being enabled that would fail, if invoked. * Don't check CanInitialize() on the selected partition with its current disk system to determine whether to enable the initialization menu. No idea why that was done either. It led to the menu being disabled, when there was no reason for it. * Also disable the initialization menu when no partition is selected. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42135 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -534,8 +534,10 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
|
|
||||||
// Create menu and items
|
// Create menu and items
|
||||||
BPartition* parentPartition = NULL;
|
BPartition* parentPartition = NULL;
|
||||||
if (selectedPartition <= -2)
|
if (selectedPartition <= -2) {
|
||||||
|
// a partitionable space item is selected
|
||||||
parentPartition = disk->FindDescendant(parentID);
|
parentPartition = disk->FindDescendant(parentID);
|
||||||
|
}
|
||||||
|
|
||||||
if (parentPartition && parentPartition->ContainsPartitioningSystem())
|
if (parentPartition && parentPartition->ContainsPartitioningSystem())
|
||||||
fCreateMI->SetEnabled(true);
|
fCreateMI->SetEnabled(true);
|
||||||
@@ -545,8 +547,6 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
fDeleteMI->SetEnabled(prepared);
|
fDeleteMI->SetEnabled(prepared);
|
||||||
|
|
||||||
BPartition* partition = disk->FindDescendant(selectedPartition);
|
BPartition* partition = disk->FindDescendant(selectedPartition);
|
||||||
if (partition == NULL)
|
|
||||||
partition = disk;
|
|
||||||
|
|
||||||
BDiskSystem diskSystem;
|
BDiskSystem diskSystem;
|
||||||
fDDRoster.RewindDiskSystems();
|
fDDRoster.RewindDiskSystems();
|
||||||
@@ -569,20 +569,17 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
BMenuItem* item = new BMenuItem(label.String(), message);
|
BMenuItem* item = new BMenuItem(label.String(), message);
|
||||||
|
|
||||||
// TODO: Very unintuitive that we have to use the pretty name here!
|
// TODO: Very unintuitive that we have to use the pretty name here!
|
||||||
// item->SetEnabled(partition->CanInitialize(diskSystem.Name()));
|
item->SetEnabled(partition != NULL
|
||||||
item->SetEnabled(partition->CanInitialize(diskSystem.PrettyName()));
|
// && partition->CanInitialize(diskSystem.Name()));
|
||||||
|
&& partition->CanInitialize(diskSystem.PrettyName()));
|
||||||
fInitMenu->AddItem(item);
|
fInitMenu->AddItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount items
|
// Mount items
|
||||||
if (partition) {
|
if (partition) {
|
||||||
BDiskSystem partitionDiskSystem;
|
|
||||||
partition->GetDiskSystem(&partitionDiskSystem);
|
|
||||||
fInitMenu->SetEnabled(!partition->IsMounted()
|
fInitMenu->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsReadOnly()
|
&& !partition->IsReadOnly()
|
||||||
&& partition->Device()->HasMedia()
|
&& partition->Device()->HasMedia());
|
||||||
// Check if the current disk system allows initialzation.
|
|
||||||
&& partition->CanInitialize(partitionDiskSystem.PrettyName()));
|
|
||||||
|
|
||||||
fDeleteMI->SetEnabled(!partition->IsMounted()
|
fDeleteMI->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsDevice());
|
&& !partition->IsDevice());
|
||||||
@@ -604,6 +601,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
} else {
|
} else {
|
||||||
fDeleteMI->SetEnabled(false);
|
fDeleteMI->SetEnabled(false);
|
||||||
fMountMI->SetEnabled(false);
|
fMountMI->SetEnabled(false);
|
||||||
|
fInitMenu->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prepared)
|
if (prepared)
|
||||||
|
|||||||
Reference in New Issue
Block a user