Index: trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.h =================================================================== --- trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.h (revision 382) +++ trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.h (revision 383) @@ -142,35 +142,5 @@ static BootProp* _instance; }; -//-------------------------------------------------------------------------- -class PrefsProp : public ChameleonPropertyList { -public: - static PrefsProp& instance() - { - return _instance ? *_instance : *(_instance=new PrefsProp()); - } - -protected: - PrefsProp() : ChameleonPropertyList() {} - -private: - static PrefsProp* _instance; -}; -//-------------------------------------------------------------------------- -class SmbiosProp : public ChameleonPropertyList { -public: - static SmbiosProp& instance() - { - return _instance ? *_instance : *(_instance=new SmbiosProp()); - } - -protected: - SmbiosProp() : ChameleonPropertyList() {} - -private: - static SmbiosProp* _instance; -}; - - #endif \ No newline at end of file Index: trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm (revision 382) +++ trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm (revision 383) @@ -158,9 +158,6 @@ //-------------------------------------------------------------------------- - (void) loadPreferences { -// PrefsProp::instance().open([kPreferencesFilePath UTF8String], CreateIfNotExist, -// [self auth]); - // test with preferences file already created and when no prefs exists id oldGlobalPreferences = [ [NSDictionary dictionaryWithContentsOfFile: @@ -215,14 +212,14 @@ const char * szForcedPath = sForcedPath!=nil ? [sForcedPath UTF8String] : NULL; if (szForcedPath && *szForcedPath) { - cont = !BootProp::instance().open(szForcedPath, [self auth]); + cont = !BootProp::instance().open(szForcedPath, false, [self auth]); } else { for(int i=0; szBootPaths[i] && cont; i++) { sPath = szBootPaths[i]; sPath += szPropFileName; - cont = !BootProp::instance().open(sPath.c_str(), [self auth]); + cont = !BootProp::instance().open(sPath.c_str(), false, [self auth]); } } if (cont) Index: trunk/ChameleonPrefPane/Sources/SmbiosExtractor.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/SmbiosExtractor.mm (revision 382) +++ trunk/ChameleonPrefPane/Sources/SmbiosExtractor.mm (revision 383) @@ -52,7 +52,7 @@ @implementation SmbiosExtractor -@synthesize dict; +@synthesize content; @synthesize smString; @synthesize bufSize; -(id) init @@ -82,10 +82,10 @@ smString = nil; } - if (dict!=nil) + if (content!=nil) { - [dict release]; - dict = nil; + [content release]; + content = nil; } } @@ -97,7 +97,7 @@ -(NSString*) description { - return [dict description]; + return [content description]; } -(NSUInteger) extractSmBios @@ -113,11 +113,12 @@ { const char * p = strstr(line, SmbiosTag)+ tagLen; std::string s = trim(p, " \t\r\n>"); - NSLog(@"Found SMBIOS (%d) [%s]", s.length(), s.c_str() ); + + // NSLog(@"Found SMBIOS (%d) [%s]", s.length(), s.c_str() ); [self cleanup]; - self.dict = [NSMutableDictionary dictionaryWithCapacity:32]; + self.content = [NSMutableDictionary dictionaryWithCapacity:32]; self.smString = [NSString stringWithUTF8String:s.c_str()]; bufSize = s.length()/2; @@ -147,14 +148,14 @@ -(BOOL) save:(NSString*) path { NSString * error; - id plist = [NSPropertyListSerialization dataFromPropertyList:(id)dict + id plist = [NSPropertyListSerialization dataFromPropertyList:(id)content format:NSPropertyListXMLFormat_v1_0 errorDescription:&error]; [plist writeToFile:path atomically:YES]; return YES; } -#define ADD_HANDLE(text) [dict setValue:innerDict forKey: [NSString stringWithFormat:@"%@ (0x%02x)", text, (int) structHeader->header.handle] ] +#define ADD_HANDLE(text) [content setValue:innerDict forKey: [NSString stringWithFormat:@"%@ (0x%02x)", text, (int) structHeader->header.handle] ] //------------------------------------------------------------------------------------------------------------------------- // BIOSInformation //------------------------------------------------------------------------------------------------------------------------- @@ -416,6 +417,13 @@ case kSMBTypeFirmwareVolume: case kSMBTypeMemorySPD: default: + { +/* + NSDictionary* innerDict = [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects: nil ] forKeys: [NSArray arrayWithObjects:nil]]; + NSString* title = [NSString stringWithFormat:@"Type %d Len=%d (0x%02x)", (int) structHeader->type, structHeader->length, structHeader->handle]; + [dict setValue:innerDict forKey: title ]; + */ + } break; } Index: trunk/ChameleonPrefPane/Sources/PropertyList.cpp =================================================================== --- trunk/ChameleonPrefPane/Sources/PropertyList.cpp (revision 382) +++ trunk/ChameleonPrefPane/Sources/PropertyList.cpp (revision 383) @@ -238,9 +238,26 @@ //-------------------------------------------------------------------------- PropertyList::~PropertyList() { - if (_CFURLRef) CFRelease(_CFURLRef); - if (_proplistRef) CFRelease(_proplistRef); + cleanup(); +} +//-------------------------------------------------------------------------- +// Cleanup a PropertyList Instance +//-------------------------------------------------------------------------- +void PropertyList::cleanup() +{ + if (_CFURLRef) + { + CFRelease(_CFURLRef); + _CFURLRef = NULL; + } + + if (_proplistRef) + { + CFRelease(_proplistRef); + _proplistRef = NULL; + } + _propFilePath = ""; } //-------------------------------------------------------------------------- @@ -250,9 +267,12 @@ { bool ret = false; - if (!path || !*path) return false; + cleanup(); + + if (!path || !*path || !(createIfNotExist || fileExists(path)) ) + return false; + _propFilePath = path; - CFStringRef cfPath = CFStringCreateWithCString (kCFAllocatorDefault, path, kCFStringEncodingUTF8); CFURLRef inURL = CFURLCreateWithFileSystemPath( kCFAllocatorDefault, cfPath, Index: trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.cpp =================================================================== --- trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.cpp (revision 382) +++ trunk/ChameleonPrefPane/Sources/ChameleonPropertyList.cpp (revision 383) @@ -8,9 +8,7 @@ #include "ChameleonPropertyList.h" -PrefsProp* PrefsProp::_instance = NULL; BootProp* BootProp::_instance = NULL; -SmbiosProp* SmbiosProp::_instance = NULL; void ChameleonPropertyList::deleteOptionDesc() { Index: trunk/ChameleonPrefPane/Sources/SmbiosExtractor.h =================================================================== --- trunk/ChameleonPrefPane/Sources/SmbiosExtractor.h (revision 382) +++ trunk/ChameleonPrefPane/Sources/SmbiosExtractor.h (revision 383) @@ -8,14 +8,14 @@ #import -@interface SmbiosExtractor : NSObject { +@interface SmbiosExtractor : NSTreeController { UInt8* buffer; NSUInteger bufSize; NSString* smString; - NSMutableDictionary* dict; + NSMutableDictionary* content; } -@property (retain) NSMutableDictionary* dict; +@property (retain) NSMutableDictionary* content; @property (retain) NSString* smString; @property NSUInteger bufSize; Index: trunk/ChameleonPrefPane/Sources/BootSetupController.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/BootSetupController.mm (revision 382) +++ trunk/ChameleonPrefPane/Sources/BootSetupController.mm (revision 383) @@ -10,6 +10,7 @@ #import "TableViewsController.h" #import "ShellProcess.h" #import "PartitionInfoManager.h" +#include "ChameleonPropertyList.h" static const char cPartDescSep = ';'; // partition descriptor separator @@ -256,10 +257,8 @@ else [[self preferencesFile] setObject: [mBootConfigPathText stringValue] forKey: keyForceBootConfigPath]; [self savePreferences ]; - - - [PreferencesControllerBase loadOptionsFromBootFile ]; - + BootProp::instance().cleanup(); + [[ChameleonPrefPane instance ] initBootConfig]; } //-------------------------------------------------------------------------- -(IBAction) onCheckButtonChange: (NSButton*) sender @@ -317,7 +316,11 @@ [self doSwapHD: [mSwapHD01 intValue] save:true src:0 dst:1]; [self doSwapHD: [mSwapHD02 intValue] save:true src:0 dst:2]; - } + } + else if (sender == mBootConfigPathText) + { + [self onForceBootConfigPath: sender]; + } } //-------------------------------------------------------------------------- - (IBAction) onCdBootConfigPath: (id) sender Index: trunk/ChameleonPrefPane/Sources/PropertyList.h =================================================================== --- trunk/ChameleonPrefPane/Sources/PropertyList.h (revision 382) +++ trunk/ChameleonPrefPane/Sources/PropertyList.h (revision 383) @@ -40,6 +40,8 @@ /// Tell if a valid property list successfully opened bool isValid() const { return _proplistRef!=NULL;} + /// release the current proplist if it exists + void cleanup(); /// Open a property list bool open(const char *propListPath, bool createIfNotExist, Index: trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj =================================================================== --- trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj (revision 382) +++ trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj (revision 383) @@ -61,7 +61,6 @@ 8485BA001482F640005DF2E4 /* SmbiosExtractor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8485B9FE1482F640005DF2E4 /* SmbiosExtractor.mm */; }; 84DDA075148346AA00A7C8FF /* smbios.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84DDA070148346AA00A7C8FF /* smbios.cpp */; }; 84DDA076148346AA00A7C8FF /* smbios.h in Headers */ = {isa = PBXBuildFile; fileRef = 84DDA071148346AA00A7C8FF /* smbios.h */; }; - 84DDA077148346AA00A7C8FF /* smbios_decode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84DDA072148346AA00A7C8FF /* smbios_decode.cpp */; }; 8D202CEA0486D31800D8A456 /* StartupPrefPane_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCFA20370C41700C91783 /* StartupPrefPane_Prefix.pch */; }; 8D202CEF0486D31800D8A456 /* Chameleon.xib in Resources */ = {isa = PBXBuildFile; fileRef = F506C042013D9D8C01CA16C8 /* Chameleon.xib */; }; 8D202CF30486D31800D8A456 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; @@ -170,7 +169,6 @@ 8485B9FE1482F640005DF2E4 /* SmbiosExtractor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmbiosExtractor.mm; path = Sources/SmbiosExtractor.mm; sourceTree = ""; }; 84DDA070148346AA00A7C8FF /* smbios.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = smbios.cpp; sourceTree = ""; }; 84DDA071148346AA00A7C8FF /* smbios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios.h; sourceTree = ""; }; - 84DDA072148346AA00A7C8FF /* smbios_decode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = smbios_decode.cpp; sourceTree = ""; }; 8D202CF70486D31800D8A456 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; B316F45B111C604B007EFE5E /* French */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = French; path = Chameleon.strings; sourceTree = ""; }; B316F45D111C604B007EFE5E /* French */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = French; path = Chameleon.xib; sourceTree = ""; }; @@ -402,7 +400,6 @@ children = ( 84DDA070148346AA00A7C8FF /* smbios.cpp */, 84DDA071148346AA00A7C8FF /* smbios.h */, - 84DDA072148346AA00A7C8FF /* smbios_decode.cpp */, ); name = smbios; path = Sources/smbios; @@ -673,7 +670,6 @@ 015403A114706EAC008E088A /* PartitionInfoManager.mm in Sources */, 8485BA001482F640005DF2E4 /* SmbiosExtractor.mm in Sources */, 84DDA075148346AA00A7C8FF /* smbios.cpp in Sources */, - 84DDA077148346AA00A7C8FF /* smbios_decode.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Index: trunk/ChameleonPrefPane/English.lproj/Chameleon.xib =================================================================== --- trunk/ChameleonPrefPane/English.lproj/Chameleon.xib (revision 382) +++ trunk/ChameleonPrefPane/English.lproj/Chameleon.xib (revision 383) @@ -12,7 +12,7 @@ YES - + YES @@ -33,6 +33,19 @@ NSApplication + + + YES + sele + Key + Value + + YES + + YES + YES + YES + 7 2 @@ -255,7 +268,7 @@ 0.99047619104385376 - {{0, 28}, {126, 410}} + {{0, 29}, {126, 410}} YES @@ -293,7 +306,7 @@ Item 1 - + 292 YES @@ -1000,7 +1013,6 @@ {541, 408} - 2 Startup Disk @@ -4081,7 +4093,7 @@ Item 7 - + 256 YES @@ -4105,96 +4117,99 @@ 274 YES - + 268 YES - - + + 2304 YES - - + + 256 - {494, 198} - + {497, 209} + 2 - _NS:1843 + _NS:1718 YES - - + + 256 - {494, 17} - + {497, 17} + 2 - _NS:1845 - + _NS:1720 + -2147483392 {{224, 0}, {16, 17}} - 2 - _NS:1848 + _NS:1724 YES - + 101 - 40 + 16 1000 75628096 2048 - + Key - + 3 MC4zMzMzMzI5ODU2AA - + 337772096 2048 Text Cell - - + + LucidaGrande-Bold + 13 + 16 + + 3 YES YES - + - - 387 + + 390 40 1000 75628096 2048 - + Value - + - + 337772096 2048 Text Cell - - + + 3 YES YES - + 3 @@ -4202,7 +4217,7 @@ 17 - -700448768 + -767557632 4 @@ -4213,64 +4228,64 @@ 1 - {{1, 17}, {494, 198}} - - + {{1, 17}, {497, 209}} + + 2 - _NS:1841 - + _NS:1716 + 4 - - + + -2147483392 {{224, 17}, {15, 102}} - - _NS:1860 - + + _NS:1741 + _doScroller: 37 - 0.1947367936372757 + 0.13909779489040375 - - + + -2147483392 - {{1, 204.3984375}, {494.90234375, 15}} - - _NS:1862 + {{1, 211}, {495.94140625, 15}} + + _NS:1743 1 - + _doScroller: 0.57142859697341919 - - + + 2304 YES - + - {{1, 0}, {494, 17}} - - + {{1, 0}, {497, 17}} + + 2 - _NS:1846 - + _NS:1721 + 4 - {{7, 10}, {496, 216}} + {{6, 5}, {499.203125, 227}} - + 2 - _NS:1839 + _NS:1714 133682 - - - - + + + + QSAAAEEgAABBmAAAQZgAAA @@ -4541,6 +4556,7 @@ {541, 408} + 2 SMBIOS @@ -4628,11 +4644,7 @@ 68288064 138413056 Version bla bla. - - LucidaGrande-Bold - 13 - 16 - + @@ -4716,14 +4728,14 @@ - + 268435462 YES YES YES - + @@ -4828,6 +4840,7 @@ TableViewsController + @@ -6472,6 +6485,62 @@ 1351 + + + dataSource + + + + 1371 + + + + content: arrangedObjects.Key + + + + + + content: arrangedObjects.Key + content + arrangedObjects.Key + 2 + + + 1382 + + + + value: arrangedObjects.Key + + + + + + value: arrangedObjects.Key + value + arrangedObjects.Key + 2 + + + 1384 + + + + value: arrangedObjects.Value + + + + + + value: arrangedObjects.Value + value + arrangedObjects.Value + 2 + + + 1386 + @@ -6513,10 +6582,10 @@ YES - + @@ -8378,7 +8447,7 @@ YES - + @@ -8481,112 +8550,122 @@ - 1328 - + 830 + YES - - - - + - + - 1329 - - + 831 + + - 1330 - - - - - 1331 - + 1216 + YES - - + - + - 1332 - - + 1217 + + - 1333 - + 1345 + YES - + - + - 1334 - + 1346 + + + + + 1352 + + + + + 1354 + YES - + + + + - + - 1335 - - + 1355 + + - 1336 - - + 1356 + + - 830 - + 1357 + YES - + + - + - 831 - - + 1358 + + - 1216 - + 1359 + YES - + - + - 1217 - - - - - 1345 - + 1360 + YES - + - + - 1346 - - + 1361 + + + + 1362 + + + + + 1366 + + + @@ -8728,21 +8807,26 @@ 1309.CustomClassName 1309.IBPluginDependency 1309.IBViewBoundsToFrameTransform - 1328.IBPluginDependency - 1328.IBViewBoundsToFrameTransform - 1329.IBPluginDependency - 1330.IBPluginDependency - 1331.IBPluginDependency - 1332.IBPluginDependency - 1333.IBPluginDependency - 1334.IBPluginDependency - 1335.IBPluginDependency - 1336.IBPluginDependency 1345.IBPluginDependency 1345.IBViewBoundsToFrameTransform 1346.IBPluginDependency + 1352.IBPluginDependency + 1354.IBPluginDependency + 1354.IBViewBoundsToFrameTransform + 1355.IBPluginDependency + 1356.IBPluginDependency + 1357.IBAttributePlaceholdersKey + 1357.IBPluginDependency + 1358.IBPluginDependency + 1359.IBAttributePlaceholdersKey + 1359.IBPluginDependency 136.IBPluginDependency 136.IBViewBoundsToFrameTransform + 1360.IBPluginDependency + 1361.IBPluginDependency + 1362.IBPluginDependency + 1366.CustomClassName + 1366.IBPluginDependency 158.IBPluginDependency 160.IBPluginDependency 172.IBAttributePlaceholdersKey @@ -9225,10 +9309,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{1289, 253}, {668, 439}} + {{199, 501}, {668, 439}} com.apple.InterfaceBuilder.CocoaPlugin - {{1289, 253}, {668, 439}} + {{199, 501}, {668, 439}} {224.66399999999999, 10} @@ -9342,19 +9426,31 @@ com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABBAAAAw14AAA + P4AAAL+AAABDaJUAwagAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABAwAAAw2YAAA + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + YES + + + YES + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABDaJUAwagAAA + + YES + + + YES + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -9363,6 +9459,11 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + SmbiosExtractor + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin InitialTabViewItem @@ -9958,7 +10059,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAAAAAAAAw9+AAA + P4AAAL+AAAAAAAAAw9oAAA @@ -10011,7 +10112,7 @@ - 1351 + 1386 @@ -11208,6 +11309,14 @@ + SmbiosExtractor + NSTreeController + + IBProjectSource + Sources/SmbiosExtractor.h + + + TableViewsController NSObject @@ -11804,6 +11913,22 @@ + NSObjectController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSObjectController.h + + + + NSOutlineView + NSTableView + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + NSPanel NSWindow @@ -11954,6 +12079,14 @@ + NSTreeController + NSObjectController + + IBFrameworkSource + AppKit.framework/Headers/NSTreeController.h + + + NSUserDefaultsController NSController @@ -11999,6 +12132,25 @@ + NSViewController + NSResponder + + view + NSView + + + view + + view + NSView + + + + IBFrameworkSource + AppKit.framework/Headers/NSViewController.h + + + NSWindow IBFrameworkSource