Chameleon Applications

Chameleon Applications Commit Details

Date:2010-01-21 01:10:57 (14 years 3 months ago)
Author:Rekursor
Commit:19
Parents: 18
Message:Implemented sub dictionary storage caps for freeze. still needs to implement injection, then parsing.
Changes:
M/trunk/ChameleonPrefPane/Sources/property_list.cpp
M/trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.h
M/trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
M/trunk/ChameleonPrefPane/English.lproj/Chameleon.xib

File differences

trunk/ChameleonPrefPane/Sources/property_list.cpp
77
88
99
10
1011
1112
1213
......
240241
241242
242243
244
245
243246
244247
245248
#include "property_list.h"
#include <string.h>
#include <sys/stat.h>
/****************************************************************************/
/**
bool ret = false;
if (!path || !*path) return false;
struct stat st;
if(stat(path,&st) != 0) return false; // file does not exist;
// give write temporary write rights to the file
if (!chmodFile(path,"0777", auth, flags)) return false;
trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.h
3535
3636
3737
38
3839
3940
4041
NSImage*mUnknownImage;
NSImage*mCDROMImage;
NSMutableDictionary*mOptionsDict;
NSMutableDictionary*mPartitionsList;
NSString*mOptionsPlistPath;
intmPreferenceFileVersion;
}
trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
3636
3737
3838
39
3940
4041
4142
......
119120
120121
121122
123
122124
123125
124126
125127
126128
127129
128
129130
130131
131132
......
133134
134135
135136
137
136138
137139
138140
......
141143
142144
143145
146
144147
145148
146149
......
340343
341344
342345
346
347
348
349
350
351
343352
344353
345354
......
365374
366375
367376
368
369377
370378
371379
......
397405
398406
399407
400
408
409
401410
402411
403412
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;
}
//--------------------------------------------------------------------------
trunk/ChameleonPrefPane/English.lproj/Chameleon.xib
1212
1313
1414
15
15
1616
1717
1818
......
7272
7373
7474
75
75
7676
7777
7878
......
724724
725725
726726
727
727728
728729
729730
......
732733
733734
734735
735
736
736737
737738
738739
......
876877
877878
878879
879
880880
881881
882882
883883
884884
885885
886
886
887887
888888
889889
890890
891891
892892
893
893
894894
895895
896896
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="203"/>
<integer value="172"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTabViewItem" id="210384195">
<string key="NSIdentifier">1</string>
<object class="NSView" key="NSView" id="389526238">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder" ref="869599070"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string key="NSFrame">{{10, 33}, {663, 263}}</string>
<reference key="NSSuperview" ref="869599070"/>
</object>
<string key="NSLabel">Select Boot Partition</string>
<reference key="NSColor" ref="1061310622"/>
<object class="NSTabViewItem" id="1039429426">
<string key="NSIdentifier">2</string>
<object class="NSView" key="NSView" id="451295758">
<reference key="NSNextResponder" ref="869599070"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string key="NSFrame">{{10, 33}, {663, 263}}</string>
<reference key="NSSuperview" ref="869599070"/>
</object>
<string key="NSLabel">Settings</string>
<reference key="NSColor" ref="1061310622"/>
<reference key="NSTabView" ref="869599070"/>
</object>
</object>
<reference key="NSSelectedTabViewItem" ref="1039429426"/>
<reference key="NSSelectedTabViewItem" ref="210384195"/>
<reference key="NSFont" ref="930899267"/>
<int key="NSTvFlags">0</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="451295758"/>
<reference ref="389526238"/>
</object>
</object>
</object>

Archive Download the corresponding diff file

Revision: 19