Minor cleanup.
* Renamed *MI members to *MenuItem.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2010 Haiku Inc. All rights reserved.
|
* Copyright 2002-2013 Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -170,59 +170,60 @@ MainWindow::MainWindow(BRect frame)
|
|||||||
BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu");
|
BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu");
|
||||||
|
|
||||||
// create all the menu items
|
// create all the menu items
|
||||||
fWipeMI = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
|
fWipeMenuItem = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
|
||||||
new BMessage(MSG_FORMAT));
|
new BMessage(MSG_FORMAT));
|
||||||
fEjectMI = new BMenuItem(B_TRANSLATE("Eject"),
|
fEjectMenuItem = new BMenuItem(B_TRANSLATE("Eject"),
|
||||||
new BMessage(MSG_EJECT), 'E');
|
new BMessage(MSG_EJECT), 'E');
|
||||||
fSurfaceTestMI = new BMenuItem(
|
fSurfaceTestMenuItem = new BMenuItem(
|
||||||
B_TRANSLATE("Surface test (not implemented)"),
|
B_TRANSLATE("Surface test (not implemented)"),
|
||||||
new BMessage(MSG_SURFACE_TEST));
|
new BMessage(MSG_SURFACE_TEST));
|
||||||
fRescanMI = new BMenuItem(B_TRANSLATE("Rescan"), new BMessage(MSG_RESCAN));
|
fRescanMenuItem = new BMenuItem(B_TRANSLATE("Rescan"),
|
||||||
|
new BMessage(MSG_RESCAN));
|
||||||
|
|
||||||
fCreateMI = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS),
|
fCreateMenuItem = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(MSG_CREATE), 'C');
|
new BMessage(MSG_CREATE), 'C');
|
||||||
fDeleteMI = new BMenuItem(B_TRANSLATE("Delete"),
|
fDeleteMenuItem = new BMenuItem(B_TRANSLATE("Delete"),
|
||||||
new BMessage(MSG_DELETE), 'D');
|
new BMessage(MSG_DELETE), 'D');
|
||||||
|
|
||||||
fMountMI = new BMenuItem(B_TRANSLATE("Mount"),
|
fMountMenuItem = new BMenuItem(B_TRANSLATE("Mount"),
|
||||||
new BMessage(MSG_MOUNT), 'M');
|
new BMessage(MSG_MOUNT), 'M');
|
||||||
fUnmountMI = new BMenuItem(B_TRANSLATE("Unmount"),
|
fUnmountMenuItem = new BMenuItem(B_TRANSLATE("Unmount"),
|
||||||
new BMessage(MSG_UNMOUNT), 'U');
|
new BMessage(MSG_UNMOUNT), 'U');
|
||||||
fMountAllMI = new BMenuItem(B_TRANSLATE("Mount all"),
|
fMountAllMenuItem = new BMenuItem(B_TRANSLATE("Mount all"),
|
||||||
new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY);
|
new BMessage(MSG_MOUNT_ALL), 'M', B_SHIFT_KEY);
|
||||||
|
|
||||||
// Disk menu
|
// Disk menu
|
||||||
fDiskMenu = new BMenu(B_TRANSLATE("Disk"));
|
fDiskMenu = new BMenu(B_TRANSLATE("Disk"));
|
||||||
|
|
||||||
// fDiskMenu->AddItem(fWipeMI);
|
// fDiskMenu->AddItem(fWipeMenuItem);
|
||||||
fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize"));
|
fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize"));
|
||||||
fDiskMenu->AddItem(fDiskInitMenu);
|
fDiskMenu->AddItem(fDiskInitMenu);
|
||||||
|
|
||||||
fDiskMenu->AddSeparatorItem();
|
fDiskMenu->AddSeparatorItem();
|
||||||
|
|
||||||
fDiskMenu->AddItem(fEjectMI);
|
fDiskMenu->AddItem(fEjectMenuItem);
|
||||||
// fDiskMenu->AddItem(fSurfaceTestMI);
|
// fDiskMenu->AddItem(fSurfaceTestMenuItem);
|
||||||
fDiskMenu->AddItem(fRescanMI);
|
fDiskMenu->AddItem(fRescanMenuItem);
|
||||||
|
|
||||||
menuBar->AddItem(fDiskMenu);
|
menuBar->AddItem(fDiskMenu);
|
||||||
|
|
||||||
// Parition menu
|
// Parition menu
|
||||||
fPartitionMenu = new BMenu(B_TRANSLATE("Partition"));
|
fPartitionMenu = new BMenu(B_TRANSLATE("Partition"));
|
||||||
fPartitionMenu->AddItem(fCreateMI);
|
fPartitionMenu->AddItem(fCreateMenuItem);
|
||||||
|
|
||||||
fFormatMenu = new BMenu(B_TRANSLATE("Format"));
|
fFormatMenu = new BMenu(B_TRANSLATE("Format"));
|
||||||
fPartitionMenu->AddItem(fFormatMenu);
|
fPartitionMenu->AddItem(fFormatMenu);
|
||||||
|
|
||||||
fPartitionMenu->AddItem(fDeleteMI);
|
fPartitionMenu->AddItem(fDeleteMenuItem);
|
||||||
|
|
||||||
fPartitionMenu->AddSeparatorItem();
|
fPartitionMenu->AddSeparatorItem();
|
||||||
|
|
||||||
fPartitionMenu->AddItem(fMountMI);
|
fPartitionMenu->AddItem(fMountMenuItem);
|
||||||
fPartitionMenu->AddItem(fUnmountMI);
|
fPartitionMenu->AddItem(fUnmountMenuItem);
|
||||||
|
|
||||||
fPartitionMenu->AddSeparatorItem();
|
fPartitionMenu->AddSeparatorItem();
|
||||||
|
|
||||||
fPartitionMenu->AddItem(fMountAllMI);
|
fPartitionMenu->AddItem(fMountAllMenuItem);
|
||||||
menuBar->AddItem(fPartitionMenu);
|
menuBar->AddItem(fPartitionMenu);
|
||||||
|
|
||||||
AddChild(menuBar);
|
AddChild(menuBar);
|
||||||
@@ -523,21 +524,21 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
while (BMenuItem* item = fDiskInitMenu->RemoveItem((int32)0))
|
while (BMenuItem* item = fDiskInitMenu->RemoveItem((int32)0))
|
||||||
delete item;
|
delete item;
|
||||||
|
|
||||||
fCreateMI->SetEnabled(false);
|
fCreateMenuItem->SetEnabled(false);
|
||||||
fUnmountMI->SetEnabled(false);
|
fUnmountMenuItem->SetEnabled(false);
|
||||||
fDiskInitMenu->SetEnabled(false);
|
fDiskInitMenu->SetEnabled(false);
|
||||||
fFormatMenu->SetEnabled(false);
|
fFormatMenu->SetEnabled(false);
|
||||||
|
|
||||||
if (!disk) {
|
if (!disk) {
|
||||||
fWipeMI->SetEnabled(false);
|
fWipeMenuItem->SetEnabled(false);
|
||||||
fEjectMI->SetEnabled(false);
|
fEjectMenuItem->SetEnabled(false);
|
||||||
fSurfaceTestMI->SetEnabled(false);
|
fSurfaceTestMenuItem->SetEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
// fWipeMI->SetEnabled(true);
|
// fWipeMenuItem->SetEnabled(true);
|
||||||
fWipeMI->SetEnabled(false);
|
fWipeMenuItem->SetEnabled(false);
|
||||||
fEjectMI->SetEnabled(disk->IsRemovableMedia());
|
fEjectMenuItem->SetEnabled(disk->IsRemovableMedia());
|
||||||
// fSurfaceTestMI->SetEnabled(true);
|
// fSurfaceTestMenuItem->SetEnabled(true);
|
||||||
fSurfaceTestMI->SetEnabled(false);
|
fSurfaceTestMenuItem->SetEnabled(false);
|
||||||
|
|
||||||
// Create menu and items
|
// Create menu and items
|
||||||
BPartition* parentPartition = NULL;
|
BPartition* parentPartition = NULL;
|
||||||
@@ -547,11 +548,11 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parentPartition && parentPartition->ContainsPartitioningSystem())
|
if (parentPartition && parentPartition->ContainsPartitioningSystem())
|
||||||
fCreateMI->SetEnabled(true);
|
fCreateMenuItem->SetEnabled(true);
|
||||||
|
|
||||||
bool prepared = disk->PrepareModifications() == B_OK;
|
bool prepared = disk->PrepareModifications() == B_OK;
|
||||||
fFormatMenu->SetEnabled(prepared);
|
fFormatMenu->SetEnabled(prepared);
|
||||||
fDeleteMI->SetEnabled(prepared);
|
fDeleteMenuItem->SetEnabled(prepared);
|
||||||
|
|
||||||
BPartition* partition = disk->FindDescendant(selectedPartition);
|
BPartition* partition = disk->FindDescendant(selectedPartition);
|
||||||
|
|
||||||
@@ -584,7 +585,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mount items
|
// Mount items
|
||||||
if (partition) {
|
if (partition != NULL) {
|
||||||
fFormatMenu->SetEnabled(!partition->IsMounted()
|
fFormatMenu->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsReadOnly()
|
&& !partition->IsReadOnly()
|
||||||
&& partition->Device()->HasMedia()
|
&& partition->Device()->HasMedia()
|
||||||
@@ -596,10 +597,10 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
&& partition->IsDevice()
|
&& partition->IsDevice()
|
||||||
&& fDiskInitMenu->CountItems() > 0);
|
&& fDiskInitMenu->CountItems() > 0);
|
||||||
|
|
||||||
fDeleteMI->SetEnabled(!partition->IsMounted()
|
fDeleteMenuItem->SetEnabled(!partition->IsMounted()
|
||||||
&& !partition->IsDevice());
|
&& !partition->IsDevice());
|
||||||
|
|
||||||
fMountMI->SetEnabled(!partition->IsMounted());
|
fMountMenuItem->SetEnabled(!partition->IsMounted());
|
||||||
|
|
||||||
bool unMountable = false;
|
bool unMountable = false;
|
||||||
if (partition->IsMounted()) {
|
if (partition->IsMounted()) {
|
||||||
@@ -612,10 +613,10 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
} else
|
} else
|
||||||
unMountable = true;
|
unMountable = true;
|
||||||
}
|
}
|
||||||
fUnmountMI->SetEnabled(unMountable);
|
fUnmountMenuItem->SetEnabled(unMountable);
|
||||||
} else {
|
} else {
|
||||||
fDeleteMI->SetEnabled(false);
|
fDeleteMenuItem->SetEnabled(false);
|
||||||
fMountMI->SetEnabled(false);
|
fMountMenuItem->SetEnabled(false);
|
||||||
fFormatMenu->SetEnabled(false);
|
fFormatMenu->SetEnabled(false);
|
||||||
fDiskInitMenu->SetEnabled(false);
|
fDiskInitMenu->SetEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -623,11 +624,11 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
|
|||||||
if (prepared)
|
if (prepared)
|
||||||
disk->CancelModifications();
|
disk->CancelModifications();
|
||||||
|
|
||||||
fMountAllMI->SetEnabled(true);
|
fMountAllMenuItem->SetEnabled(true);
|
||||||
}
|
}
|
||||||
if (selectedPartition < 0) {
|
if (selectedPartition < 0) {
|
||||||
fDeleteMI->SetEnabled(false);
|
fDeleteMenuItem->SetEnabled(false);
|
||||||
fMountMI->SetEnabled(false);
|
fMountMenuItem->SetEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 Haiku Inc. All rights reserved.
|
* Copyright 2002-2013 Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -88,16 +88,16 @@ private:
|
|||||||
BMenu* fPartitionMenu;
|
BMenu* fPartitionMenu;
|
||||||
BMenu* fFormatMenu;
|
BMenu* fFormatMenu;
|
||||||
|
|
||||||
BMenuItem* fWipeMI;
|
BMenuItem* fWipeMenuItem;
|
||||||
BMenuItem* fEjectMI;
|
BMenuItem* fEjectMenuItem;
|
||||||
BMenuItem* fSurfaceTestMI;
|
BMenuItem* fSurfaceTestMenuItem;
|
||||||
BMenuItem* fRescanMI;
|
BMenuItem* fRescanMenuItem;
|
||||||
|
|
||||||
BMenuItem* fCreateMI;
|
BMenuItem* fCreateMenuItem;
|
||||||
BMenuItem* fDeleteMI;
|
BMenuItem* fDeleteMenuItem;
|
||||||
BMenuItem* fMountMI;
|
BMenuItem* fMountMenuItem;
|
||||||
BMenuItem* fUnmountMI;
|
BMenuItem* fUnmountMenuItem;
|
||||||
BMenuItem* fMountAllMI;
|
BMenuItem* fMountAllMenuItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user