mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Update the theme popup when the themes change
This commit is contained in:
parent
9db72e50e8
commit
e68e7420b8
@ -40,6 +40,10 @@ final class GeneralPreferencesViewController: NSViewController {
|
||||
updateUI()
|
||||
}
|
||||
|
||||
@objc func articleThemeNamesDidChangeNotification(_ note: Notification) {
|
||||
updateArticleThemePopup()
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@IBAction func articleThemePopUpDidChange(_ sender: Any) {
|
||||
@ -67,6 +71,7 @@ private extension GeneralPreferencesViewController {
|
||||
|
||||
func commonInit() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillBecomeActive(_:)), name: NSApplication.willBecomeActiveNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(articleThemeNamesDidChangeNotification(_:)), name: .ArticleThemeNamesDidChangeNotification, object: nil)
|
||||
}
|
||||
|
||||
func updateUI() {
|
||||
@ -86,6 +91,9 @@ private extension GeneralPreferencesViewController {
|
||||
}
|
||||
|
||||
articleThemePopup.selectItem(withTitle: ArticleThemesManager.shared.currentThemeName)
|
||||
if articleThemePopup.indexOfSelectedItem == -1 {
|
||||
articleThemePopup.selectItem(withTitle: ArticleTheme.defaultTheme.name)
|
||||
}
|
||||
}
|
||||
|
||||
func updateBrowserPopup() {
|
||||
|
@ -81,6 +81,8 @@ final class ArticleThemesManager {
|
||||
}
|
||||
|
||||
try FileManager.default.copyItem(atPath: filename, toPath: toFilename)
|
||||
|
||||
updateThemeNames()
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
|
Loading…
Reference in New Issue
Block a user