xref: /haiku/src/apps/drivesetup/InitParametersPanel.cpp (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 /*
2  * Copyright 2008-2013 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  *		Axel Dörfler, axeld@pinc-software.de.
8  *		Karsten Heimrich. <host.haiku@gmx.de>
9  */
10 
11 
12 #include "InitParametersPanel.h"
13 
14 #include <driver_settings.h>
15 #include <stdio.h>
16 
17 #include <Button.h>
18 #include <Catalog.h>
19 
20 
21 #undef B_TRANSLATION_CONTEXT
22 #define B_TRANSLATION_CONTEXT "InitializeParametersPanel"
23 
24 
25 InitParametersPanel::InitParametersPanel(BWindow* window,
26 	const BString& diskSystem, BPartition* partition)
27 	:
28 	AbstractParametersPanel(window)
29 {
30 	Init(B_INITIALIZE_PARAMETER_EDITOR, diskSystem, partition);
31 
32 	fOkButton->SetLabel(B_TRANSLATE("Format"));
33 }
34 
35 
36 InitParametersPanel::~InitParametersPanel()
37 {
38 }
39 
40 
41 status_t
42 InitParametersPanel::Go(BString& name, BString& parameters)
43 {
44 	status_t status = AbstractParametersPanel::Go(parameters);
45 	if (status == B_OK) {
46 		void* handle = parse_driver_settings_string(parameters.String());
47 		if (handle != NULL) {
48 			const char* string = get_driver_parameter(handle, "name",
49 				NULL, NULL);
50 			name.SetTo(string);
51 			unload_driver_settings(handle);
52 		}
53 	}
54 
55 	return status;
56 }
57