DriveSetup: Text / context cleanup

* Make sure we use consistant terminology
* No more Formatted partition "" messages when
  doing a partition map
* This commit will require translation work
This commit is contained in:
Alexander von Gluck IV
2012-08-03 11:59:47 -05:00
parent badea728fa
commit 448216aff8
+44 -23
View File
@@ -649,8 +649,8 @@ MainWindow::_DisplayPartitionError(BString _message,
if (error < B_OK) { if (error < B_OK) {
BString helper = message; BString helper = message;
const char* errorString = const char* errorString
B_TRANSLATE_COMMENT("Error: ", "in any error alert"); = B_TRANSLATE_COMMENT("Error: ", "in any error alert");
snprintf(message, sizeof(message), "%s\n\n%s%s", helper.String(), snprintf(message, sizeof(message), "%s\n\n%s%s", helper.String(),
errorString, strerror(error)); errorString, strerror(error));
} }
@@ -806,25 +806,6 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
return; return;
} }
char message[512];
if (partition->ContentName() && strlen(partition->ContentName()) > 0) {
snprintf(message, sizeof(message), B_TRANSLATE("Are you sure you want "
"to initialize the partition \"%s\"? You will be asked again "
"before changes are written to the disk."),
partition->ContentName());
} else {
snprintf(message, sizeof(message), B_TRANSLATE("Are you sure you want "
"to initialize the partition? You will be asked again "
"before changes are written to the disk."));
}
BAlert* alert = new BAlert("first notice", message,
B_TRANSLATE("Continue"), B_TRANSLATE("Cancel"), NULL,
B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
int32 choice = alert->Go();
if (choice == 1)
return;
BDiskSystem diskSystem; BDiskSystem diskSystem;
fDDRoster.RewindDiskSystems(); fDDRoster.RewindDiskSystems();
bool found = false; bool found = false;
@@ -837,6 +818,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
} }
} }
char message[512];
if (!found) { if (!found) {
snprintf(message, sizeof(message), B_TRANSLATE("Disk system \"%s\"\" " snprintf(message, sizeof(message), B_TRANSLATE("Disk system \"%s\"\" "
"not found!")); "not found!"));
@@ -844,6 +827,31 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
return; return;
} }
if (diskSystem.IsFileSystem()) {
if (partition->ContentName() && strlen(partition->ContentName()) > 0) {
snprintf(message, sizeof(message), B_TRANSLATE("Are you sure you "
"want to format the partition \"%s\"? You will be asked "
"again before changes are written to the disk."),
partition->ContentName());
} else {
snprintf(message, sizeof(message), B_TRANSLATE("Are you sure you "
"want to format the partition? You will be asked again "
"before changes are written to the disk."));
}
} else {
snprintf(message, sizeof(message), B_TRANSLATE("Are you sure you "
"want to initialize the selected disk? All data will be lost. "
"You will be asked again before changes are written to the "
"disk.\n"));
}
BAlert* alert = new BAlert("first notice", message,
B_TRANSLATE("Continue"), B_TRANSLATE("Cancel"), NULL,
B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
int32 choice = alert->Go();
if (choice == 1)
return;
ModificationPreparer modificationPreparer(disk); ModificationPreparer modificationPreparer(disk);
status_t ret = modificationPreparer.ModificationStatus(); status_t ret = modificationPreparer.ModificationStatus();
if (ret != B_OK) { if (ret != B_OK) {
@@ -854,6 +862,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
BString name; BString name;
BString parameters; BString parameters;
// TODO: diskSystem.IsFileSystem() seems like a better fit here?
if (diskSystemName == "Be File System") { if (diskSystemName == "Be File System") {
InitParamsPanel* panel = new InitParamsPanel(this, diskSystemName, InitParamsPanel* panel = new InitParamsPanel(this, diskSystemName,
partition); partition);
@@ -930,11 +940,21 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id selectedPartition,
partition = disk->FindDescendant(selectedPartition); partition = disk->FindDescendant(selectedPartition);
if (ret == B_OK) { if (ret == B_OK) {
if (diskSystem.IsFileSystem()) {
_DisplayPartitionError(B_TRANSLATE("The partition %s has been " _DisplayPartitionError(B_TRANSLATE("The partition %s has been "
"successfully formatted.\n"), partition);
} else {
_DisplayPartitionError(B_TRANSLATE("The disk has been "
"successfully initialized.\n"), partition); "successfully initialized.\n"), partition);
}
} else {
if (diskSystem.IsFileSystem()) {
_DisplayPartitionError(B_TRANSLATE("Failed to format the "
"partition %s!\n"), partition, ret);
} else { } else {
_DisplayPartitionError(B_TRANSLATE("Failed to initialize the " _DisplayPartitionError(B_TRANSLATE("Failed to initialize the "
"partition %s!\n"), partition, ret); "disk %s!\n"), partition, ret);
}
} }
_ScanDrives(); _ScanDrives();
@@ -1042,7 +1062,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
ret = modificationPreparer.CommitModifications(); ret = modificationPreparer.CommitModifications();
if (ret != B_OK) { if (ret != B_OK) {
_DisplayPartitionError(B_TRANSLATE("Failed to initialize the " _DisplayPartitionError(B_TRANSLATE("Failed to format the "
"partition. No changes have been written to disk.")); "partition. No changes have been written to disk."));
return; return;
} }
@@ -1055,6 +1075,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id selectedPartition)
fDiskView->ForceUpdate(); fDiskView->ForceUpdate();
} }
void void
MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition) MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition)
{ {