Changeset 14698 in vbox for trunk/src/VBox
- Timestamp:
- Nov 27, 2008 12:04:44 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDisk2Impl.cpp
r14697 r14698 626 626 CheckComRCReturnRC (rc); 627 627 628 /* properties (note: after setting the format as it populates the map) */ 629 Key::List properties = aNode.keys ("Property"); 630 for (Key::List::const_iterator it = properties.begin(); 631 it != properties.end(); ++ it) 632 { 633 mm.properties [Bstr (it->stringValue ("name"))] = 634 Bstr (it->stringValue ("value")); 635 } 636 628 637 /* required */ 629 638 Bstr location = aNode.stringValue ("location"); … … 947 956 CheckComArgStrNotEmptyOrNull (aName); 948 957 949 AutoWriteLock alock (this); 958 /* VirtualBox::saveSettings() needs a write lock */ 959 AutoMultiWriteLock2 alock (mVirtualBox, this); 960 961 switch (m.state) 962 { 963 case MediaState_Created: 964 case MediaState_Inaccessible: 965 break; 966 default: 967 return setStateError(); 968 } 950 969 951 970 Data::PropertyMap::iterator it = mm.properties.find (Bstr (aName)); … … 956 975 it->second = aValue; 957 976 958 return S_OK; 977 HRESULT rc = mVirtualBox->saveSettings(); 978 979 return rc; 959 980 } 960 981 … … 970 991 971 992 AutoReadLock alock (this); 993 994 /// @todo make use of aNames according to the documentation 995 NOREF (aNames); 972 996 973 997 com::SafeArray <BSTR> names (mm.properties.size()); … … 1339 1363 Key descNode = diskNode.createKey ("Description"); 1340 1364 descNode.setKeyValue <Bstr> (m.description); 1365 } 1366 1367 /* optional properties */ 1368 for (Data::PropertyMap::const_iterator it = mm.properties.begin(); 1369 it != mm.properties.end(); ++ it) 1370 { 1371 /* only save properties that have non-default values */ 1372 if (!it->second.isNull()) 1373 { 1374 Key propNode = diskNode.appendKey ("Property"); 1375 propNode.setValue <Bstr> ("name", it->first); 1376 propNode.setValue <Bstr> ("value", it->second); 1377 } 1341 1378 } 1342 1379 … … 2330 2367 E_FAIL); 2331 2368 2332 /* are we dealing with a hard disk opened from the existing path? */2369 /* are we dealing with a hard disk just opened from the existing path? */ 2333 2370 bool isNew = mm.format.isNull(); 2334 2371 … … 2479 2516 * properties is meant to be constant. */ 2480 2517 2481 mm.properties.clear();2518 Assert (mm.properties.empty()); 2482 2519 2483 2520 for (HardDiskFormat::PropertyList::const_iterator it = -
trunk/src/VBox/Main/testcase/tstAPI.cpp
r14596 r14698 641 641 printf (" <none>\n"); 642 642 643 Bstr name ("TargetAddress"); 644 Bstr value = Utf8StrFmt ("lalala (%llu)", RTTimeMilliTS()); 645 646 printf ("Settings property %ls to %ls...\n", name.raw(), value.raw()); 647 CHECK_ERROR (hd, SetProperty (name, value)); 643 648 } 644 649 else -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r14437 r14698 261 261 <xsd:sequence> 262 262 <xsd:element name="Description" type="xsd:string" minOccurs="0"/> 263 <xsd:element name="Property" minOccurs="0" maxOccurs="unbounded"> 264 <xsd:complexType> 265 <xsd:attribute name="name" type="xsd:token" use="required"/> 266 <xsd:attribute name="value" type="xsd:string" use="required"/> 267 </xsd:complexType> 268 </xsd:element> 263 269 <xsd:element name="HardDisk" type="TDiffHardDisk2" minOccurs="0" maxOccurs="unbounded"/> 264 270 </xsd:sequence>
Note:
See TracChangeset
for help on using the changeset viewer.