[haiku-commits] haiku: hrev48359 - src/apps/bootmanager

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 21 Nov 2014 18:15:10 +0100 (CET)

hrev48359 adds 1 changeset to branch 'master'
old head: 1f8b3fdb7e10d481850fd91618e7a8b5b57bcace
new head: 4011cb5d303d89140dc966279f894865a6e9a208
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4011cb5+%5E1f8b3fd

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

4011cb5: BootManager: different error when no MBR is found
  
  We were using the same "no space available" message used when the first
  partition starts too early. Be more specific here to make it clearer
  what the problem is.
  
  Fixes #7087.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

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

Revision:    hrev48359
Commit:      4011cb5d303d89140dc966279f894865a6e9a208
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4011cb5
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Fri Nov 21 17:14:10 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/7087

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

3 files changed, 28 insertions(+), 8 deletions(-)
src/apps/bootmanager/BootManagerController.cpp | 10 ++++++++--
src/apps/bootmanager/DrivesPage.cpp            | 19 ++++++++++++++++---
src/apps/bootmanager/LegacyBootMenu.cpp        |  7 ++++---

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

diff --git a/src/apps/bootmanager/BootManagerController.cpp 
b/src/apps/bootmanager/BootManagerController.cpp
index 7cc5fcd..4899983 100644
--- a/src/apps/bootmanager/BootManagerController.cpp
+++ b/src/apps/bootmanager/BootManagerController.cpp
@@ -297,12 +297,18 @@ BootManagerController::_CreateErrorEntryPage()
 {
        BString description;
 
-       if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) {
+       if (fCollectPartitionsStatus == B_ENTRY_NOT_FOUND) {
                description << B_TRANSLATE_COMMENT("Partition table not 
compatible",
                                "Title") << "\n\n"
                        << B_TRANSLATE("The partition table of the first hard 
disk is not "
                                "compatible with Boot Manager.\n"
-                               "Boot Manager needs 2 KB available space before 
the first "
+                               "Boot Manager only works with IBM PC MBR 
partitions.");
+       } else if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) {
+               description << B_TRANSLATE_COMMENT("First partition starts too 
early",
+                               "Title") << "\n\n"
+                       << B_TRANSLATE("The first partition on the disk starts 
too early "
+                               "and does not leave enough space free for a 
boot menu.\n"
+                               "Boot Manager needs 2 KiB available space 
before the first "
                                "partition.");
        } else {
                description << B_TRANSLATE_COMMENT("Error reading partition 
table",
diff --git a/src/apps/bootmanager/DrivesPage.cpp 
b/src/apps/bootmanager/DrivesPage.cpp
index 0326b3b..43a96ce 100644
--- a/src/apps/bootmanager/DrivesPage.cpp
+++ b/src/apps/bootmanager/DrivesPage.cpp
@@ -164,9 +164,22 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool 
complete)
        if (fCanBeInstalled != B_OK) {
                owner->SetHighColor(140, 0, 0);
                owner->MovePenBy(fBaselineOffset, 0);
-               owner->DrawString(fCanBeInstalled == B_PARTITION_TOO_SMALL
-                       ? B_TRANSLATE_COMMENT("No space available!", "Cannot 
install")
-                       : B_TRANSLATE_COMMENT("Cannot access!", "Cannot 
install"));
+               const char* message;
+               switch (fCanBeInstalled) {
+                       case B_PARTITION_TOO_SMALL:
+                               message = B_TRANSLATE_COMMENT("No space 
available!",
+                                       "Cannot install");
+                               break;
+                       case B_ENTRY_NOT_FOUND:
+                               message = B_TRANSLATE_COMMENT("Incompatible 
format!",
+                                       "Cannot install");
+                               break;
+                       default:
+                               message = B_TRANSLATE_COMMENT("Cannot access!",
+                                       "Cannot install");
+                               break;
+               }
+               owner->DrawString(message);
        }
 
        owner->PopState();
diff --git a/src/apps/bootmanager/LegacyBootMenu.cpp 
b/src/apps/bootmanager/LegacyBootMenu.cpp
index 9fe02be..185b31d 100644
--- a/src/apps/bootmanager/LegacyBootMenu.cpp
+++ b/src/apps/bootmanager/LegacyBootMenu.cpp
@@ -318,11 +318,12 @@ LegacyBootMenu::CanBeInstalled(const BootDrive& drive)
        PartitionVisitor visitor;
        device.VisitEachDescendant(&visitor);
 
+       if (!visitor.HasPartitions())
+               return B_ENTRY_NOT_FOUND;
+
        // Enough space to write boot menu to drive?
-       if (!visitor.HasPartitions()
-               || visitor.FirstOffset() < (int)sizeof(kBootLoader)) {
+       if (visitor.FirstOffset() < (int)sizeof(kBootLoader))
                return B_PARTITION_TOO_SMALL;
-       }
 
        return B_OK;
 }


Other related posts:

  • » [haiku-commits] haiku: hrev48359 - src/apps/bootmanager - pulkomandy