Skip to content

Commit

Permalink
DriveSetup: Added column for the partition type.
Browse files Browse the repository at this point in the history
* This implements ticket #4235.
  • Loading branch information
axeld committed Jan 28, 2013
1 parent 2dd0a26 commit 5a81662
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions src/apps/drivesetup/PartitionList.cpp
@@ -1,13 +1,15 @@
/*
* Copyright 2006-2013 Haiku Inc. All rights reserved.
* Copyright 2006-2013, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Ithamar R. Adema <ithamar@unet.nl>
* James Urquhart
* Stephan Aßmus <superstippi@gmx.de>
* Axel Dörfler, axeld@pinc-software.de
*/


#include "PartitionList.h"

#include <Catalog.h>
Expand All @@ -24,6 +26,19 @@
#define B_TRANSLATION_CONTEXT "PartitionList"


static const char* kUnavailableString = "";

enum {
kDeviceColumn,
kFilesystemColumn,
kVolumeNameColumn,
kMountedAtColumn,
kSizeColumn,
kParametersColumn,
kPartitionTypeColumn,
};


// #pragma mark - BBitmapStringField


Expand Down Expand Up @@ -179,18 +194,6 @@ PartitionColumn::InitTextMargin(BView* parent)
// #pragma mark - PartitionListRow


static const char* kUnavailableString = "";

enum {
kDeviceColumn,
kFilesystemColumn,
kVolumeNameColumn,
kMountedAtColumn,
kSizeColumn,
kParametersColumn
};


PartitionListRow::PartitionListRow(BPartition* partition)
:
Inherited(),
Expand Down Expand Up @@ -218,6 +221,8 @@ PartitionListRow::PartitionListRow(BPartition* partition)

// File system & volume name

BString partitionType(partition->Type());

if (partition->ContainsFileSystem()) {
SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
Expand All @@ -231,7 +236,6 @@ PartitionListRow::PartitionListRow(BPartition* partition)
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
} else {
BString partitionType(partition->Type());
if (!partitionType.IsEmpty()) {
partitionType.Prepend("(");
partitionType.Append(")");
Expand Down Expand Up @@ -278,6 +282,10 @@ PartitionListRow::PartitionListRow(BPartition* partition)
} else {
SetField(new BStringField(kUnavailableString), kParametersColumn);
}

// Partition type

SetField(new BStringField(partitionType), kPartitionTypeColumn);
}


Expand Down Expand Up @@ -333,8 +341,10 @@ PartitionListView::PartitionListView(const BRect& frame, uint32 resizeMode)
B_TRUNCATE_MIDDLE), kMountedAtColumn);
AddColumn(new PartitionColumn(B_TRANSLATE("Size"), 100, 50, 500,
B_TRUNCATE_END, B_ALIGN_RIGHT), kSizeColumn);
AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 150, 50, 500,
B_TRUNCATE_MIDDLE), kParametersColumn);
AddColumn(new PartitionColumn(B_TRANSLATE("Parameters"), 200, 50, 500,
B_TRUNCATE_END), kParametersColumn);
AddColumn(new PartitionColumn(B_TRANSLATE("Partition type"), 100, 50, 500,
B_TRUNCATE_END), kPartitionTypeColumn);

SetSortingEnabled(false);
}
Expand Down

0 comments on commit 5a81662

Please sign in to comment.