Fix for at least one cause of MSC repeatedly displaying a 'Pending Updates' alert when attempting to quit the application

This commit is contained in:
Greg Neagle
2019-04-21 14:49:36 -07:00
parent af1cf640b4
commit 0010706cbd

View File

@@ -78,7 +78,7 @@ class MainWindowController: NSWindowController, NSWindowDelegate, WKNavigationDe
func currentPageIsUpdatesPage() -> Bool {
// return true if current tab selected is Updates
return updatesToolbarItem.isEnabled
return toolBarItemIsHighlighted(updatesToolbarItem)
}
func alertToPendingUpdates() {
@@ -148,6 +148,13 @@ class MainWindowController: NSWindowController, NSWindowDelegate, WKNavigationDe
cached_self_service = SelfService()
}
func toolBarItemIsHighlighted(_ item: NSToolbarItem) -> Bool {
if let button = item.view as? NSButton {
return (button.state == .on)
}
return false
}
func setHighlightFor(item: NSToolbarItem, doHighlight: Bool) {
if let button = item.view as? NSButton {
button.state = (doHighlight ? .on : .off)