Chameleon Applications

Chameleon Applications Commit Details

Date:2011-11-19 19:29:08 (12 years 5 months ago)
Author:Rekursor
Commit:354
Parents: 353
Message:Implemented table view direct partition rename.
Changes:
M/trunk/ChameleonPrefPane/Sources/BootSetupController.mm
M/trunk/ChameleonPrefPane/Sources/TableViewsController.mm
M/trunk/ChameleonPrefPane/Sources/PartitionInfoManager.h
M/trunk/ChameleonPrefPane/Sources/PartitionInfoManager.mm
M/trunk/ChameleonPrefPane/test_util/test_util.mm

File differences

trunk/ChameleonPrefPane/Sources/PartitionInfoManager.mm
220220
221221
222222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
223239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
224261
}
+(NSString*) getRenameStringFrom:(NSString*) currentStr andPartition: (PartitionInfoElement*) partInfo
{
if (partInfo != nil && currentStr!=nil)
{
NSMutableString* ms = [[NSMutableString alloc ] initWithCapacity: 512];
NSArray* sPairs =
[currentStr componentsSeparatedByCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString: @";"] ];
if ([sPairs count] > 0 )
{
for (NSString* s in sPairs)
{
if ( s==nil || [s length] == 0) continue;
if ( [ s rangeOfString:[partInfo hdString]].location == NSNotFound )
{
if ([ms length] > 0) [ ms appendString:@";" ];
[ms appendString: [NSString stringWithFormat:@"%@",s ]];
}
}
}
// now filter the case where name eauls alias -> no rename anymore
if ( ![[partInfo vName] isEqual: [partInfo vAliasName]])
{
if ([ms length] > 0) [ ms appendString:@";" ];
[ms appendString: [NSString stringWithFormat:@"%@ \"%@\"" ,
[partInfo hdString], [partInfo vAliasName] ]];
}
return ms;
}
return nil;
}
@end
trunk/ChameleonPrefPane/Sources/PartitionInfoManager.h
3232
3333
3434
35
36
37
3538
+(void)resetSwapping;
+(void)swapHD:(NSUInteger) src with:(NSUInteger) dst;
+(NSString*) getRenameStringFrom:(NSString*) currentStr andPartition: (PartitionInfoElement*) partInfo;
@end
trunk/ChameleonPrefPane/Sources/TableViewsController.mm
206206
207207
208208
209
209210
210211
211212
212213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
213232
214233
215234
{
if (object == nil) return;
PartitionInfoElement* partInfo = [PartsInfoMgr objectAtIndex:row];
if (tableColumn == mHideOrViewColumn)
{
[partInfo setHidden: ([object intValue] ? false : true) ];
}
else if (tableColumn == mPartitionNameColumn)
{
[partInfo setVAliasName: (object==nil || [object length] == 0) ? [partInfo vName] : object];
const char * sCur = BootProp::instance().getStringForKey(kRenamePartition);
NSString * currentStr = [NSString stringWithUTF8String: sCur ? sCur : ""] ;
NSString* renStr = [PartsInfoMgr getRenameStringFrom:(NSString*) currentStr
andPartition: (PartitionInfoElement*) partInfo];
if (renStr!=nil &&
BootProp::instance().setStringForKey(kRenamePartition, [renStr UTF8String])
)
{
AuthorizationRef auth= [TableViewsController authorization];
BootProp::instance().save(auth);
[ PreferencesControllerBase loadOptionsFromBootFile];
}
}
[partInfo release];
NSLog(@"object at column %@ row %d Set %@", [[tableColumn headerCell] stringValue], row, object);
trunk/ChameleonPrefPane/Sources/BootSetupController.mm
362362
363363
364364
365
365
366
366367
367368
368369
if (result)
{
[self msgBoxInfo:
[NSString stringWithFormat:@"Boot cd creator script successfully executed. BootCD.iso created in %@.", destination]];
[NSString stringWithFormat:@"Boot cd creator script successfully executed. BootCD.iso created in %@.",
destination]];
}
else
[self msgBoxError:@"ERROR: Couldn't execute boot cd creator script successfully!"];
trunk/ChameleonPrefPane/test_util/test_util.mm
5353
5454
5555
56
5657
5758
5859
5960
60
61
62
6163
6264
6365
NSLog(@"List of existing bsd disk partitions:\n %@", arr);
for (PartitionInfoElement* part in [PartsInfoMgr parts]) NSLog(@"PartionBootable = %i\n%@", (int) [part isBootable], part);
/*
[PartsInfoMgr hideParts: @"\"Macintosh HD\" hd(0,3)"];
[PartsInfoMgr hideParts: @"disk0s2 hd(0,2) "];
[PartsInfoMgr hideParts: @"BOOTCAMP \"Macintosh HD\""];
[PartsInfoMgr hideParts: @"3E9C6A92-3737-4C0F-9003-20B2482D61FB"];
[PartsInfoMgr renameParts: @"hd(0,2) \"John Doe\""];
*/
[PartsInfoMgr renameParts: @"hd(0,2) \"Test\""];
[PartsInfoMgr renameParts: @"hd(0,3) Fantastic"];
[PartsInfoMgr renameParts: @"hd(0,4) \"A BC\"; hd(0,2) DEF"];

Archive Download the corresponding diff file

Revision: 354