Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions Unretiner/Classes/Controller/UnretinerAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ - (void)dealloc {

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Add the view from our controller
viewController = [[UnretinaViewController alloc] initWithNibName:@"UnretinaViewController" bundle:nil];
viewController.view.bounds = self.view.bounds;
[view addSubview:viewController.view];
// Add the view from our controller:
[self makeViewControllerIfNeeded];
}

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication {
Expand All @@ -43,7 +41,18 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray *)files {
}

// Send to the controller
[viewController unretinaUrls:urls];
[self makeViewControllerIfNeeded];
[viewController unretinaUrls:urls];
}

- (void)makeViewControllerIfNeeded;
{
if (viewController == nil) {
NSLog(@"%s Instantiating a view controller.", __func__);
viewController = [[UnretinaViewController alloc] initWithNibName:@"UnretinaViewController" bundle:nil];
viewController.view.bounds = self.view.bounds;
[view addSubview:viewController.view];
}
}

- (void)appication:(NSApplication*)sender openFile:(NSString*)file {
Expand Down