diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index e690744..5f5ba3d 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -38,7 +38,10 @@ class ParentPanelController: NSWindowController { private var note: NotesPopover? - private lazy var oneWindow = OneWindowController.shared() + private lazy var oneWindow: OneWindowController? = { + let preferencesStoryboard = NSStoryboard(name: "Preferences", bundle: nil) + return preferencesStoryboard.instantiateInitialController() as? OneWindowController + }() @IBOutlet var mainTableView: PanelTableView! @@ -625,7 +628,7 @@ class ParentPanelController: NSWindowController { } private func openPreferences() { - oneWindow.showWindow(nil) + oneWindow?.showWindow(nil) NSApp.activate(ignoringOtherApps: true) } @@ -653,7 +656,7 @@ class ParentPanelController: NSWindowController { } private func showPermissionsWindow() { - oneWindow.openPermissions() + oneWindow?.openPermissions() NSApp.activate(ignoringOtherApps: true) } diff --git a/Clocker/Preferences/Calendar/CalendarViewController.swift b/Clocker/Preferences/Calendar/CalendarViewController.swift index caee100..197c93d 100644 --- a/Clocker/Preferences/Calendar/CalendarViewController.swift +++ b/Clocker/Preferences/Calendar/CalendarViewController.swift @@ -136,8 +136,7 @@ class CalendarViewController: ParentViewController { @IBAction func grantAccess(_: Any) { if grantAccessButton.title == "Grant Access".localized() { - OneWindowController.shared().openPermissions() - NSApp.activate(ignoringOtherApps: true) + (parent as? CenteredTabViewController)?.selectedTabViewItemIndex = 3 // 3 is the Permissions View } else if grantAccessButton.title == "Launch Preferences" { NSWorkspace.shared.launchApplication("System Preferences") }