* Unnamed volumes now get the disk size instead of "unnamed" in their mount

menu name, ie. "(unnamed Ext2 File System)" could become "(12.5 GB Ext2 File System)".
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26242 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-07-03 20:44:57 +00:00
parent c4d5cef0c6
commit dcdf3137e1

View File

@ -109,9 +109,18 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level)
if (type == NULL)
return false;
name = "(unnamed ";
name << type;
name << ")";
uint32 divisor = 1UL << 30;
char unit = 'G';
if (partition->Size() < divisor) {
divisor = 1UL << 20;
unit = 'M';
}
char* buffer = name.LockBuffer(256);
snprintf(buffer, 256, "(%.1f %cB %s)",
1.0 * partition->Size() / divisor, unit, type);
name.UnlockBuffer();
}
}
@ -303,7 +312,7 @@ MountMenu::AddDynamicItem(add_state)
BMenuItem *mountAll = new BMenuItem("Mount All", new BMessage(kMountAllNow));
AddItem(mountAll);
BMenuItem *mountSettings = new BMenuItem("Settings"B_UTF8_ELLIPSIS,
BMenuItem *mountSettings = new BMenuItem("Settings" B_UTF8_ELLIPSIS,
new BMessage(kRunAutomounterSettings));
AddItem(mountSettings);