[haiku-commits] haiku: hrev45277 - in src: apps/drivesetup kits/storage/disk_device add-ons/disk_systems

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 12 Feb 2013 23:29:56 +0100 (CET)

hrev45277 adds 3 changesets to branch 'master'
old head: 32da57f74b8855c63e422aa74628d904f99f8ba7
new head: 8940ad259ab803eff8176766a73f8f531142c3b6
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=8940ad2+%5E32da57f

----------------------------------------------------------------------------

0ec2317: Cleanup.
  
  * Removed superfluous redundant comments.

1b26620: Cleanup.
  
  * There is no BDiskSystemAddOn::GetInitializationParameterEditor() method,
    and it's therefore never being called.

8940ad2: DriveSetup: Added support for changing partition parameters.
  
  * Does not seem to work yet, though. The intel disk system should support it
    now, but apparently the partition's delegate is not yet fully initialized
    for whatever reason.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

14 files changed, 484 insertions(+), 241 deletions(-)
src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp    |  10 -
src/add-ons/disk_systems/gpt/GPTDiskAddOn.h      |   3 -
.../disk_systems/intel/PartitionMapAddOn.cpp     |  13 +-
.../disk_systems/intel/PartitionMapAddOn.h       |   3 -
src/apps/drivesetup/AbstractParametersPanel.cpp  |   8 +-
src/apps/drivesetup/AbstractParametersPanel.h    |   1 +
src/apps/drivesetup/ChangeParametersPanel.cpp    | 196 +++++++++++++
src/apps/drivesetup/ChangeParametersPanel.h      |  56 ++++
src/apps/drivesetup/CreateParametersPanel.cpp    |  82 +-----
src/apps/drivesetup/CreateParametersPanel.h      |  14 +-
src/apps/drivesetup/Jamfile                      |   2 +
src/apps/drivesetup/MainWindow.cpp               | 287 +++++++++++++------
src/apps/drivesetup/MainWindow.h                 |   7 +-
src/kits/storage/disk_device/DiskSystemAddOn.cpp |  43 ---

############################################################################

Commit:      0ec2317830bf28a4e3f1b14fc7dd47da3bfcb347
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0ec2317
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Tue Feb 12 22:09:53 2013 UTC

Cleanup.

* Removed superfluous redundant comments.

----------------------------------------------------------------------------

diff --git a/src/kits/storage/disk_device/DiskSystemAddOn.cpp 
b/src/kits/storage/disk_device/DiskSystemAddOn.cpp
index 20b6722..73171be 100644
--- a/src/kits/storage/disk_device/DiskSystemAddOn.cpp
+++ b/src/kits/storage/disk_device/DiskSystemAddOn.cpp
@@ -12,7 +12,6 @@
 // #pragma mark - BDiskSystemAddOn
 
 
-// constructor
 BDiskSystemAddOn::BDiskSystemAddOn(const char* name, uint32 flags)
        :
        fName(name),
@@ -21,13 +20,11 @@ BDiskSystemAddOn::BDiskSystemAddOn(const char* name, uint32 
flags)
 }
 
 
-// destructor
 BDiskSystemAddOn::~BDiskSystemAddOn()
 {
 }
 
 
-// Name
 const char*
 BDiskSystemAddOn::Name() const
 {
@@ -35,7 +32,6 @@ BDiskSystemAddOn::Name() const
 }
 
 
-// Flags
 uint32
 BDiskSystemAddOn::Flags() const
 {
@@ -43,7 +39,6 @@ BDiskSystemAddOn::Flags() const
 }
 
 
-// CanInitialize
 bool
 BDiskSystemAddOn::CanInitialize(const BMutablePartition* partition)
 {
@@ -51,7 +46,6 @@ BDiskSystemAddOn::CanInitialize(const BMutablePartition* 
partition)
 }
 
 
-// GetInitializationParameterEditor
 status_t
 BDiskSystemAddOn::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
        BPartitionParameterEditor** editor)
@@ -60,7 +54,6 @@ BDiskSystemAddOn::GetParameterEditor(B_PARAMETER_EDITOR_TYPE 
type,
 }
 
 
-// ValidateInitialize
 status_t
 BDiskSystemAddOn::ValidateInitialize(const BMutablePartition* partition,
        BString* name, const char* parameters)
@@ -69,7 +62,6 @@ BDiskSystemAddOn::ValidateInitialize(const BMutablePartition* 
partition,
 }
 
 
-// Initialize
 status_t
 BDiskSystemAddOn::Initialize(BMutablePartition* partition, const char* name,
        const char* parameters, BPartitionHandle** handle)
@@ -78,7 +70,6 @@ BDiskSystemAddOn::Initialize(BMutablePartition* partition, 
const char* name,
 }
 
 
-// GetTypeForContentType
 status_t
 BDiskSystemAddOn::GetTypeForContentType(const char* contentType, BString* type)
 {
@@ -86,7 +77,6 @@ BDiskSystemAddOn::GetTypeForContentType(const char* 
contentType, BString* type)
 }
 
 
-// IsSubSystemFor
 bool
 BDiskSystemAddOn::IsSubSystemFor(const BMutablePartition* child)
 {
@@ -97,7 +87,6 @@ BDiskSystemAddOn::IsSubSystemFor(const BMutablePartition* 
child)
 // #pragma mark - BPartitionHandle
 
 
-// constructor
 BPartitionHandle::BPartitionHandle(BMutablePartition* partition)
        :
        fPartition(partition)
@@ -105,13 +94,11 @@ BPartitionHandle::BPartitionHandle(BMutablePartition* 
partition)
 }
 
 
-// destructor
 BPartitionHandle::~BPartitionHandle()
 {
 }
 
 
-// Partition
 BMutablePartition*
 BPartitionHandle::Partition() const
 {
@@ -119,7 +106,6 @@ BPartitionHandle::Partition() const
 }
 
 
-// SupportedOperations
 uint32
 BPartitionHandle::SupportedOperations(uint32 mask)
 {
@@ -127,7 +113,6 @@ BPartitionHandle::SupportedOperations(uint32 mask)
 }
 
 
-// SupportedChildOperations
 uint32
 BPartitionHandle::SupportedChildOperations(const BMutablePartition* child,
        uint32 mask)
@@ -136,7 +121,6 @@ BPartitionHandle::SupportedChildOperations(const 
BMutablePartition* child,
 }
 
 
-// SupportsInitializingChild
 bool
 BPartitionHandle::SupportsInitializingChild(const BMutablePartition* child,
        const char* diskSystem)
@@ -145,7 +129,6 @@ BPartitionHandle::SupportsInitializingChild(const 
BMutablePartition* child,
 }
 
 
-// GetNextSupportedType
 status_t
 BPartitionHandle::GetNextSupportedType(const BMutablePartition* child,
        int32* cookie, BString* type)
@@ -154,7 +137,6 @@ BPartitionHandle::GetNextSupportedType(const 
BMutablePartition* child,
 }
 
 
-// GetPartitioningInfo
 status_t
 BPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
 {
@@ -162,7 +144,6 @@ BPartitionHandle::GetPartitioningInfo(BPartitioningInfo* 
info)
 }
 
 
-// Defragment
 status_t
 BPartitionHandle::Defragment()
 {
@@ -170,7 +151,6 @@ BPartitionHandle::Defragment()
 }
 
 
-// Repair
 status_t
 BPartitionHandle::Repair(bool checkOnly)
 {
@@ -178,7 +158,6 @@ BPartitionHandle::Repair(bool checkOnly)
 }
 
 
-// ValidateResize
 status_t
 BPartitionHandle::ValidateResize(off_t* size)
 {
@@ -186,7 +165,6 @@ BPartitionHandle::ValidateResize(off_t* size)
 }
 
 
-// ValidateResizeChild
 status_t
 BPartitionHandle::ValidateResizeChild(const BMutablePartition* child,
        off_t* size)
@@ -195,7 +173,6 @@ BPartitionHandle::ValidateResizeChild(const 
BMutablePartition* child,
 }
 
 
-// Resize
 status_t
 BPartitionHandle::Resize(off_t size)
 {
@@ -203,7 +180,6 @@ BPartitionHandle::Resize(off_t size)
 }
 
 
-// ResizeChild
 status_t
 BPartitionHandle::ResizeChild(BMutablePartition* child, off_t size)
 {
@@ -211,7 +187,6 @@ BPartitionHandle::ResizeChild(BMutablePartition* child, 
off_t size)
 }
 
 
-// ValidateMove
 status_t
 BPartitionHandle::ValidateMove(off_t* offset)
 {
@@ -221,7 +196,6 @@ BPartitionHandle::ValidateMove(off_t* offset)
 }
 
 
-// ValidateMoveChild
 status_t
 BPartitionHandle::ValidateMoveChild(const BMutablePartition* child,
        off_t* offset)
@@ -230,7 +204,6 @@ BPartitionHandle::ValidateMoveChild(const 
BMutablePartition* child,
 }
 
 
-// Move
 status_t
 BPartitionHandle::Move(off_t offset)
 {
@@ -240,7 +213,6 @@ BPartitionHandle::Move(off_t offset)
 }
 
 
-// MoveChild
 status_t
 BPartitionHandle::MoveChild(BMutablePartition* child, off_t offset)
 {
@@ -248,7 +220,6 @@ BPartitionHandle::MoveChild(BMutablePartition* child, off_t 
offset)
 }
 
 
-// ValidateSetContentName
 status_t
 BPartitionHandle::ValidateSetContentName(BString* name)
 {
@@ -256,7 +227,6 @@ BPartitionHandle::ValidateSetContentName(BString* name)
 }
 
 
-// ValidateSetName
 status_t
 BPartitionHandle::ValidateSetName(const BMutablePartition* child,
        BString* name)
@@ -265,7 +235,6 @@ BPartitionHandle::ValidateSetName(const BMutablePartition* 
child,
 }
 
 
-// SetContentName
 status_t
 BPartitionHandle::SetContentName(const char* name)
 {
@@ -273,7 +242,6 @@ BPartitionHandle::SetContentName(const char* name)
 }
 
 
-// SetName
 status_t
 BPartitionHandle::SetName(BMutablePartition* child, const char* name)
 {
@@ -281,7 +249,6 @@ BPartitionHandle::SetName(BMutablePartition* child, const 
char* name)
 }
 
 
-// ValidateSetType
 status_t
 BPartitionHandle::ValidateSetType(const BMutablePartition* child,
        const char* type)
@@ -290,7 +257,6 @@ BPartitionHandle::ValidateSetType(const BMutablePartition* 
child,
 }
 
 
-// SetType
 status_t
 BPartitionHandle::SetType(BMutablePartition* child, const char* type)
 {
@@ -298,7 +264,6 @@ BPartitionHandle::SetType(BMutablePartition* child, const 
char* type)
 }
 
 
-// GetContentParameterEditor
 status_t
 BPartitionHandle::GetContentParameterEditor(BPartitionParameterEditor** editor)
 {
@@ -306,7 +271,6 @@ 
BPartitionHandle::GetContentParameterEditor(BPartitionParameterEditor** editor)
 }
 
 
-// GetParameterEditor
 status_t
 BPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
        BPartitionParameterEditor** editor)
@@ -315,7 +279,6 @@ 
BPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
 }
 
 
-// ValidateSetContentParameters
 status_t
 BPartitionHandle::ValidateSetContentParameters(const char* parameters)
 {
@@ -323,7 +286,6 @@ BPartitionHandle::ValidateSetContentParameters(const char* 
parameters)
 }
 
 
-// ValidateSetParameters
 status_t
 BPartitionHandle::ValidateSetParameters(const BMutablePartition* child,
        const char* parameters)
@@ -332,7 +294,6 @@ BPartitionHandle::ValidateSetParameters(const 
BMutablePartition* child,
 }
 
 
-// SetContentParameters
 status_t
 BPartitionHandle::SetContentParameters(const char* parameters)
 {
@@ -340,7 +301,6 @@ BPartitionHandle::SetContentParameters(const char* 
parameters)
 }
 
 
-// SetParameters
 status_t
 BPartitionHandle::SetParameters(BMutablePartition* child,
        const char* parameters)
@@ -349,7 +309,6 @@ BPartitionHandle::SetParameters(BMutablePartition* child,
 }
 
 
-// ValidateCreateChild
 status_t
 BPartitionHandle::ValidateCreateChild(off_t* offset, off_t* size,
        const char* type, BString* name, const char* parameters)
@@ -358,7 +317,6 @@ BPartitionHandle::ValidateCreateChild(off_t* offset, off_t* 
size,
 }
 
 
-// CreateChild
 status_t
 BPartitionHandle::CreateChild(off_t offset, off_t size, const char* type,
        const char* name, const char* parameters, BMutablePartition** child)
@@ -367,7 +325,6 @@ BPartitionHandle::CreateChild(off_t offset, off_t size, 
const char* type,
 }
 
 
-// DeleteChild
 status_t
 BPartitionHandle::DeleteChild(BMutablePartition* child)
 {

############################################################################

Commit:      1b2662019b27ae0e478131506e56d2380d9cf4b5
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1b26620
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Tue Feb 12 22:26:49 2013 UTC

Cleanup.

* There is no BDiskSystemAddOn::GetInitializationParameterEditor() method,
  and it's therefore never being called.

----------------------------------------------------------------------------

diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp 
b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp
index 5fc79e0..92f9488 100644
--- a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp
+++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.cpp
@@ -100,16 +100,6 @@ GPTDiskAddOn::CanInitialize(const BMutablePartition* 
partition)
 
 
 status_t
-GPTDiskAddOn::GetInitializationParameterEditor(
-       const BMutablePartition* partition, BPartitionParameterEditor** editor)
-{
-       // Nothing to edit, really.
-       *editor = NULL;
-       return B_OK;
-}
-
-
-status_t
 GPTDiskAddOn::ValidateInitialize(const BMutablePartition* partition,
        BString* name, const char* parameters)
 {
diff --git a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h 
b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h
index 40349b7..da80753 100644
--- a/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h
+++ b/src/add-ons/disk_systems/gpt/GPTDiskAddOn.h
@@ -20,9 +20,6 @@ public:
 
        virtual bool                            CanInitialize(
                                                                        const 
BMutablePartition* partition);
-       virtual status_t                        
GetInitializationParameterEditor(
-                                                                       const 
BMutablePartition* partition,
-                                                                       
BPartitionParameterEditor** editor);
        virtual status_t                        ValidateInitialize(
                                                                        const 
BMutablePartition* partition,
                                                                        
BString* name, const char* parameters);
diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp 
b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
index f4cbb0a..fa7e617 100644
--- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
+++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
@@ -98,16 +98,6 @@ PartitionMapAddOn::CanInitialize(const BMutablePartition* 
partition)
 
 
 status_t
-PartitionMapAddOn::GetInitializationParameterEditor(
-       const BMutablePartition* partition, BPartitionParameterEditor** editor)
-{
-       // Nothing to edit, really.
-       *editor = NULL;
-       return B_OK;
-}
-
-
-status_t
 PartitionMapAddOn::ValidateInitialize(const BMutablePartition* partition,
        BString* name, const char* parameters)
 {
diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.h 
b/src/add-ons/disk_systems/intel/PartitionMapAddOn.h
index ecd3ea2..343f3cd 100644
--- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.h
+++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.h
@@ -21,9 +21,6 @@ public:
 
        virtual bool                            CanInitialize(
                                                                        const 
BMutablePartition* partition);
-       virtual status_t                        
GetInitializationParameterEditor(
-                                                                       const 
BMutablePartition* partition,
-                                                                       
BPartitionParameterEditor** editor);
        virtual status_t                        ValidateInitialize(
                                                                        const 
BMutablePartition* partition,
                                                                        
BString* name, const char* parameters);

############################################################################

Revision:    hrev45277
Commit:      8940ad259ab803eff8176766a73f8f531142c3b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8940ad2
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Tue Feb 12 22:28:24 2013 UTC

DriveSetup: Added support for changing partition parameters.

* Does not seem to work yet, though. The intel disk system should support it
  now, but apparently the partition's delegate is not yet fully initialized
  for whatever reason.

----------------------------------------------------------------------------

diff --git a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp 
b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
index fa7e617..1da8e2a 100644
--- a/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
+++ b/src/add-ons/disk_systems/intel/PartitionMapAddOn.cpp
@@ -298,7 +298,8 @@ 
PartitionMapHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
        BPartitionParameterEditor** editor)
 {
        *editor = NULL;
-       if (type == B_CREATE_PARAMETER_EDITOR) {
+       if (type == B_CREATE_PARAMETER_EDITOR
+               || type == B_PROPERTIES_PARAMETER_EDITOR) {
                try {
                        *editor = new PrimaryPartitionEditor();
                } catch (std::bad_alloc) {
diff --git a/src/apps/drivesetup/AbstractParametersPanel.cpp 
b/src/apps/drivesetup/AbstractParametersPanel.cpp
index b161494..c86b5d3 100644
--- a/src/apps/drivesetup/AbstractParametersPanel.cpp
+++ b/src/apps/drivesetup/AbstractParametersPanel.cpp
@@ -200,7 +200,7 @@ AbstractParametersPanel::Go(BString& parameters, BMessage& 
storage)
        // Without an editor, we cannot change anything, anyway
        if (fEditor == NULL && NeedsEditor()) {
                parameters = "";
-               if (fReturnStatus == B_CANCELED)
+               if (ValidWithoutEditor() && fReturnStatus == B_CANCELED)
                        fReturnStatus = B_OK;
 
                if (!Lock())
@@ -257,6 +257,12 @@ AbstractParametersPanel::NeedsEditor() const
 }
 
 
+bool
+AbstractParametersPanel::ValidWithoutEditor() const
+{
+       return true;
+}
+
 status_t
 AbstractParametersPanel::ParametersReceived(const BString& parameters,
        BMessage& storage)
diff --git a/src/apps/drivesetup/AbstractParametersPanel.h 
b/src/apps/drivesetup/AbstractParametersPanel.h
index 9e24a33..4a83def 100644
--- a/src/apps/drivesetup/AbstractParametersPanel.h
+++ b/src/apps/drivesetup/AbstractParametersPanel.h
@@ -40,6 +40,7 @@ protected:
                        status_t                        Go(BString& parameters, 
BMessage& storage);
 
        virtual bool                            NeedsEditor() const;
+       virtual bool                            ValidWithoutEditor() const;
        virtual status_t                        ParametersReceived(const 
BString& parameters,
                                                                        
BMessage& storage);
        virtual void                            
AddControls(BLayoutBuilder::Group<>& builder,
diff --git a/src/apps/drivesetup/ChangeParametersPanel.cpp 
b/src/apps/drivesetup/ChangeParametersPanel.cpp
new file mode 100644
index 0000000..9781778
--- /dev/null
+++ b/src/apps/drivesetup/ChangeParametersPanel.cpp
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2008-2013 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT license.
+ *
+ * Authors:
+ *             Stephan Aßmus <superstippi@xxxxxx>
+ *             Axel Dörfler, axeld@xxxxxxxxxxxxxxxx.
+ *             Bryce Groff     <bgroff@xxxxxxxxxx>
+ *             Karsten Heimrich <host.haiku@xxxxxx>
+ */
+
+
+#include "ChangeParametersPanel.h"
+
+#include <Button.h>
+#include <Catalog.h>
+#include <ControlLook.h>
+#include <DiskDeviceTypes.h>
+#include <MenuField.h>
+#include <MenuItem.h>
+#include <MessageFilter.h>
+#include <PopUpMenu.h>
+#include <String.h>
+#include <TextControl.h>
+#include <Variant.h>
+
+#include "Support.h"
+
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "ChangeParametersPanel"
+
+
+enum {
+       MSG_PARTITION_TYPE                      = 'type',
+};
+
+
+ChangeParametersPanel::ChangeParametersPanel(BWindow* window,
+       BPartition* partition)
+       :
+       AbstractParametersPanel(window)
+{
+       CreateChangeControls(partition);
+
+       Init(B_PROPERTIES_PARAMETER_EDITOR, "", partition);
+}
+
+
+ChangeParametersPanel::~ChangeParametersPanel()
+{
+}
+
+
+status_t
+ChangeParametersPanel::Go(BString& name, BString& type, BString& parameters)
+{
+       BMessage storage;
+       return Go(name, type, parameters, storage);
+}
+
+
+void
+ChangeParametersPanel::MessageReceived(BMessage* message)
+{
+       switch (message->what) {
+               case MSG_PARTITION_TYPE:
+                       if (fEditor != NULL) {
+                               const char* type;
+                               if (message->FindString("type", &type) == B_OK)
+                                       fEditor->ParameterChanged("type", 
BVariant(type));
+                       }
+                       break;
+
+               default:
+                       AbstractParametersPanel::MessageReceived(message);
+       }
+}
+
+
+// #pragma mark - protected
+
+
+ChangeParametersPanel::ChangeParametersPanel(BWindow* window)
+       :
+       AbstractParametersPanel(window)
+{
+}
+
+
+status_t
+ChangeParametersPanel::Go(BString& name, BString& type, BString& parameters,
+       BMessage& storage)
+{
+       // The object will be deleted in Go(), so we need to get the values via
+       // a BMessage
+       status_t status = AbstractParametersPanel::Go(parameters, storage);
+       if (status != B_OK)
+               return status;
+
+       // get name
+       name.SetTo(storage.GetString("name", NULL));
+
+       // get type
+       type.SetTo(storage.GetString("type", NULL));
+
+       return B_OK;
+}
+
+
+void
+ChangeParametersPanel::CreateChangeControls(BPartition* parent)
+{
+       fNameTextControl = new BTextControl("Name Control",
+               B_TRANSLATE("Partition name:"), "", NULL);
+       fSupportsName = parent->SupportsChildName();
+
+       fTypePopUpMenu = new BPopUpMenu("Partition Type");
+
+       int32 cookie = 0;
+       BString supportedType;
+       while (parent->GetNextSupportedChildType(&cookie, &supportedType) == 
B_OK) {
+               BMessage* message = new BMessage(MSG_PARTITION_TYPE);
+               message->AddString("type", supportedType);
+               BMenuItem* item = new BMenuItem(supportedType, message);
+               fTypePopUpMenu->AddItem(item);
+
+               if (strcmp(supportedType, kPartitionTypeBFS) == 0)
+                       item->SetMarked(true);
+       }
+
+       fTypeMenuField = new BMenuField(B_TRANSLATE("Partition type:"),
+               fTypePopUpMenu);
+       fSupportsType = fTypePopUpMenu->CountItems() != 0;
+
+       fOkButton->SetLabel(B_TRANSLATE("Change"));
+}
+
+
+bool
+ChangeParametersPanel::NeedsEditor() const
+{
+       return !fSupportsName && !fSupportsType;
+}
+
+
+bool
+ChangeParametersPanel::ValidWithoutEditor() const
+{
+       return !NeedsEditor();
+}
+
+
+status_t
+ChangeParametersPanel::ParametersReceived(const BString& parameters,
+       BMessage& storage)
+{
+       // get name
+       status_t status = storage.SetString("name", fNameTextControl->Text());
+
+       // get type
+       if (BMenuItem* item = fTypeMenuField->Menu()->FindMarked()) {
+               const char* type;
+               BMessage* message = item->Message();
+               if (!message || message->FindString("type", &type) != B_OK)
+                       type = kPartitionTypeBFS;
+
+               if (status == B_OK)
+                       status = storage.SetString("type", type);
+       }
+
+       return status;
+}
+
+
+void
+ChangeParametersPanel::AddControls(BLayoutBuilder::Group<>& builder,
+       BView* editorView)
+{
+       if (fSupportsName || fSupportsType) {
+               BLayoutBuilder::Group<>::GridBuilder gridBuilder
+                       = builder.AddGrid(0.0, B_USE_DEFAULT_SPACING);
+
+               if (fSupportsName) {
+                       
gridBuilder.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
+                               
.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0);
+               }
+               if (fSupportsType) {
+                       
gridBuilder.Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1)
+                               .Add(fTypeMenuField->CreateMenuBarLayoutItem(), 
1, 1);
+               }
+       }
+
+       if (editorView != NULL)
+               builder.Add(editorView);
+}
diff --git a/src/apps/drivesetup/ChangeParametersPanel.h 
b/src/apps/drivesetup/ChangeParametersPanel.h
new file mode 100644
index 0000000..54e96c5
--- /dev/null
+++ b/src/apps/drivesetup/ChangeParametersPanel.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2008-2013 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT license.
+ *
+ * Authors:
+ *             Stephan Aßmus <superstippi@xxxxxx>
+ *             Axel Dörfler, axeld@xxxxxxxxxxxxxxxx.
+ *             Bryce Groff       <bgroff@xxxxxxxxxx>
+ */
+#ifndef CHANGE_PARAMS_PANEL_H
+#define CHANGE_PARAMS_PANEL_H
+
+
+#include "AbstractParametersPanel.h"
+
+
+class BMenuField;
+class BPopUpMenu;
+class BTextControl;
+
+
+class ChangeParametersPanel : public AbstractParametersPanel {
+public:
+                                                               
ChangeParametersPanel(BWindow* window,
+                                                                       
BPartition* parent);
+       virtual                                         
~ChangeParametersPanel();
+
+                       status_t                        Go(BString& name, 
BString& type,
+                                                                       
BString& parameters);
+
+       virtual void                            MessageReceived(BMessage* 
message);
+
+protected:
+                                                               
ChangeParametersPanel(BWindow* window);
+
+                       status_t                        Go(BString& name, 
BString& type,
+                                                                       
BString& parameters, BMessage& storage);
+                       void                            
CreateChangeControls(BPartition* parent);
+
+       virtual bool                            NeedsEditor() const;
+       virtual bool                            ValidWithoutEditor() const;
+       virtual status_t                        ParametersReceived(const 
BString& parameters,
+                                                                       
BMessage& storage);
+       virtual void                            
AddControls(BLayoutBuilder::Group<>& builder,
+                                                                       BView* 
editorView);
+
+protected:
+                       BPopUpMenu*                     fTypePopUpMenu;
+                       BMenuField*                     fTypeMenuField;
+                       BTextControl*           fNameTextControl;
+                       bool                            fSupportsName;
+                       bool                            fSupportsType;
+};
+
+
+#endif // CHANGE_PARAMS_PANEL_H
diff --git a/src/apps/drivesetup/CreateParametersPanel.cpp 
b/src/apps/drivesetup/CreateParametersPanel.cpp
index 145809c..8f3252b 100644
--- a/src/apps/drivesetup/CreateParametersPanel.cpp
+++ b/src/apps/drivesetup/CreateParametersPanel.cpp
@@ -43,9 +43,9 @@ static const uint32 kMegaByte = 0x100000;
 CreateParametersPanel::CreateParametersPanel(BWindow* window,
        BPartition* partition, off_t offset, off_t size)
        :
-       AbstractParametersPanel(window)
+       ChangeParametersPanel(window)
 {
-       _CreateViewControls(partition, offset, size);
+       _CreateCreateControls(partition, offset, size);
 
        Init(B_CREATE_PARAMETER_EDITOR, "", partition);
 }
@@ -64,7 +64,8 @@ CreateParametersPanel::Go(off_t& offset, off_t& size, 
BString& name,
        // a BMessage
 
        BMessage storage;
-       status_t status = AbstractParametersPanel::Go(parameters, storage);
+       status_t status = ChangeParametersPanel::Go(name, type, parameters,
+               storage);
        if (status != B_OK)
                return status;
 
@@ -72,12 +73,6 @@ CreateParametersPanel::Go(off_t& offset, off_t& size, 
BString& name,
        size = storage.GetInt64("size", 0);
        offset = storage.GetInt64("offset", 0);
 
-       // get name
-       name.SetTo(storage.GetString("name", NULL));
-
-       // get type
-       type.SetTo(storage.GetString("type", NULL));
-
        return B_OK;
 }
 
@@ -86,14 +81,6 @@ void
 CreateParametersPanel::MessageReceived(BMessage* message)
 {
        switch (message->what) {
-               case MSG_PARTITION_TYPE:
-                       if (fEditor != NULL) {
-                               const char* type;
-                               if (message->FindString("type", &type) == B_OK)
-                                       fEditor->ParameterChanged("type", 
BVariant(type));
-                       }
-                       break;
-
                case MSG_SIZE_SLIDER:
                        _UpdateSizeTextControl();
                        break;
@@ -109,7 +96,7 @@ CreateParametersPanel::MessageReceived(BMessage* message)
                }
 
                default:
-                       AbstractParametersPanel::MessageReceived(message);
+                       ChangeParametersPanel::MessageReceived(message);
        }
 }
 
@@ -130,22 +117,10 @@ CreateParametersPanel::ParametersReceived(const BString& 
parameters,
        if (status == B_OK)
                status = storage.SetInt64("offset", fSizeSlider->Offset());
 
-       // get name
-       if (status == B_OK)
-               status = storage.SetString("name", fNameTextControl->Text());
-
-       // get type
-       if (BMenuItem* item = fTypeMenuField->Menu()->FindMarked()) {
-               const char* type;
-               BMessage* message = item->Message();
-               if (!message || message->FindString("type", &type) != B_OK)
-                       type = kPartitionTypeBFS;
-
-               if (status == B_OK)
-                       status = storage.SetString("type", type);
-       }
+       if (status != B_OK)
+               return status;
 
-       return status;
+       return ChangeParametersPanel::ParametersReceived(parameters, storage);
 }
 
 
@@ -157,27 +132,12 @@ 
CreateParametersPanel::AddControls(BLayoutBuilder::Group<>& builder,
                .Add(fSizeSlider)
                .Add(fSizeTextControl);
 
-       if (fSupportsName || fSupportsType) {
-               BLayoutBuilder::Group<>::GridBuilder gridBuilder
-                       = builder.AddGrid(0.0, B_USE_DEFAULT_SPACING);
-
-               if (fSupportsName) {
-                       
gridBuilder.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
-                               
.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0);
-               }
-               if (fSupportsType) {
-                       
gridBuilder.Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1)
-                               .Add(fTypeMenuField->CreateMenuBarLayoutItem(), 
1, 1);
-               }
-       }
-
-       if (editorView != NULL)
-               builder.Add(editorView);
+       ChangeParametersPanel::AddControls(builder, editorView);
 }
 
 
 void
-CreateParametersPanel::_CreateViewControls(BPartition* parent, off_t offset,
+CreateParametersPanel::_CreateCreateControls(BPartition* parent, off_t offset,
        off_t size)
 {
        // Setup the controls
@@ -197,27 +157,7 @@ CreateParametersPanel::_CreateViewControls(BPartition* 
parent, off_t offset,
        fSizeTextControl->SetModificationMessage(
                new BMessage(MSG_SIZE_TEXTCONTROL));
 
-       fNameTextControl = new BTextControl("Name Control",
-               B_TRANSLATE("Partition name:"), "", NULL);
-       fSupportsName = parent->SupportsChildName();
-
-       fTypePopUpMenu = new BPopUpMenu("Partition Type");
-
-       int32 cookie = 0;
-       BString supportedType;
-       while (parent->GetNextSupportedChildType(&cookie, &supportedType) == 
B_OK) {
-               BMessage* message = new BMessage(MSG_PARTITION_TYPE);
-               message->AddString("type", supportedType);
-               BMenuItem* item = new BMenuItem(supportedType, message);
-               fTypePopUpMenu->AddItem(item);
-
-               if (strcmp(supportedType, kPartitionTypeBFS) == 0)
-                       item->SetMarked(true);
-       }
-
-       fTypeMenuField = new BMenuField(B_TRANSLATE("Partition type:"),
-               fTypePopUpMenu);
-       fSupportsType = fTypePopUpMenu->CountItems() != 0;
+       CreateChangeControls(parent);
 
        fOkButton->SetLabel(B_TRANSLATE("Create"));
 }
diff --git a/src/apps/drivesetup/CreateParametersPanel.h 
b/src/apps/drivesetup/CreateParametersPanel.h
index 3ae1ca7..9d86451 100644
--- a/src/apps/drivesetup/CreateParametersPanel.h
+++ b/src/apps/drivesetup/CreateParametersPanel.h
@@ -11,16 +11,13 @@
 #define CREATE_PARAMS_PANEL_H
 
 
-#include "AbstractParametersPanel.h"
+#include "ChangeParametersPanel.h"
 
 
-class BMenuField;
-class BPopUpMenu;
-class BTextControl;
 class SizeSlider;
 
 
-class CreateParametersPanel : public AbstractParametersPanel {
+class CreateParametersPanel : public ChangeParametersPanel {
 public:
                                                                
CreateParametersPanel(BWindow* window,
                                                                        
BPartition* parent, off_t offset,
@@ -40,19 +37,14 @@ protected:
                                                                        BView* 
editorView);
 
 private:
-                       void                            
_CreateViewControls(BPartition* parent,
+                       void                            
_CreateCreateControls(BPartition* parent,
                                                                        off_t 
offset, off_t size);
 
                        void                            
_UpdateSizeTextControl();
 
 private:
-                       BPopUpMenu*                     fTypePopUpMenu;
-                       BMenuField*                     fTypeMenuField;
-                       BTextControl*           fNameTextControl;
                        SizeSlider*                     fSizeSlider;
                        BTextControl*           fSizeTextControl;
-                       bool                            fSupportsName;
-                       bool                            fSupportsType;
 };
 
 
diff --git a/src/apps/drivesetup/Jamfile b/src/apps/drivesetup/Jamfile
index b2884801..7f82eb1 100644
--- a/src/apps/drivesetup/Jamfile
+++ b/src/apps/drivesetup/Jamfile
@@ -6,6 +6,7 @@ UsePrivateHeaders interface shared storage tracker ;
 
 Preference DriveSetup :
        AbstractParametersPanel.cpp
+       ChangeParametersPanel.cpp
        CreateParametersPanel.cpp
        DiskView.cpp
        DriveSetup.cpp
@@ -23,6 +24,7 @@ DoCatalogs DriveSetup :
        x-vnd.Haiku-DriveSetup
        :
        AbstractParametersPanel.cpp
+       ChangeParametersPanel.cpp
        CreateParametersPanel.cpp
        DiskView.cpp
        InitParametersPanel.cpp
diff --git a/src/apps/drivesetup/MainWindow.cpp 
b/src/apps/drivesetup/MainWindow.cpp
index 346a885..30b6c8f 100644
--- a/src/apps/drivesetup/MainWindow.cpp
+++ b/src/apps/drivesetup/MainWindow.cpp
@@ -40,6 +40,7 @@
 
 #include <tracker_private.h>
 
+#include "ChangeParametersPanel.h"
 #include "CreateParametersPanel.h"
 #include "DiskView.h"
 #include "InitParametersPanel.h"
@@ -51,6 +52,23 @@
 #define B_TRANSLATION_CONTEXT "MainWindow"
 
 
+enum {
+       MSG_MOUNT_ALL                           = 'mnta',
+       MSG_MOUNT                                       = 'mnts',
+       MSG_UNMOUNT                                     = 'unmt',
+       MSG_FORMAT                                      = 'frmt',
+       MSG_CREATE                                      = 'crtp',
+       MSG_CHANGE                                      = 'chgp',
+       MSG_INITIALIZE                          = 'init',
+       MSG_DELETE                                      = 'delt',
+       MSG_EJECT                                       = 'ejct',
+       MSG_SURFACE_TEST                        = 'sfct',
+       MSG_RESCAN                                      = 'rscn',
+
+       MSG_PARTITION_ROW_SELECTED      = 'prsl',
+};
+
+
 class ListPopulatorVisitor : public BDiskDeviceVisitor {
 public:
        ListPopulatorVisitor(PartitionListView* list, int32& diskCount,
@@ -96,8 +114,8 @@ private:
 
                // add any available space on it
                BPartitioningInfo info;
-               status_t ret = partition->GetPartitioningInfo(&info);
-               if (ret >= B_OK) {
+               status_t status = partition->GetPartitioningInfo(&info);
+               if (status >= B_OK) {
                        partition_id parentID = partition->ID();
                        off_t offset;
                        off_t size;
@@ -162,11 +180,11 @@ public:
        }
        status_t CommitModifications()
        {
-               status_t ret = fDisk->CommitModifications();
-               if (ret == B_OK)
+               status_t status = fDisk->CommitModifications();
+               if (status == B_OK)
                        fModificationStatus = B_ERROR;
 
-               return ret;
+               return status;
        }
 
 private:
@@ -175,22 +193,6 @@ private:
 };
 
 
-enum {
-       MSG_MOUNT_ALL                           = 'mnta',
-       MSG_MOUNT                                       = 'mnts',
-       MSG_UNMOUNT                                     = 'unmt',
-       MSG_FORMAT                                      = 'frmt',
-       MSG_CREATE                                      = 'crtp',
-       MSG_INITIALIZE                          = 'init',
-       MSG_DELETE                                      = 'delt',
-       MSG_EJECT                                       = 'ejct',
-       MSG_SURFACE_TEST                        = 'sfct',
-       MSG_RESCAN                                      = 'rscn',
-
-       MSG_PARTITION_ROW_SELECTED      = 'prsl',
-};
-
-
 // #pragma mark -
 
 
@@ -217,6 +219,9 @@ MainWindow::MainWindow()
 
        fCreateMenuItem = new BMenuItem(B_TRANSLATE("Create" B_UTF8_ELLIPSIS),
                new BMessage(MSG_CREATE), 'C');
+       fChangeMenuItem = new BMenuItem(
+               B_TRANSLATE("Change parameters" B_UTF8_ELLIPSIS),
+               new BMessage(MSG_CHANGE));
        fDeleteMenuItem = new BMenuItem(B_TRANSLATE("Delete"),
                new BMessage(MSG_DELETE), 'D');
 
@@ -249,6 +254,7 @@ MainWindow::MainWindow()
        fFormatMenu = new BMenu(B_TRANSLATE("Format"));
        fPartitionMenu->AddItem(fFormatMenu);
 
+       fPartitionMenu->AddItem(fChangeMenuItem);
        fPartitionMenu->AddItem(fDeleteMenuItem);
 
        fPartitionMenu->AddSeparatorItem();
@@ -284,10 +290,10 @@ MainWindow::MainWindow()
        fListView->SetTarget(this);
        fListView->MakeFocus(true);
 
-       status_t ret = fDDRoster.StartWatching(BMessenger(this));
-       if (ret != B_OK) {
+       status_t status = fDiskDeviceRoster.StartWatching(BMessenger(this));
+       if (status != B_OK) {
                fprintf(stderr, "Failed to start watching for device changes: 
%s\n",
-                       strerror(ret));
+                       strerror(status));
        }
 
        // visit all disks in the system and show their contents
@@ -323,10 +329,9 @@ MainWindow::MessageReceived(BMessage* message)
                        printf("MSG_FORMAT\n");
                        break;
 
-               case MSG_CREATE: {
+               case MSG_CREATE:
                        _Create(fCurrentDisk, fCurrentPartitionID);
                        break;
-               }
 
                case MSG_INITIALIZE: {
                        BString diskSystemName;
@@ -336,6 +341,10 @@ MainWindow::MessageReceived(BMessage* message)
                        break;
                }
 
+               case MSG_CHANGE:
+                       _ChangeParameters(fCurrentDisk, fCurrentPartitionID);
+                       break;
+
                case MSG_DELETE:
                        _Delete(fCurrentDisk, fCurrentPartitionID);
                        break;
@@ -476,7 +485,7 @@ MainWindow::_ScanDrives()
        fSpaceIDMap.Clear();
        int32 diskCount = 0;
        ListPopulatorVisitor driveVisitor(fListView, diskCount, fSpaceIDMap);
-       fDDRoster.VisitEachPartition(&driveVisitor);
+       fDiskDeviceRoster.VisitEachPartition(&driveVisitor);
        fDiskView->SetDiskCount(diskCount);
 
        // restore selection
@@ -541,9 +550,9 @@ MainWindow::_SetToDiskAndPartition(partition_id disk, 
partition_id partition,
                fCurrentDisk = NULL;
                if (disk >= 0) {
                        BDiskDevice* newDisk = new BDiskDevice();
-                       status_t ret = newDisk->SetTo(disk);
-                       if (ret < B_OK) {
-                               printf("error switching disks: %s\n", 
strerror(ret));
+                       status_t status = newDisk->SetTo(disk);
+                       if (status != B_OK) {
+                               printf("error switching disks: %s\n", 
strerror(status));
                                delete newDisk;
                        } else
                                fCurrentDisk = newDisk;
@@ -597,12 +606,13 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
                bool prepared = disk->PrepareModifications() == B_OK;
                fFormatMenu->SetEnabled(prepared);
                fDeleteMenuItem->SetEnabled(prepared);
+               fChangeMenuItem->SetEnabled(prepared);
 
                BPartition* partition = disk->FindDescendant(selectedPartition);
 
                BDiskSystem diskSystem;
-               fDDRoster.RewindDiskSystems();
-               while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
+               fDiskDeviceRoster.RewindDiskSystems();
+               while (fDiskDeviceRoster.GetNextDiskSystem(&diskSystem) == 
B_OK) {
                        if (!diskSystem.SupportsInitializing())
                                continue;
 
@@ -630,18 +640,20 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
 
                // Mount items
                if (partition != NULL) {
-                       fFormatMenu->SetEnabled(!partition->IsMounted()
+                       bool notMountedAndWritable = !partition->IsMounted()
                                && !partition->IsReadOnly()
-                               && partition->Device()->HasMedia()
+                               && partition->Device()->HasMedia();
+
+                       fFormatMenu->SetEnabled(notMountedAndWritable
                                && fFormatMenu->CountItems() > 0);
 
-                       fDiskInitMenu->SetEnabled(!partition->IsMounted()
-                               && !partition->IsReadOnly()
-                               && partition->Device()->HasMedia()
+                       fDiskInitMenu->SetEnabled(notMountedAndWritable
                                && partition->IsDevice()
                                && fDiskInitMenu->CountItems() > 0);
 
-                       fDeleteMenuItem->SetEnabled(!partition->IsMounted()
+                       fChangeMenuItem->SetEnabled(notMountedAndWritable);
+
+                       fDeleteMenuItem->SetEnabled(notMountedAndWritable
                                && !partition->IsDevice());
 
                        fMountMenuItem->SetEnabled(!partition->IsMounted());
@@ -660,6 +672,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
                        fUnmountMenuItem->SetEnabled(unMountable);
                } else {
                        fDeleteMenuItem->SetEnabled(false);
+                       fChangeMenuItem->SetEnabled(false);
                        fMountMenuItem->SetEnabled(false);
                        fFormatMenu->SetEnabled(false);
                        fDiskInitMenu->SetEnabled(false);
@@ -672,6 +685,7 @@ MainWindow::_UpdateMenus(BDiskDevice* disk,
        }
        if (selectedPartition < 0) {
                fDeleteMenuItem->SetEnabled(false);
+               fChangeMenuItem->SetEnabled(false);
                fMountMenuItem->SetEnabled(false);
        }
 }
@@ -727,10 +741,10 @@ MainWindow::_Mount(BDiskDevice* disk, partition_id 
selectedPartition)
        }
 
        if (!partition->IsMounted()) {
-               status_t ret = partition->Mount();
-               if (ret < B_OK) {
-                       _DisplayPartitionError(
-                               B_TRANSLATE("Could not mount partition %s."), 
partition, ret);
+               status_t status = partition->Mount();
+               if (status != B_OK) {
+                       _DisplayPartitionError(B_TRANSLATE("Could not mount 
partition %s."),
+                               partition, status);
                } else {
                        // successful mount, adapt to the changes
                        _ScanDrives();
@@ -761,11 +775,11 @@ MainWindow::_Unmount(BDiskDevice* disk, partition_id 
selectedPartition)
        if (partition->IsMounted()) {
                BPath path;
                partition->GetMountPoint(&path);
-               status_t ret = partition->Unmount();
-               if (ret < B_OK) {
+               status_t status = partition->Unmount();
+               if (status != B_OK) {
                        _DisplayPartitionError(
                                B_TRANSLATE("Could not unmount partition %s."),
-                               partition, ret);
+                               partition, status);
                } else {
                        if (dev_for_path(path.Path()) == dev_for_path("/"))
                                rmdir(path.Path());
@@ -784,7 +798,7 @@ void
 MainWindow::_MountAll()
 {
        MountAllVisitor visitor;
-       fDDRoster.VisitEachPartition(&visitor);
+       fDiskDeviceRoster.VisitEachPartition(&visitor);
 }
 
 
@@ -821,9 +835,9 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
        }
 
        BDiskSystem diskSystem;
-       fDDRoster.RewindDiskSystems();
+       fDiskDeviceRoster.RewindDiskSystems();
        bool found = false;
-       while (fDDRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
+       while (fDiskDeviceRoster.GetNextDiskSystem(&diskSystem) == B_OK) {
                if (diskSystem.SupportsInitializing()) {
                        if (diskSystemName == diskSystem.PrettyName()) {
                                found = true;
@@ -874,10 +888,10 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
                return;
 
        ModificationPreparer modificationPreparer(disk);
-       status_t ret = modificationPreparer.ModificationStatus();
-       if (ret != B_OK) {
+       status_t status = modificationPreparer.ModificationStatus();
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("There was an error 
preparing the "
-                       "disk for modifications."), NULL, ret);
+                       "disk for modifications."), NULL, status);
                return;
        }
 
@@ -890,21 +904,22 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
 
        bool supportsName = diskSystem.SupportsContentName();
        BString validatedName(name);
-       ret = partition->ValidateInitialize(diskSystem.PrettyName(),
+       status = partition->ValidateInitialize(diskSystem.PrettyName(),
                supportsName ? &validatedName : NULL, parameters.String());
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Validation of the given "
-                       "initialization parameters failed."), partition, ret);
+                       "initialization parameters failed."), partition, 
status);
                return;
        }
 
        BString previousName = partition->ContentName();
 
-       ret = partition->Initialize(diskSystem.PrettyName(),
+       status = partition->Initialize(diskSystem.PrettyName(),
                supportsName ? validatedName.String() : NULL, 
parameters.String());
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Initialization of the 
partition "
-                       "%s failed. (Nothing has been written to disk.)"), 
partition, ret);
+                       "%s failed. (Nothing has been written to disk.)"), 
partition,
+                       status);
                return;
        }
 
@@ -947,13 +962,13 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
                return;
 
        // commit
-       ret = modificationPreparer.CommitModifications();
+       status = modificationPreparer.CommitModifications();
 
        // The partition pointer is toast now! Use the partition ID to
        // retrieve it again.
        partition = disk->FindDescendant(selectedPartition);
 
-       if (ret == B_OK) {
+       if (status == B_OK) {
                if (diskSystem.IsFileSystem()) {
                        _DisplayPartitionError(B_TRANSLATE("The partition %s 
has been "
                                "successfully formatted.\n"), partition);
@@ -964,10 +979,10 @@ MainWindow::_Initialize(BDiskDevice* disk, partition_id 
selectedPartition,
        } else {
                if (diskSystem.IsFileSystem()) {
                        _DisplayPartitionError(B_TRANSLATE("Failed to format 
the "
-                               "partition %s!\n"), partition, ret);
+                               "partition %s!\n"), partition, status);
                } else {
                        _DisplayPartitionError(B_TRANSLATE("Failed to 
initialize the "
-                               "disk %s!\n"), partition, ret);
+                               "disk %s!\n"), partition, status);
                }
        }
 
@@ -1011,10 +1026,10 @@ MainWindow::_Create(BDiskDevice* disk, partition_id 
selectedPartition)
        }
 
        ModificationPreparer modificationPreparer(disk);
-       status_t ret = modificationPreparer.ModificationStatus();
-       if (ret != B_OK) {
+       status_t status = modificationPreparer.ModificationStatus();
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("There was an error 
preparing the "
-                       "disk for modifications."), NULL, ret);
+                       "disk for modifications."), NULL, status);
                return;
        }
 
@@ -1040,15 +1055,21 @@ MainWindow::_Create(BDiskDevice* disk, partition_id 
selectedPartition)
 
        CreateParametersPanel* panel = new CreateParametersPanel(this, parent,
                offset, size);
-       if (panel->Go(offset, size, name, type, parameters) != B_OK)
+       status = panel->Go(offset, size, name, type, parameters);
+       if (status != B_OK) {
+               if (status != B_CANCELED) {
+                       _DisplayPartitionError(B_TRANSLATE("The panel could not 
return "
+                               "successfully."), NULL, status);
+               }
                return;
+       }
 
-       ret = parent->ValidateCreateChild(&offset, &size, type.String(),
+       status = parent->ValidateCreateChild(&offset, &size, type.String(),
                &name, parameters.String());
 
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Validation of the given 
creation "
-                       "parameters failed."));
+                       "parameters failed."), NULL, status);
                return;
        }
 
@@ -1064,27 +1085,27 @@ MainWindow::_Create(BDiskDevice* disk, partition_id 
selectedPartition)
        if (choice == 1)
                return;
 
-       ret = parent->CreateChild(offset, size, type.String(),
-               name.String(), parameters.String());
+       status = parent->CreateChild(offset, size, type.String(), name.String(),
+               parameters.String());
 
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Creation of the partition 
has "
-                       "failed."), NULL, ret);
+                       "failed."), NULL, status);
                return;
        }
 
        // commit
-       ret = modificationPreparer.CommitModifications();
+       status = modificationPreparer.CommitModifications();
 
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Failed to format the "
-                       "partition. No changes have been written to disk."), 
NULL, ret);
+                       "partition. No changes have been written to disk."), 
NULL, status);
                return;
        }
 
        // The disk layout has changed, update disk information
        bool updated;
-       ret = disk->Update(&updated);
+       status = disk->Update(&updated);
 
        _ScanDrives();
        fDiskView->ForceUpdate();
@@ -1120,10 +1141,10 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id 
selectedPartition)
        }
 
        ModificationPreparer modificationPreparer(disk);
-       status_t ret = modificationPreparer.ModificationStatus();
-       if (ret != B_OK) {
+       status_t status = modificationPreparer.ModificationStatus();
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("There was an error 
preparing the "
-                       "disk for modifications."), NULL, ret);
+                       "disk for modifications."), NULL, status);
                return;
        }
 
@@ -1145,18 +1166,112 @@ MainWindow::_Delete(BDiskDevice* disk, partition_id 
selectedPartition)
        if (choice == 1)
                return;
 
-       ret = parent->DeleteChild(partition->Index());
-       if (ret != B_OK) {
-               _DisplayPartitionError(
-                       B_TRANSLATE("Could not delete the selected 
partition."), NULL, ret);
+       status = parent->DeleteChild(partition->Index());
+       if (status != B_OK) {
+               _DisplayPartitionError(B_TRANSLATE("Could not delete the 
selected "
+                       "partition."), NULL, status);
                return;
        }
 
-       ret = modificationPreparer.CommitModifications();
+       status = modificationPreparer.CommitModifications();
 
-       if (ret != B_OK) {
+       if (status != B_OK) {
                _DisplayPartitionError(B_TRANSLATE("Failed to delete the 
partition. "
-                       "No changes have been written to disk."), NULL, ret);
+                       "No changes have been written to disk."), NULL, status);
+               return;
+       }
+
+       _ScanDrives();
+       fDiskView->ForceUpdate();
+}
+
+
+void
+MainWindow::_ChangeParameters(BDiskDevice* disk, partition_id 
selectedPartition)
+{
+       if (disk == NULL || selectedPartition < 0) {
+               _DisplayPartitionError(B_TRANSLATE("You need to select a 
partition "
+                       "entry from the list."));
+               return;
+       }
+
+       if (disk->IsReadOnly()) {
+               _DisplayPartitionError(B_TRANSLATE("The selected disk is 
read-only."));
+               return;
+       }
+
+       BPartition* partition = disk->FindDescendant(selectedPartition);
+       if (partition == NULL) {
+               _DisplayPartitionError(B_TRANSLATE("Unable to find the selected 
"
+                       "partition by ID."));
+               return;
+       }
+
+       ModificationPreparer modificationPreparer(disk);
+       status_t status = modificationPreparer.ModificationStatus();
+       if (status != B_OK) {
+               _DisplayPartitionError(B_TRANSLATE("There was an error 
preparing the "
+                       "disk for modifications."), NULL, status);
+               return;
+       }
+
+       ChangeParametersPanel* panel = new ChangeParametersPanel(this, 
partition);
+
+       BString name, type, parameters;
+       status = panel->Go(name, type, parameters);
+       if (status != B_OK) {
+               if (status != B_CANCELED) {
+                       _DisplayPartitionError(B_TRANSLATE("The panel 
experienced a "
+                               "problem!"), NULL, status);
+               }
+               // TODO: disk systems without an editor and support for 
name/type
+               // changing will return B_CANCELED here -- we need to check this
+               // before, and disable the menu entry instead
+               return;
+       }
+
+       if (partition->CanSetType())
+               status = partition->ValidateSetType(type.String());
+       if (status == B_OK && partition->CanSetName())
+               status = partition->ValidateSetName(&name);
+       if (status != B_OK) {
+               _DisplayPartitionError(B_TRANSLATE("Validation of the given 
parameters "
+                       "failed."));
+               return;
+       }
+
+       // Warn the user one more time...
+       BAlert* alert = new BAlert("final notice", B_TRANSLATE("Are you sure 
you "
+               "want to change parameters of the selected partition?\n\n"
+               "The partition may no longer be recognized by other operating 
systems "
+               "anymore!"), B_TRANSLATE("Change parameters"), 
B_TRANSLATE("Cancel"),
+               NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT);
+       alert->SetShortcut(1, B_ESCAPE);
+       int32 choice = alert->Go();
+
+       if (choice == 1)
+               return;
+
+       if (partition->CanSetType())
+               status = partition->SetType(type.String());
+       if (status == B_OK && partition->CanSetName())
+               status = partition->SetName(name.String());
+       if (status == B_OK && partition->CanEditParameters())
+               status = partition->SetParameters(parameters.String());
+
+       if (status != B_OK) {
+               _DisplayPartitionError(
+                       B_TRANSLATE("Could not change the parameters of the 
selected "
+                               "partition."), NULL, status);
+               return;
+       }
+
+       status = modificationPreparer.CommitModifications();
+
+       if (status != B_OK) {
+               _DisplayPartitionError(B_TRANSLATE("Failed to change the 
parameters "
+                       "of the partition. No changes have been written to 
disk."), NULL,
+                       status);
                return;
        }
 
diff --git a/src/apps/drivesetup/MainWindow.h b/src/apps/drivesetup/MainWindow.h
index 26c7df4..dbf3f59 100644
--- a/src/apps/drivesetup/MainWindow.h
+++ b/src/apps/drivesetup/MainWindow.h
@@ -71,9 +71,11 @@ private:
                                                                        
partition_id selectedPartition);
                        void                            _Delete(BDiskDevice* 
disk,
                                                                        
partition_id selectedPartition);
+                       void                            
_ChangeParameters(BDiskDevice* disk,
+                                                                       
partition_id selectedPartition);
 
-
-                       BDiskDeviceRoster       fDDRoster;
+private:
+                       BDiskDeviceRoster       fDiskDeviceRoster;
                        BDiskDevice*            fCurrentDisk;
                        partition_id            fCurrentPartitionID;
 
@@ -94,6 +96,7 @@ private:
                        BMenuItem*                      fRescanMenuItem;
 
                        BMenuItem*                      fCreateMenuItem;
+                       BMenuItem*                      fChangeMenuItem;
                        BMenuItem*                      fDeleteMenuItem;
                        BMenuItem*                      fMountMenuItem;
                        BMenuItem*                      fUnmountMenuItem;


Other related posts:

  • » [haiku-commits] haiku: hrev45277 - in src: apps/drivesetup kits/storage/disk_device add-ons/disk_systems - axeld