Moved SpotlightController registerDefaults to awakeFromNib to hopefully prevent crash.

CQTexperiment
vspader 2008-02-23 14:09:34 +00:00
parent c31eae4541
commit b7beb276f2
2 changed files with 454 additions and 447 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,17 +27,6 @@ static NSPredicate * musicOnlyPredicate = nil;
{
musicOnlyPredicate = [[NSPredicate predicateWithFormat:
@"kMDItemContentTypeTree==\'public.audio\'"] retain];
// Set the home directory as the default search directory
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString * homeDir = @"~";
homeDir = [homeDir stringByExpandingTildeInPath];
homeDir = [[NSURL fileURLWithPath:homeDir isDirectory:YES] absoluteString];
NSDictionary *searchDefault =
[NSDictionary dictionaryWithObject:homeDir
forKey:@"spotlightSearchPath"];
[defaults registerDefaults:searchDefault];
// Register value transformers
NSValueTransformer *pausingQueryTransformer = [[[PausingQueryTransformer alloc]init]autorelease];
@ -55,6 +44,19 @@ static NSPredicate * musicOnlyPredicate = nil;
[NSMetadataQuery exposeBinding:@"searchScopes"];
}
- (void)registerDefaults
{
// Set the home directory as the default search directory
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString * homeDir = @"~";
homeDir = [homeDir stringByExpandingTildeInPath];
homeDir = [[NSURL fileURLWithPath:homeDir isDirectory:YES] absoluteString];
NSDictionary *searchDefault =
[NSDictionary dictionaryWithObject:homeDir
forKey:@"spotlightSearchPath"];
[defaults registerDefaults:searchDefault];
}
- (id)init
{
if (self = [super initWithWindowNibName:@"SpotlightPanel"]) {
@ -83,6 +85,8 @@ static NSPredicate * musicOnlyPredicate = nil;
- (void)awakeFromNib
{
[self registerDefaults];
// We want to bind the query's search scope to the user default that is
// set from the NSPathControl.
NSDictionary *bindOptions =