Stuff…
This commit is contained in:
30
TagTunes/AppDelegate.swift
Normal file → Executable file
30
TagTunes/AppDelegate.swift
Normal file → Executable file
@@ -11,13 +11,43 @@ import Cocoa
|
||||
@NSApplicationMain
|
||||
internal class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
/// The app's unsorted tracks window. This should be initalized when the app
|
||||
/// launches.
|
||||
var unsortedTracksWindowController: NSWindowController!
|
||||
|
||||
/// The app's unsorted tracks controller.
|
||||
weak var unsortedTracksController: UnsortedTracksController!
|
||||
|
||||
internal func applicationDidFinishLaunching(aNotification: NSNotification) {
|
||||
Preferences.sharedPreferences.initializeDefaultValues()
|
||||
let storyboard = NSStoryboard(name: "Main", bundle: nil)
|
||||
unsortedTracksWindowController = storyboard.instantiateControllerWithIdentifier("unsortedTracksWindowController") as? NSWindowController
|
||||
unsortedTracksController.visible = true
|
||||
}
|
||||
|
||||
internal func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@IBAction func toggleUnsortedTracks(sender: AnyObject?) {
|
||||
unsortedTracksController.visible = !unsortedTracksController.visible
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NSApplication {
|
||||
|
||||
/// The app`s unsorted tracks controller. When a `UnsortedTracksController`
|
||||
/// is initialized it should this property to itself.
|
||||
///
|
||||
/// The value of this property is not retained.
|
||||
var unsortedTracksController: UnsortedTracksController! {
|
||||
set {
|
||||
(delegate as? AppDelegate)?.unsortedTracksController = newValue
|
||||
}
|
||||
get {
|
||||
return (delegate as? AppDelegate)?.unsortedTracksController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user