From 3060c3f1000454d17f6a26d3e84f403c08ca2fea Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Wed, 19 Aug 2009 16:55:28 -0700 Subject: [PATCH] Add delegate method to prevent automatically opening a new document on launch in document based applications. Reviewed by me. --- AppKit/CPApplication.j | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 901fca539..423baacbf 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -268,8 +268,13 @@ CPRunContinuesResponse = -1002; [defaultCenter postNotificationName:CPApplicationWillFinishLaunchingNotification object:self]; - - if (_documentController) + + var needsUntitled = !!_documentController; + + if (needsUntitled && [_delegate respondsToSelector: @selector(applicationShouldOpenUntitledFile:)]) + needsUntitled = [_delegate applicationShouldOpenUntitledFile:self]; + + if (needsUntitled) [_documentController newDocument:self]; [defaultCenter