Enable preferences toolbar to style itself for Big Sur

This commit is contained in:
Maurice Parker 2020-08-10 11:25:48 -05:00
parent 1c9b0feaaf
commit 7a7784eb75
4 changed files with 52 additions and 8 deletions

View File

@ -98,10 +98,6 @@ struct AppAssets {
return RSImage(named: "extensionPointTwitter")! return RSImage(named: "extensionPointTwitter")!
}() }()
static var extensionPreference: RSImage? = {
return RSImage(contentsOfFile: "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/KEXT.icns")
}()
static var faviconTemplateImage: RSImage = { static var faviconTemplateImage: RSImage = {
return RSImage(named: "faviconTemplateImage")! return RSImage(named: "faviconTemplateImage")!
}() }()
@ -146,6 +142,38 @@ struct AppAssets {
return NSImage(systemSymbolName: "safari", accessibilityDescription: nil)! 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, *) @available(macOS 10.16, *)
static var readClosedImage: RSImage = { static var readClosedImage: RSImage = {
return NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)! return NSImage(systemSymbolName: "largecircle.fill.circle", accessibilityDescription: nil)!

View File

@ -36,13 +36,13 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
var specs = [PreferencesToolbarItemSpec]() var specs = [PreferencesToolbarItemSpec]()
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.General, specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.General,
name: NSLocalizedString("General", comment: "Preferences"), name: NSLocalizedString("General", comment: "Preferences"),
image: NSImage(named: NSImage.preferencesGeneralName))] image: AppAssets.preferencesToolbarGeneralImage)]
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts, specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts,
name: NSLocalizedString("Accounts", comment: "Preferences"), name: NSLocalizedString("Accounts", comment: "Preferences"),
image: NSImage(named: NSImage.userAccountsName))] image: AppAssets.preferencesToolbarAccountsImage)]
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Extensions, specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Extensions,
name: NSLocalizedString("Extensions", comment: "Preferences"), name: NSLocalizedString("Extensions", comment: "Preferences"),
image: AppAssets.extensionPreference)] image: AppAssets.preferencesToolbarExtensionsImage)]
// Omit the Advanced Preferences for now because the Software Update related functionality is // 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 // 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 #if !MAC_APP_STORE
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced, specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced,
name: NSLocalizedString("Advanced", comment: "Preferences"), name: NSLocalizedString("Advanced", comment: "Preferences"),
image: NSImage(named: NSImage.advancedName))] image: AppAssets.preferencesToolbarAdvancedImage)]
#endif #endif
return specs return specs
}() }()

View File

@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "extensions.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}