From 7a7784eb75668de183118c7b6c061edb9bd51b76 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 10 Aug 2020 11:25:48 -0500 Subject: [PATCH] Enable preferences toolbar to style itself for Big Sur --- Mac/AppAssets.swift | 36 ++++++++++++++++-- .../PreferencesWindowController.swift | 8 ++-- .../Contents.json | 16 ++++++++ .../extensions.pdf | Bin 0 -> 4041 bytes 4 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/Contents.json create mode 100644 Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/extensions.pdf diff --git a/Mac/AppAssets.swift b/Mac/AppAssets.swift index eb1e03336..a2201d631 100644 --- a/Mac/AppAssets.swift +++ b/Mac/AppAssets.swift @@ -98,10 +98,6 @@ struct AppAssets { return RSImage(named: "extensionPointTwitter")! }() - static var extensionPreference: RSImage? = { - return RSImage(contentsOfFile: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns") - }() - static var faviconTemplateImage: RSImage = { return RSImage(named: "faviconTemplateImage")! }() @@ -146,6 +142,38 @@ struct AppAssets { return NSImage(systemSymbolName: "safari", accessibilityDescription: nil)! }() + static var preferencesToolbarAccountsImage: RSImage = { + if #available(macOS 10.16, *) { + return NSImage(systemSymbolName: "at", accessibilityDescription: nil)! + } else { + return NSImage(named: NSImage.userAccountsName)! + } + }() + + static var preferencesToolbarExtensionsImage: RSImage = { + if #available(macOS 10.16, *) { + return NSImage(named: "preferencesToolbarExtensions")! + } else { + return NSImage(contentsOfFile: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns")! + } + }() + + static var preferencesToolbarGeneralImage: RSImage = { + if #available(macOS 10.16, *) { + return NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)! + } else { + return NSImage(named: NSImage.preferencesGeneralName)! + } + }() + + static var preferencesToolbarAdvancedImage: RSImage = { + if #available(macOS 10.16, *) { + return NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)! + } else { + return NSImage(named: NSImage.advancedName)! + } + }() + @available(macOS 10.16, *) static var readClosedImage: RSImage = { return NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)! diff --git a/Mac/Preferences/PreferencesWindowController.swift b/Mac/Preferences/PreferencesWindowController.swift index 143425ce5..738aa5d81 100644 --- a/Mac/Preferences/PreferencesWindowController.swift +++ b/Mac/Preferences/PreferencesWindowController.swift @@ -36,13 +36,13 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate { var specs = [PreferencesToolbarItemSpec]() specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.General, name: NSLocalizedString("General", comment: "Preferences"), - image: NSImage(named: NSImage.preferencesGeneralName))] + image: AppAssets.preferencesToolbarGeneralImage)] specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts, name: NSLocalizedString("Accounts", comment: "Preferences"), - image: NSImage(named: NSImage.userAccountsName))] + image: AppAssets.preferencesToolbarAccountsImage)] specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Extensions, name: NSLocalizedString("Extensions", comment: "Preferences"), - image: AppAssets.extensionPreference)] + image: AppAssets.preferencesToolbarExtensionsImage)] // Omit the Advanced Preferences for now because the Software Update related functionality is // forbidden/non-applicable, and we can rely upon Apple to some extent for crash reports. We @@ -51,7 +51,7 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate { #if !MAC_APP_STORE specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced, name: NSLocalizedString("Advanced", comment: "Preferences"), - image: NSImage(named: NSImage.advancedName))] + image: AppAssets.preferencesToolbarAdvancedImage)] #endif return specs }() diff --git a/Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/Contents.json b/Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/Contents.json new file mode 100644 index 000000000..86f387514 --- /dev/null +++ b/Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "filename" : "extensions.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" + } +} diff --git a/Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/extensions.pdf b/Mac/Resources/Assets.xcassets/preferencesToolbarExtensions.imageset/extensions.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c153795686b39965184ecf0d824343746c68d210 GIT binary patch literal 4041 zcmai%c{r49`^PO)7(!)pOZ&dNktGQBnswfnc0|G%-?+4 z)6xbO1)zW{+5s#j1qiF)od`HL(%%V1z$xJ{u2>u(tci26BiI9CA|il{4A`CEhC?}n zy~(u7@rD)s9xtz(q|l`Q-Cy)1@(u41RS zvo!e@ZrQRqTmmjsY&rZ-Hp!VpmD!EDQ~B#kHkz*1sOS4BV#6I*)Z-^pZULkI2G!+0 z&USYFLt4`A8Y(p?r>D%uix(1ld!P6%Xj{sMB$Yw(!yO{Qg!DHKLI<0`;%Dv)4M5H# zxOk^0Ti41dC;xk3ma5z%kjr%O8gS`_;gilve*W;*Ps|an>OD4PK%hLId(veXpI`Ae zd#P_MKF-tr_^NL+E9ZmMYUg85jac4_XfZC*jzwsNm+P!e)Q z;RYGyjm`KUlM7LI`gS;la}ShXrVnY2gZ&)tBQ1m40#dMtp5!(GWaWMQFD18oe5tn7 z>c38LvJSQNf^ja`zXT(Vj#Y;JrnaHaO_IF2D7&9uH=GLr5Ft(L1H$?^cUKQL49*=8 z`!k^E>OvsRy938=(LeUVU-gdXf4N83%@t#SBLL>4qDm@&B_OQm>g4KXa1({W0mt@I zbcX@(zY6?TL;SZI+N2$X<&RzHLb4zrtc3H#V{rONg@5}{L>wma|2y?}ccwk^GBg-w z2_x1@)b^a=0(iFAeQAIX*HxK8df{q;x)h~kV8zyXRLC9StivI7l(kUs=RNKn8SA+twH6sG`x)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