GitX v0.4.1
[GitX.git] / PBWebController.m
blob9c810ec1730367143db0e8178b8083232b5e8c55
1 //
2 //  PBWebController.m
3 //  GitX
4 //
5 //  Created by Pieter de Bie on 08-10-08.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
9 #import "PBWebController.h"
12 @implementation PBWebController
14 @synthesize startFile;
16 - (void) awakeFromNib
18         NSString* file = [[NSBundle mainBundle] pathForResource:startFile ofType:@"html"];
19         NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:file]];
21         finishedLoading = NO;
22         [view setUIDelegate:self];
23         [view setFrameLoadDelegate:self];
24         [[view mainFrame] loadRequest:request];
27 - (void) webView:(id) v didFinishLoadForFrame:(id) frame
29         id script = [view windowScriptObject];
30         [script setValue: self forKey:@"Controller"];
32         finishedLoading = YES;
33         if ([self respondsToSelector:@selector(didLoad)])
34                 [self performSelector:@selector(didLoad)];
37 - (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)dictionary
39         NSLog(@"Error from webkit!");
42 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
44         return NO;
47 + (BOOL)isKeyExcludedFromWebScript:(const char *)name {
48         return NO;
51 #pragma mark Functions to be used from JavaScript
52 - (void) log: (NSString*) logMessage
54         NSLog(logMessage);
57 @end