[haiku-commits] haiku: hrev44465 - src/apps/drivesetup

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 3 Aug 2012 18:59:55 +0200 (CEST)

hrev44465 adds 4 changesets to branch 'master'
old head: e9e70c0f95dd96e8ce177443a468e6a9358f0032
new head: 33d23e8fed4f33534319306bffffbe376fe015b8

----------------------------------------------------------------------------

badea72: DriveSetup: Reorganize Disk menu.
  
  * Group destructive and non-destructive operations
  * Rename Disk->Format to Wipe (seems like a more modern term)
  * Mostly bikeshed :)

448216a: 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

8fe3bba: DriveSetup: Don't show unimplemented tools

33d23e8: DriveSetup: Show a quick warning when formatting raw disk
  
  * Another translation candidate :)

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 62 insertions(+), 35 deletions(-)
src/apps/drivesetup/MainWindow.cpp |   95 ++++++++++++++++++++------------
src/apps/drivesetup/MainWindow.h   |    2 +-

############################################################################

Commit:      badea728fa8d7c91e70a3cc52e37da25b42239a9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=badea72
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri Aug  3 15:22:33 2012 UTC

DriveSetup: Reorganize Disk menu.

* Group destructive and non-destructive operations
* Rename Disk->Format to Wipe (seems like a more modern term)
* Mostly bikeshed :)

----------------------------------------------------------------------------

diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index dd50a58..78118d4 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -170,7 +170,7 @@ MainWindow::MainWindow(BRect frame)
        BMenuBar* menuBar = new BMenuBar(Bounds(), "root menu");
 
        // create all the menu items
-       fFormatMI = new BMenuItem(B_TRANSLATE("Format (not implemented)"),
+       fWipeMI = new BMenuItem(B_TRANSLATE("Wipe (not implemented)"),
                new BMessage(MSG_FORMAT));
        fEjectMI = new BMenuItem(B_TRANSLATE("Eject"),
                new BMessage(MSG_EJECT), 'E');
@@ -193,17 +193,17 @@ MainWindow::MainWindow(BRect frame)
 
        // Disk menu
        fDiskMenu = new BMenu(B_TRANSLATE("Disk"));
-       fDiskMenu->AddItem(fFormatMI);
 
+       fDiskMenu->AddItem(fWipeMI);
        fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize"));
        fDiskMenu->AddItem(fDiskInitMenu);
 
-       fDiskMenu->AddItem(fEjectMI);
-       fDiskMenu->AddItem(fSurfaceTestMI);
-
        fDiskMenu->AddSeparatorItem();
 
+       fDiskMenu->AddItem(fEjectMI);
+       fDiskMenu->AddItem(fSurfaceTestMI);
        fDiskMenu->AddItem(fRescanMI);
+
        menuBar->AddItem(fDiskMenu);
 
        // Parition menu
@@ -529,12 +529,12 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
        fFormatMenu->SetEnabled(false);
 
        if (!disk) {
-               fFormatMI->SetEnabled(false);
+               fWipeMI->SetEnabled(false);
                fEjectMI->SetEnabled(false);
                fSurfaceTestMI->SetEnabled(false);
        } else {
-//             fFormatMI->SetEnabled(true);
-               fFormatMI->SetEnabled(false);
+//             fWipeMI->SetEnabled(true);
+               fWipeMI->SetEnabled(false);
                fEjectMI->SetEnabled(disk->IsRemovableMedia());
 //             fSurfaceTestMI->SetEnabled(true);
                fSurfaceTestMI->SetEnabled(false);
diff --git a/src/apps/drivesetup/MainWindow.h b/src/apps/drivesetup/MainWindow.h
index 1700e50..24d0e44 100644
--- a/src/apps/drivesetup/MainWindow.h
+++ b/src/apps/drivesetup/MainWindow.h
@@ -88,7 +88,7 @@ private:
                        BMenu*                          fPartitionMenu;
                        BMenu*                          fFormatMenu;
 
-                       BMenuItem*                      fFormatMI;
+                       BMenuItem*                      fWipeMI;
                        BMenuItem*                      fEjectMI;
                        BMenuItem*                      fSurfaceTestMI;
                        BMenuItem*                      fRescanMI;

############################################################################

Commit:      448216aff890d4a8d5538b87a43f3ebd5bac83b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=448216a
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri Aug  3 16:07:57 2012 UTC

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

----------------------------------------------------------------------------

diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index 78118d4..d6319cd 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -649,8 +649,8 @@ MainWindow::_DisplayPartitionError(BString _message,
 
        if (error < B_OK) {
                BString helper = message;
-               const char* errorString =
-                       B_TRANSLATE_COMMENT("Error: ", "in any error alert");
+               const char* errorString
+                       = B_TRANSLATE_COMMENT("Error: ", "in any error alert");
                snprintf(message, sizeof(message), "%s\n\n%s%s", 
helper.String(),
                        errorString, strerror(error));
        }
@@ -806,25 +806,6 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
                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;
        fDDRoster.RewindDiskSystems();
        bool found = false;
@@ -837,6 +818,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
                }
        }
 
+       char message[512];
+
        if (!found) {
                snprintf(message, sizeof(message), B_TRANSLATE("Disk system 
\"%s\"\" "
                        "not found!"));
@@ -844,6 +827,31 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
                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);
        status_t ret = modificationPreparer.ModificationStatus();
        if (ret != B_OK) {
@@ -854,6 +862,8 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
 
        BString name;
        BString parameters;
+
+       // TODO: diskSystem.IsFileSystem() seems like a better fit here?
        if (diskSystemName == "Be File System") {
                InitParamsPanel* panel = new InitParamsPanel(this, 
diskSystemName,
                        partition);
@@ -930,11 +940,21 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
        partition = disk->FindDescendant(selectedPartition);
 
        if (ret == B_OK) {
-               _DisplayPartitionError(B_TRANSLATE("The partition %s has been "
-                       "successfully initialized.\n"), partition);
+               if (diskSystem.IsFileSystem()) {
+                       _DisplayPartitionError(B_TRANSLATE("The partition %s 
has been "
+                               "successfully formatted.\n"), partition);
+               } else {
+                       _DisplayPartitionError(B_TRANSLATE("The disk has been "
+                               "successfully initialized.\n"), partition);
+               }
        } else {
-               _DisplayPartitionError(B_TRANSLATE("Failed to initialize the "
-                       "partition %s!\n"), partition, ret);
+               if (diskSystem.IsFileSystem()) {
+                       _DisplayPartitionError(B_TRANSLATE("Failed to format 
the "
+                               "partition %s!\n"), partition, ret);
+               } else {
+                       _DisplayPartitionError(B_TRANSLATE("Failed to 
initialize the "
+                               "disk %s!\n"), partition, ret);
+               }
        }
 
        _ScanDrives();
@@ -1042,7 +1062,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id 
selectedPartition)
        ret = modificationPreparer.CommitModifications();
 
        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."));
                return;
        }
@@ -1055,6 +1075,7 @@ MainWindow::_Create(BDiskDevice* disk, partition_id 
selectedPartition)
        fDiskView->ForceUpdate();
 }
 
+
 void
 MainWindow::_Delete(BDiskDevice* disk, partition_id selectedPartition)
 {

############################################################################

Commit:      8fe3bba7272250f4be51e8247e5f0ab049c67dc2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8fe3bba
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri Aug  3 16:47:44 2012 UTC

DriveSetup: Don't show unimplemented tools

----------------------------------------------------------------------------

diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index d6319cd..b9e5bc7 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -194,14 +194,14 @@ MainWindow::MainWindow(BRect frame)
        // Disk menu
        fDiskMenu = new BMenu(B_TRANSLATE("Disk"));
 
-       fDiskMenu->AddItem(fWipeMI);
+       // fDiskMenu->AddItem(fWipeMI);
        fDiskInitMenu = new BMenu(B_TRANSLATE("Initialize"));
        fDiskMenu->AddItem(fDiskInitMenu);
 
        fDiskMenu->AddSeparatorItem();
 
        fDiskMenu->AddItem(fEjectMI);
-       fDiskMenu->AddItem(fSurfaceTestMI);
+       // fDiskMenu->AddItem(fSurfaceTestMI);
        fDiskMenu->AddItem(fRescanMI);
 
        menuBar->AddItem(fDiskMenu);

############################################################################

Revision:    hrev44465
Commit:      33d23e8fed4f33534319306bffffbe376fe015b8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=33d23e8
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Fri Aug  3 16:58:46 2012 UTC

DriveSetup: Show a quick warning when formatting raw disk

* Another translation candidate :)

----------------------------------------------------------------------------

diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index b9e5bc7..e51cb36 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -828,7 +828,13 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
        }
 
        if (diskSystem.IsFileSystem()) {
-               if (partition->ContentName() && 
strlen(partition->ContentName()) > 0) {
+               if (disk->ID() == selectedPartition) {
+                       snprintf(message, sizeof(message), B_TRANSLATE("Are you 
sure you "
+                               "want to format a raw disk? (most people 
initialize the disk "
+                               "with a partitioning system first) You will be 
asked "
+                               "again before changes are written to the 
disk."));
+               } else 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."),


Other related posts:

  • » [haiku-commits] haiku: hrev44465 - src/apps/drivesetup - kallisti5