Moved SpotlightController registerDefaults to awakeFromNib to hopefully prevent crash.
This commit is contained in:
parent
c31eae4541
commit
b7beb276f2
2 changed files with 454 additions and 447 deletions
File diff suppressed because it is too large
Load diff
|
@ -28,17 +28,6 @@ static NSPredicate * musicOnlyPredicate = nil;
|
||||||
musicOnlyPredicate = [[NSPredicate predicateWithFormat:
|
musicOnlyPredicate = [[NSPredicate predicateWithFormat:
|
||||||
@"kMDItemContentTypeTree==\'public.audio\'"] retain];
|
@"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
|
// Register value transformers
|
||||||
NSValueTransformer *pausingQueryTransformer = [[[PausingQueryTransformer alloc]init]autorelease];
|
NSValueTransformer *pausingQueryTransformer = [[[PausingQueryTransformer alloc]init]autorelease];
|
||||||
[NSValueTransformer setValueTransformer:pausingQueryTransformer forName:@"PausingQueryTransformer"];
|
[NSValueTransformer setValueTransformer:pausingQueryTransformer forName:@"PausingQueryTransformer"];
|
||||||
|
@ -55,6 +44,19 @@ static NSPredicate * musicOnlyPredicate = nil;
|
||||||
[NSMetadataQuery exposeBinding:@"searchScopes"];
|
[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
|
- (id)init
|
||||||
{
|
{
|
||||||
if (self = [super initWithWindowNibName:@"SpotlightPanel"]) {
|
if (self = [super initWithWindowNibName:@"SpotlightPanel"]) {
|
||||||
|
@ -83,6 +85,8 @@ static NSPredicate * musicOnlyPredicate = nil;
|
||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
|
[self registerDefaults];
|
||||||
|
|
||||||
// We want to bind the query's search scope to the user default that is
|
// We want to bind the query's search scope to the user default that is
|
||||||
// set from the NSPathControl.
|
// set from the NSPathControl.
|
||||||
NSDictionary *bindOptions =
|
NSDictionary *bindOptions =
|
||||||
|
|
Loading…
Reference in a new issue