mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Update the theme popup when the themes change
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user