static const NSString* const keySwapHD01 = @"swapHD01";␊ |
static const NSString* const keySwapHD02 = @"swapHD02";␊ |
static const NSString* const keyUseFrozenParts = @"useFrozenParts";␊ |
static const NSString* const keyPartitionsList = @"partitionsList";␊ |
//--------------------------------------------------------------------------␊ |
// Static file variables␊ |
//--------------------------------------------------------------------------␊ |
|
␉␉[mSwapHD01 setIntValue: [[oldGlobalPreferences objectForKey:␉keySwapHD01] intValue]];␊ |
␉␉[mSwapHD02 setIntValue: [[oldGlobalPreferences objectForKey:␉keySwapHD02] intValue]];␊ |
␉␉[mFreezeParts setIntValue: [[oldGlobalPreferences objectForKey: keyUseFrozenParts] intValue] ];␊ |
␉␉mPartitionsList = [oldGlobalPreferences objectForKey: keyUseFrozenParts];␊ |
␉}␊ |
␉else ␊ |
␉{ // Create a preference plist file with Defaults values␊ |
␉␉[mSwapHD01 setIntValue: 0];␊ |
␉␉[mSwapHD02 setIntValue: 0];␊ |
␉␉[mFreezeParts setIntValue: 0];␊ |
␉␉␊ |
␉␉// Initialize defaults␊ |
␉␉oldGlobalPreferences = [[NSMutableDictionary alloc] init];␊ |
␉␉[oldGlobalPreferences setObject: [[NSNumber alloc] initWithInt: CurrentPreferencesFileVersion] ␊ |
|
␉␉[oldGlobalPreferences setObject: [[NSNumber alloc] initWithBool: false] forKey: keySwapHD01];␊ |
␉␉[oldGlobalPreferences setObject: [[NSNumber alloc] initWithBool: false] forKey: keySwapHD02];␊ |
␉␉[oldGlobalPreferences setObject:[[NSNumber alloc] initWithBool: false] forKey: keyUseFrozenParts];␊ |
␉␉[oldGlobalPreferences setObject: [[NSMutableDictionary alloc] initWithCapacity:64] forKey: keyPartitionsList];␊ |
␉␉␊ |
␉␉// Save the preferences file␊ |
␉␉[ self savePreferences:oldGlobalPreferences ];␊ |
|
␉mOptionsDict = [[NSMutableDictionary alloc] init];␊ |
[mOptionsDict addEntriesFromDictionary:oldGlobalPreferences];␊ |
␉[mOptionsDict retain];␊ |
␉if (mPartitionsList!=nil) [mPartitionsList retain];␊ |
[oldGlobalPreferences release];␊ |
␉␊ |
}␊ |
|
- (IBAction)onInjectPartsToFreeze: (id)sender␊ |
{␊ |
␉// TODO generate the parts list in preferences proplist␊ |
␉NSInteger n = NSRunAlertPanel(@"Inject Partitions to Freeze Configuration", ␊ |
␉␉␉␉␉␉␉␉ @"Are you sure you want to overwrite your Freeze settings with current partition list ?",␊ |
␉␉␉␉␉␉␉␉ @"OK", @"Cancel",nil);␊ |
␉if (n==1)␊ |
␉{␊ |
␉}␊ |
}␊ |
//--------------------------------------------------------------------------␊ |
// following DieBuch recommendation : using applescript and system events (thanks!):␊ |
|
␉{␊ |
␉␉system("/usr/bin/osascript -e 'tell app \"System Events\" to shut down'");␊ |
␉}␊ |
␉␊ |
}␊ |
␊ |
- (IBAction)onSleep: (id)sender␊ |
|
//--------------------------------------------------------------------------␊ |
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView␊ |
{␊ |
␉return partExtractor ? partExtractor->partList().size() : 0;␊ |
␉int size = partExtractor ? partExtractor->partList().size() : 0;␊ |
␉return size;␊ |
}␊ |
␊ |
//--------------------------------------------------------------------------␊ |