diff --git a/Passepartout/App/macOS/Base.lproj/Main.storyboard b/Passepartout/App/macOS/Base.lproj/Main.storyboard index 9b6ff5b6..f1eddc16 100644 --- a/Passepartout/App/macOS/Base.lproj/Main.storyboard +++ b/Passepartout/App/macOS/Base.lproj/Main.storyboard @@ -10,7 +10,7 @@ - + diff --git a/Passepartout/App/macOS/Base.lproj/Preferences.storyboard b/Passepartout/App/macOS/Base.lproj/Preferences.storyboard index 121ea3c0..a9cb1a26 100644 --- a/Passepartout/App/macOS/Base.lproj/Preferences.storyboard +++ b/Passepartout/App/macOS/Base.lproj/Preferences.storyboard @@ -1,5 +1,5 @@ - + @@ -383,6 +383,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Passepartout/App/macOS/Global/SwiftGen+Scenes.swift b/Passepartout/App/macOS/Global/SwiftGen+Scenes.swift index 6dbef7e8..3a9b4028 100644 --- a/Passepartout/App/macOS/Global/SwiftGen+Scenes.swift +++ b/Passepartout/App/macOS/Global/SwiftGen+Scenes.swift @@ -22,7 +22,9 @@ internal enum StoryboardScene { internal enum Preferences: StoryboardType { internal static let storyboardName = "Preferences" - internal static let initialScene = InitialSceneType(storyboard: Preferences.self) + internal static let initialScene = InitialSceneType(storyboard: Preferences.self) + + internal static let preferencesWindowController = SceneType(storyboard: Preferences.self, identifier: "PreferencesWindowController") } internal enum Purchase: StoryboardType { internal static let storyboardName = "Purchase" diff --git a/Passepartout/App/macOS/Global/WindowManager.swift b/Passepartout/App/macOS/Global/WindowManager.swift index a9a363f3..e53533ae 100644 --- a/Passepartout/App/macOS/Global/WindowManager.swift +++ b/Passepartout/App/macOS/Global/WindowManager.swift @@ -31,24 +31,22 @@ class WindowManager: NSObject { private var organizer: NSWindowController? -// private var preferences: NSWindowController? + private var preferences: NSWindowController? private override init() { } @discardableResult func showOrganizer() -> NSWindowController? { organizer = presentWindowController(StoryboardScene.Main.organizerWindowController, existing: organizer) + organizer?.window?.title = "Passepartout" return organizer } -// @discardableResult func showPreferences() -> NSWindowController? { -// preferences = presentWindowController( -// StoryboardScene.Preferences.initialScene.instantiate(), -// existing: preferences, -// title: L10n.App.Preferences.title -// ) -// return preferences -// } + @discardableResult func showPreferences() -> NSWindowController? { + preferences = presentWindowController(StoryboardScene.Preferences.preferencesWindowController, existing: preferences) + preferences?.window?.title = L10n.App.Preferences.title + return preferences + } func showAbout() { NSApp.orderFrontStandardAboutPanel(nil) diff --git a/Passepartout/App/macOS/Menu/MainMenu.swift b/Passepartout/App/macOS/Menu/MainMenu.swift index 4993669c..a21fb595 100644 --- a/Passepartout/App/macOS/Menu/MainMenu.swift +++ b/Passepartout/App/macOS/Menu/MainMenu.swift @@ -27,8 +27,6 @@ import Cocoa class MainMenu: NSObject { @IBAction private func showPreferences(_ sender: Any?) { - let organizer = WindowManager.shared.showOrganizer() - let preferences = StoryboardScene.Preferences.initialScene.instantiate() - organizer?.contentViewController?.presentAsModalWindow(preferences) + WindowManager.shared.showPreferences() } } diff --git a/Passepartout/App/macOS/Menu/StatusMenu.swift b/Passepartout/App/macOS/Menu/StatusMenu.swift index 6571b08f..e2f779ff 100644 --- a/Passepartout/App/macOS/Menu/StatusMenu.swift +++ b/Passepartout/App/macOS/Menu/StatusMenu.swift @@ -395,9 +395,7 @@ class StatusMenu: NSObject { } @objc private func showPreferences() { - let organizer = WindowManager.shared.showOrganizer() - let preferences = StoryboardScene.Preferences.initialScene.instantiate() - organizer?.contentViewController?.presentAsModalWindow(preferences) + WindowManager.shared.showPreferences() } @objc private func switchActiveProfile(_ sender: Any?) { diff --git a/Passepartout/App/macOS/Scenes/Preferences/PreferencesViewController.swift b/Passepartout/App/macOS/Scenes/Preferences/PreferencesViewController.swift index 2a7a5b6b..47c808c4 100644 --- a/Passepartout/App/macOS/Scenes/Preferences/PreferencesViewController.swift +++ b/Passepartout/App/macOS/Scenes/Preferences/PreferencesViewController.swift @@ -32,7 +32,6 @@ class PreferencesViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() - title = L10n.App.Preferences.title let labels = [ L10n.App.Preferences.Sections.General.header, L10n.Core.Service.Sections.Diagnostics.header