Moved SpotlightController registerDefaults to awakeFromNib to hopefully prevent crash.
parent
c31eae4541
commit
b7beb276f2
File diff suppressed because it is too large
Load Diff
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue