Spotlight search path is now properly saved to defaults.

CQTexperiment
matthewleon 2008-02-11 18:51:04 +00:00
parent 0e6a9ee966
commit ff32a0a910
3 changed files with 578 additions and 533 deletions

View File

@ -107,6 +107,7 @@
5604D4580D603459004F5C5D /* SpotlightPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5604D4570D603459004F5C5D /* SpotlightPanel.xib */; };
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4590D60349B004F5C5D /* SpotlightWindowController.m */; };
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */; };
562EA72E0D60CC5B0017B2B7 /* SpotlightTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@ -596,6 +597,7 @@
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightWindowController.h; path = Spotlight/SpotlightWindowController.h; sourceTree = "<group>"; };
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightPlaylistEntry.h; path = Spotlight/SpotlightPlaylistEntry.h; sourceTree = "<group>"; };
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightPlaylistEntry.m; path = Spotlight/SpotlightPlaylistEntry.m; sourceTree = "<group>"; };
562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpotlightTransformers.m; sourceTree = "<group>"; };
566D32160D538550004466A5 /* APL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = APL.xcodeproj; path = Plugins/APL/APL.xcodeproj; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PreferencePaneProtocol.h; path = Preferences/SS_PreferencePaneProtocol.h; sourceTree = "<group>"; };
@ -1091,6 +1093,7 @@
5604D4520D603430004F5C5D /* SpotlightSearchController.h */,
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */,
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */,
562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */,
);
name = Spotlight;
sourceTree = "<group>";
@ -1628,6 +1631,7 @@
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */,
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */,
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */,
562EA72E0D60CC5B0017B2B7 /* SpotlightTransformers.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,16 @@ static NSPredicate * musicOnlyPredicate = nil;
{
musicOnlyPredicate = [[NSPredicate predicateWithFormat:
@"kMDItemContentTypeTree==\'public.audio\'"] retain];
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
@ -32,15 +42,6 @@ static NSPredicate * musicOnlyPredicate = nil;
return self;
}
- (void)awakeFromNib
{
// Will replace this with userdefaults, but for now just start in
// the home directory.
NSString *homeDirectory = @"~";
homeDirectory = [homeDirectory stringByExpandingTildeInPath];
[pathControl setURL:[NSURL fileURLWithPath:homeDirectory isDirectory:YES]];
}
- (void)performSearch
{
unsigned options = (NSCaseInsensitivePredicateOption|