Revert toolbar item updating

This commit is contained in:
Nate Weaver 2020-05-21 05:21:54 -05:00
parent 40b68f6ec6
commit 41d96be8b4
3 changed files with 0 additions and 41 deletions

View File

@ -11,7 +11,6 @@ import UserNotifications
import Articles
import Account
import RSCore
import RSWeb
enum TimelineSourceMode {
case regular, search
@ -90,12 +89,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(defaultBrowserDidChange(_:)), name: .DefaultBrowserDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(defaultBrowserDidChange(_:)), name: NSApplication.willBecomeActiveNotification, object: nil)
DispatchQueue.main.async {
self.updateWindowTitle()
self.updateOpenInBrowserToolbarItem()
}
}
@ -173,40 +168,6 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
}
func updateOpenInBrowserToolbarItem() {
guard let item = self.window?.toolbar?.items.first(where: { $0.action == #selector(openArticleInBrowser(_:)) }) else {
return
}
guard let button = item.view as? NSButton else { return }
var browserName = NSLocalizedString("Browser", comment: "Browser")
var icon = NSImage(named: "openInBrowser")!
var currentBrowser: MacWebBrowser?
if let browserID = AppDefaults.defaultBrowserID {
currentBrowser = MacWebBrowser(bundleIdentifier: browserID)
} else {
currentBrowser = MacWebBrowser.default
}
if let currentBrowser = currentBrowser {
icon = currentBrowser.icon!
icon.size = NSSize(width: 16.0, height: 16.0)
browserName = currentBrowser.name!
}
button.image = icon
let format = NSLocalizedString("Open in %@", comment: "Open in Browser toolbar item tooltip format")
item.toolTip = String(format: format, browserName)
}
@objc func defaultBrowserDidChange(_ note: Notification?) {
updateOpenInBrowserToolbarItem()
}
// MARK: - Toolbar
@objc func makeToolbarValidate() {

View File

@ -56,7 +56,6 @@ final class GeneralPreferencesViewController: NSViewController {
}
let bundleID = menuItem.representedObject as? String
AppDefaults.defaultBrowserID = bundleID
NotificationCenter.default.post(name: .DefaultBrowserDidChange, object: nil)
updateUI()
}
}

View File

@ -12,7 +12,6 @@ import Articles
extension Notification.Name {
static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification")
static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification")
static let DefaultBrowserDidChange = Notification.Name("DefaultBrowserDidChangeNotification")
#if !MAC_APP_STORE
static let WebInspectorEnabledDidChange = Notification.Name("WebInspectorEnabledDidChange")