Patch by Bryce Groff: Allow the disk system add-ons to return a NULL parameter

editor, when they don't have any additional parameters to edit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32096 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-08-03 19:05:38 +00:00
parent 4199b36807
commit fe05e6c359
+28 -1
View File
@@ -125,9 +125,11 @@ CreateParamsPanel::MessageReceived(BMessage* message)
break; break;
case MSG_PARTITION_TYPE: case MSG_PARTITION_TYPE:
if (fEditor != NULL) {
const char* type; const char* type;
message->FindString("type", &type); message->FindString("type", &type);
fEditor->PartitionTypeChanged(type); fEditor->PartitionTypeChanged(type);
}
break; break;
default: default:
@@ -185,12 +187,14 @@ CreateParamsPanel::Go(off_t& offset, off_t& size, BString& name,
} }
// get editors parameters // get editors parameters
if (fEditor != NULL) {
if (fEditor->FinishedEditing()) { if (fEditor->FinishedEditing()) {
status_t status = fEditor->GetParameters(&parameters); status_t status = fEditor->GetParameters(&parameters);
if (status != B_OK) if (status != B_OK)
fReturnValue = status; fReturnValue = status;
} }
} }
}
int32 value = fReturnValue; int32 value = fReturnValue;
@@ -249,11 +253,13 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
.Add(fTypeMenuField) .Add(fTypeMenuField)
; ;
BBox* infoBox = new BBox(B_FANCY_BORDER, infoView); BBox* infoBox = new BBox(B_FANCY_BORDER, infoView);
BView* rootView;
parent->GetChildCreationParameterEditor(NULL, &fEditor); parent->GetChildCreationParameterEditor(NULL, &fEditor);
if (fEditor != NULL) {
BBox* parameterBox = new BBox(B_FANCY_BORDER, fEditor->View()); BBox* parameterBox = new BBox(B_FANCY_BORDER, fEditor->View());
BView* rootView = BGroupLayoutBuilder(B_VERTICAL, 4) rootView = BGroupLayoutBuilder(B_VERTICAL, 4)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
// slider and types // slider and types
@@ -275,6 +281,27 @@ CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
.Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
; ;
} else {
rootView = BGroupLayoutBuilder(B_VERTICAL, 4)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
// slider and types
.Add(infoBox)
.Add(BSpaceLayoutItem::CreateVerticalStrut(10))
// controls
.AddGroup(B_HORIZONTAL, 10)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
.AddGlue()
.Add(fCancelButton)
.Add(fOKButton)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
.End()
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
;
}
SetLayout(new BGroupLayout(B_HORIZONTAL)); SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(rootView); AddChild(rootView);