* 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:
parent
c4d5cef0c6
commit
dcdf3137e1
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user