#pragma .h #import <Foundation/NSObject.h>

#import <Foundation/NSUtilities.h>
#import <Foundation/NSException.h>
 
#import <AppKit/NSApplication.h>
#import <AppKit/NSMenu.h>

#ifdef DEBUG
#import <Foundation/NSDebug.h>
#endif

#import <IconKit/iconkit.h>

#import "AppDelegate.h"
#import "File.h"
#import "FileManager.h"

@implementation AppDelegate: NSObject
{
    id infoPanel;
}

- (void)newViewer:(id)sender
{
    id fileManager = [[FileManager alloc] init];
    [fileManager setRoot:[File fileForPath:@"/"]];
    [[[fileManager shelf] cellAtRow:0 column:0] setDelegate: [File fileForPath:NSHomeDirectory()]];
    [[fileManager window] makeKeyAndOrderFront:self];
}

- (void)showInfo:(id)sender
{
    if (infoPanel == nil)
        [NSBundle loadNibNamed:@"Info.nib" owner:self];
    [infoPanel makeKeyAndOrderFront:self];
}

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
    #ifdef DEBUG
    #warning enableFreedObjectCheck AND enableDoubleReleaseCheck set to YES
    [NSAutoreleasePool enableFreedObjectCheck:YES];
    [NSAutoreleasePool enableDoubleReleaseCheck:YES];
    #endif
    [self newViewer: self];
    [[NSApp mainMenu] setAutoenablesItems:YES];
}

@end
