diff --git a/MeetingBar/AppDelegate.swift b/MeetingBar/AppDelegate.swift index 23985776..b59915be 100644 --- a/MeetingBar/AppDelegate.swift +++ b/MeetingBar/AppDelegate.swift @@ -148,6 +148,13 @@ class AppDelegate: NSObject, NSApplicationDelegate { return } } + + + @objc func clickOnEvent(sender: NSMenuItem) { + NSLog("Click on event (\(sender.title))!") + let event: EKEvent = sender.representedObject as! EKEvent + openEvent(event) + } @objc func openPrefecencesWindow(_: NSStatusBarButton?) { NSLog("Open preferences window") diff --git a/MeetingBar/StatusBarItemControler.swift b/MeetingBar/StatusBarItemControler.swift index f5c1e6cc..9af9ea12 100644 --- a/MeetingBar/StatusBarItemControler.swift +++ b/MeetingBar/StatusBarItemControler.swift @@ -136,7 +136,7 @@ class StatusBarItemControler { let itemTitle = "\(eventStartTime) - \(eventTitle)" let eventItem = self.item.menu!.addItem( withTitle: itemTitle, - action: #selector(StatusBarItemControler.clickOnEvent(sender:)), + action: #selector(AppDelegate.clickOnEvent(sender:)), keyEquivalent: "") let eventStatus = getEventStatus(event) if eventStatus != nil { @@ -291,12 +291,6 @@ class StatusBarItemControler { action: #selector(AppDelegate.quit), keyEquivalent: "") } - - @objc func clickOnEvent(sender: NSMenuItem) { - NSLog("Click on event (\(sender.title))!") - let event: EKEvent = sender.representedObject as! EKEvent - openEvent(event) - } } func createEventStatusString(_ event: EKEvent) -> String {