|
|
@ -5,17 +5,25 @@ import EventKit |
|
|
|
|
|
|
|
|
|
|
|
class ClockerTextBackgroundView: NSView { |
|
|
|
class ClockerTextBackgroundView: NSView { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var themeDidChangeNotification: NSObjectProtocol? |
|
|
|
|
|
|
|
|
|
|
|
override func awakeFromNib() { |
|
|
|
override func awakeFromNib() { |
|
|
|
wantsLayer = true |
|
|
|
wantsLayer = true |
|
|
|
layer?.cornerRadius = 8.0 |
|
|
|
layer?.cornerRadius = 8.0 |
|
|
|
layer?.masksToBounds = false |
|
|
|
layer?.masksToBounds = false |
|
|
|
layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
|
layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
|
|
|
|
|
|
|
|
|
NotificationCenter.default.addObserver(forName: .themeDidChangeNotification, object: nil, queue: OperationQueue.main) { (_) in |
|
|
|
themeDidChangeNotification = NotificationCenter.default.addObserver(forName: .themeDidChangeNotification, object: nil, queue: OperationQueue.main) { (_) in |
|
|
|
self.layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
|
self.layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deinit { |
|
|
|
|
|
|
|
if let themeDidChangeNotif = themeDidChangeNotification { |
|
|
|
|
|
|
|
NotificationCenter.default.removeObserver(themeDidChangeNotif) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override func updateLayer() { |
|
|
|
override func updateLayer() { |
|
|
|
super.updateLayer() |
|
|
|
super.updateLayer() |
|
|
|
layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
|
layer?.backgroundColor = Themer.shared().textBackgroundColor().cgColor |
|
|
@ -35,6 +43,7 @@ class CalendarViewController: ParentViewController { |
|
|
|
@IBOutlet weak var showNextMeetingInMenubarControl: NSSegmentedControl! |
|
|
|
@IBOutlet weak var showNextMeetingInMenubarControl: NSSegmentedControl! |
|
|
|
@IBOutlet weak var backgroundView: NSView! |
|
|
|
@IBOutlet weak var backgroundView: NSView! |
|
|
|
@IBOutlet weak var nextMeetingBackgroundView: NSView! |
|
|
|
@IBOutlet weak var nextMeetingBackgroundView: NSView! |
|
|
|
|
|
|
|
private var themeDidChangeNotification: NSObjectProtocol? |
|
|
|
|
|
|
|
|
|
|
|
private lazy var calendars: [Any] = EventCenter.sharedCenter().fetchSourcesAndCalendars() |
|
|
|
private lazy var calendars: [Any] = EventCenter.sharedCenter().fetchSourcesAndCalendars() |
|
|
|
|
|
|
|
|
|
|
@ -48,7 +57,7 @@ class CalendarViewController: ParentViewController { |
|
|
|
name: .calendarAccessGranted, |
|
|
|
name: .calendarAccessGranted, |
|
|
|
object: nil) |
|
|
|
object: nil) |
|
|
|
|
|
|
|
|
|
|
|
NotificationCenter.default.addObserver(forName: .themeDidChangeNotification, object: nil, queue: OperationQueue.main) { (_) in |
|
|
|
themeDidChangeNotification = NotificationCenter.default.addObserver(forName: .themeDidChangeNotification, object: nil, queue: OperationQueue.main) { (_) in |
|
|
|
self.setup() |
|
|
|
self.setup() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -57,6 +66,12 @@ class CalendarViewController: ParentViewController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deinit { |
|
|
|
|
|
|
|
if let themeDidChangeNotif = themeDidChangeNotification { |
|
|
|
|
|
|
|
NotificationCenter.default.removeObserver(themeDidChangeNotif) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc func calendarAccessStatusChanged() { |
|
|
|
@objc func calendarAccessStatusChanged() { |
|
|
|
verifyCalendarAccess() |
|
|
|
verifyCalendarAccess() |
|
|
|
|
|
|
|
|
|
|
|