mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 22:30:49 +00:00
Attempts another draft of not inundating the user with open file dialogues.
This commit is contained in:
parent
114f81941e
commit
8489e8650f
@ -13,16 +13,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
// Insert code here to initialize your application.
|
// Insert code here to initialize your application.
|
||||||
|
|
||||||
if NSDocumentController.shared.documents.count == 0 {
|
|
||||||
NSDocumentController.shared.openDocument(self)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
// Insert code here to tear down your application.
|
// Insert code here to tear down your application.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var hasShownOpenDocument = false
|
||||||
func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
|
func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
|
||||||
// Decline to show the 'New...' selector by default; the 'Open...'
|
// Decline to show the 'New...' selector by default; the 'Open...'
|
||||||
// dialogue has already been shown if this application was started
|
// dialogue has already been shown if this application was started
|
||||||
@ -31,6 +28,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
// Obiter: I dislike it when other applications do this for me, but it
|
// Obiter: I dislike it when other applications do this for me, but it
|
||||||
// seems to be the new norm, and I've had user feedback that showing
|
// seems to be the new norm, and I've had user feedback that showing
|
||||||
// nothing is confusing. So here it is.
|
// nothing is confusing. So here it is.
|
||||||
|
if !hasShownOpenDocument {
|
||||||
|
NSDocumentController.shared.openDocument(self)
|
||||||
|
hasShownOpenDocument = true
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user