//
//  main.m
//  TeXDistApp
//
//  Created by itexmac2 on 08/05/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{
    return NSApplicationMain(argc, (const char **)argv);
}

#import <PreferencePanes/PreferencePanes.h>

@interface TeXDistAppAppDelegate : NSObject <NSApplicationDelegate> {
@private
    NSWindow *window;
    NSPreferencePane * preferencePane;
}

@property (assign) IBOutlet NSWindow *window;
@property (retain,readonly) NSPreferencePane * preferencePane;

@end

@interface TeXDistAppAppDelegate()
@property (retain,readwrite) NSPreferencePane * preferencePane;
@end

@implementation TeXDistAppAppDelegate

@synthesize window, preferencePane;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    NSString * path = [[[NSBundle mainBundle].builtInPlugInsPath stringByAppendingPathComponent:@"TeXDistPrefPane"] stringByAppendingPathExtension:@"prefPane"];
    NSAssert ([[NSFileManager defaultManager] fileExistsAtPath:path],@"MISSED");
    NSBundle * B = [NSBundle bundleWithPath:path];
    NSAssert([B loadAndReturnError:NULL],@"MISSED 2");
    self.preferencePane = [[[[B principalClass] alloc] initWithBundle:B] autorelease];
    [self.window.contentView addSubview:self.preferencePane.loadMainView];
    
}
- (void) dealloc;
{
    self.preferencePane = nil;
    [super dealloc];
}
@end
