 import Alamofire
 
 @NSApplicationMain
-class AppDelegate: NSObject, NSApplicationDelegate {
+class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
 
 	// Settings window
 	@IBOutlet weak var settingsWindow: NSView!


	var updateTime = 1		// how often in minutes the app calls update()

	var notificationSet = false
	var notificationTime = NSDate()

	let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1)

	}

	func connectionSelected(sender: ConnectionMenuItem) {
//		NSLog("Set a notification for \(sender.connection.toString())")
		notificationTime = NSDate(timeInterval: NSTimeInterval(-15 * 60), sinceDate: sender.connection.arrivalTime)

		// register notification to be sent at time of notification
		let notification = NSUserNotification()
		notification.title = "Catch your bus!"
		notification.informativeText = "Your bus is leaving soon."
		notification.deliveryDate = notificationTime
		NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification(notification)

		// this is temporary for now, ConnectionManager will have to able to track
		// connections for this to be a viable option
		sender.state = NSOnState
