Intel partition: activate the first created partition.

The default MBR relies on at least one partition being active. The first
one sounds like a good choice.

Fixes #7930.
This commit is contained in:
Adrien Destugues 2014-10-31 14:12:44 +01:00
parent a62c3f918c
commit d0a662e20a
3 changed files with 8 additions and 3 deletions

View File

@ -301,7 +301,9 @@ PartitionMapHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
if (type == B_CREATE_PARAMETER_EDITOR
|| type == B_PROPERTIES_PARAMETER_EDITOR) {
try {
*editor = new PrimaryPartitionEditor();
BMutablePartition* partition = Partition();
int32 count = partition->CountChildren();
*editor = new PrimaryPartitionEditor(count == 0);
} catch (std::bad_alloc) {
return B_NO_MEMORY;
}

View File

@ -19,12 +19,15 @@
#define B_TRANSLATION_CONTEXT "PrimaryPartitionEditor"
PrimaryPartitionEditor::PrimaryPartitionEditor()
PrimaryPartitionEditor::PrimaryPartitionEditor(bool first)
{
fActiveCheckBox = new BCheckBox("active", B_TRANSLATE("Active partition"),
NULL);
fView = new BGroupView(B_VERTICAL);
fView->AddChild(fActiveCheckBox);
// The first partition is active by default. Others are not.
fActiveCheckBox->SetValue(first);
}

View File

@ -16,7 +16,7 @@
class PrimaryPartitionEditor : public BPartitionParameterEditor {
public:
PrimaryPartitionEditor();
PrimaryPartitionEditor(bool first);
virtual ~PrimaryPartitionEditor();
virtual BView* View();