diff options
author | Brian Cully <bjc@kublai.com> | 2008-04-14 21:45:08 -0400 |
---|---|---|
committer | Brian Cully <github.20.shmit@spamgourmet.com> | 2008-04-14 21:45:08 -0400 |
commit | 17349a5e426dc7acf1216a3767a22f69974cbca0 (patch) | |
tree | 20029d02f07ab6257cccec36d34fb312f796e1d1 /Liaison/ApplicationController.m | |
download | liaison-17349a5e426dc7acf1216a3767a22f69974cbca0.tar.gz liaison-17349a5e426dc7acf1216a3767a22f69974cbca0.zip |
Initial commit.
Diffstat (limited to 'Liaison/ApplicationController.m')
-rw-r--r-- | Liaison/ApplicationController.m | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Liaison/ApplicationController.m b/Liaison/ApplicationController.m new file mode 100644 index 0000000..edff915 --- /dev/null +++ b/Liaison/ApplicationController.m @@ -0,0 +1,90 @@ +#import "ApplicationController.h" + +#import "FileTableDelegate.h" +#import "Group.h" +#import "GroupTableDelegate.h" +#import "NIBConnector.h" +#import "PluginManager.h" +#import "RenManager.h" +#import "WindowController.h" + +@implementation ApplicationController +// Set in awakeFromNib. +static ApplicationController *theApp = nil; + ++ (ApplicationController *)theApp; +{ + return theApp; +} + +- (void)awakeFromNib +{ + theApp = self; +} + +- (void)applicationDidFinishLaunching: (NSNotification *)aNotification +{ + RenManager *renManager; + NSArray *fileStorePlugins; + NSString *libraryPath; + id <LiFileStorePlugin>plugin; + + // Make sure the library exists. + libraryPath = [[[Preferences sharedPreferences] libraryPath] stringByDeletingLastPathComponent]; + [[NSFileManager defaultManager] createDirectoryAtPath: libraryPath + attributes: nil]; + + // Load the plugins. + fileStorePlugins = [[PluginManager defaultManager] fileStorePlugins]; + plugin = [fileStorePlugins objectAtIndex: 0]; // XXX + [plugin initFileStore]; + + renManager = [RenManager sharedManager]; + [renManager setFileStore: [plugin fileStore]]; + [renManager startup]; +} + +- (BOOL)application: (NSApplication *)anApp openFile: (NSString *)aPath +{ + [[NSWorkspace sharedWorkspace] openFile: aPath]; + [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: aPath]]; + return YES; +} + +- (IBAction)openHomepage:(id)sender +{ + [[NSWorkspace sharedWorkspace] openURL: + [NSURL URLWithString: @"http://www.kublai.com/~shmit/software/Liaison/"]]; +} + + +- (IBAction)showInspectorWindow:(id)sender +{ + [inspectorWindow makeKeyAndOrderFront: self]; +} + +- (IBAction)showMainWindow:(id)sender +{ + [mainWindow makeKeyAndOrderFront: self]; +} +@synthesize theFileStore; +@synthesize inspectorWindow; +@synthesize mainWindow; +@end + +@implementation ApplicationController (AppleScript) +- (BOOL)application: (NSApplication *)anApp + delegateHandlesKey: (NSString *)aKey +{ + [LiLog logAsDebug: @"[ApplicationController application:delegateHandlesKey: %@", aKey]; + if ([aKey isEqualToString: @"orderedFileStores"]) + return YES; + return NO; +} + +- (NSArray *)orderedFileStores +{ + [LiLog logAsDebug: @"[ApplicationController orderedFileStores]"]; + return [LiFileStore allFileStores]; +} +@end
\ No newline at end of file |