DriveSetup: fixed device row size/name.

* Apparently, the order the fields are set matters, so the drive name
  and the size now appear in the list as they should have before.
* Leave the size field empty if the size is 0.
This commit is contained in:
Axel Dörfler
2013-01-23 21:27:25 +01:00
parent c8ae0dd87c
commit 5e081035a7
+6 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2006-2012 Haiku Inc. All rights reserved. * Copyright 2006-2013 Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Authors: * Authors:
@@ -222,11 +222,11 @@ PartitionListRow::PartitionListRow(BPartition* partition)
SetField(new BStringField(partition->ContentType()), kFilesystemColumn); SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
SetField(new BStringField(partition->ContentName()), kVolumeNameColumn); SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
} else if (partition->IsDevice()) { } else if (partition->IsDevice()) {
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
if (partition->Name() != NULL && partition->Name()[0]) if (partition->Name() != NULL && partition->Name()[0])
SetField(new BStringField(partition->Name()), kVolumeNameColumn); SetField(new BStringField(partition->Name()), kVolumeNameColumn);
else else
SetField(new BStringField(kUnavailableString), kVolumeNameColumn); SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
} else if (partition->CountChildren() > 0) { } else if (partition->CountChildren() > 0) {
SetField(new BStringField(kUnavailableString), kFilesystemColumn); SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn); SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
@@ -251,9 +251,13 @@ PartitionListRow::PartitionListRow(BPartition* partition)
// Size // Size
if (fSize > 0) {
char size[1024]; char size[1024];
SetField(new BStringField(string_for_size(partition->Size(), size, SetField(new BStringField(string_for_size(partition->Size(), size,
sizeof(size))), kSizeColumn); sizeof(size))), kSizeColumn);
} else {
SetField(new BStringField(kUnavailableString), kSizeColumn);
}
// Additional parameters // Additional parameters