* 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:
@@ -109,9 +109,18 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level)
|
|||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
name = "(unnamed ";
|
uint32 divisor = 1UL << 30;
|
||||||
name << type;
|
char unit = 'G';
|
||||||
name << ")";
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user