From 0010706cbdf7b4af7fd995ea856bca3c2181941f Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Sun, 21 Apr 2019 14:49:36 -0700 Subject: [PATCH] Fix for at least one cause of MSC repeatedly displaying a 'Pending Updates' alert when attempting to quit the application --- .../Controllers/MainWindowController.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift b/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift index a212d0cd..a625b371 100644 --- a/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift +++ b/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift @@ -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)