Skip to content

Commit

Permalink
DriveSetup: fixed device row size/name.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
axeld committed Jan 23, 2013
1 parent c8ae0dd commit 5e08103
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/apps/drivesetup/PartitionList.cpp
@@ -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.
*
* Authors:
Expand Down Expand Up @@ -222,11 +222,11 @@ PartitionListRow::PartitionListRow(BPartition* partition)
SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
} else if (partition->IsDevice()) {
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
if (partition->Name() != NULL && partition->Name()[0])
SetField(new BStringField(partition->Name()), kVolumeNameColumn);
else
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
} else if (partition->CountChildren() > 0) {
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
Expand All @@ -251,9 +251,13 @@ PartitionListRow::PartitionListRow(BPartition* partition)

// Size

char size[1024];
SetField(new BStringField(string_for_size(partition->Size(), size,
sizeof(size))), kSizeColumn);
if (fSize > 0) {
char size[1024];
SetField(new BStringField(string_for_size(partition->Size(), size,
sizeof(size))), kSizeColumn);
} else {
SetField(new BStringField(kUnavailableString), kSizeColumn);
}

// Additional parameters

Expand Down

0 comments on commit 5e08103

Please sign in to comment.