Skip to content

Commit

Permalink
Replace or annotate remaining NSImageName strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Eitot committed Jul 3, 2024
1 parent 5acc49d commit c0be533
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 7 additions & 1 deletion Vienna/Sources/Application/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,13 @@ - (void)initScriptsMenu {
}

scriptsMenuItem = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""];
scriptsMenuItem.image = [NSImage imageNamed:@"NSScriptTemplate"];
if (@available(macOS 11, *)) {
scriptsMenuItem.image = [NSImage imageWithSystemSymbolName:@"applescript.fill"
accessibilityDescription:nil];
} else {
// This image is available in AppKit, but not as a constant.
scriptsMenuItem.image = [NSImage imageNamed:@"NSScriptTemplate"];
}

NSInteger helpMenuIndex = NSApp.mainMenu.numberOfItems - 1;
[NSApp.mainMenu insertItem:scriptsMenuItem atIndex:helpMenuIndex];
Expand Down
4 changes: 3 additions & 1 deletion Vienna/Sources/Main window/ArticleListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ -(void)showSortDirection

for (NSTableColumn * column in articleList.tableColumns) {
if ([column.identifier isEqualToString:sortColumnIdentifier]) {
NSString * imageName = ([[Preferences standardPreferences].articleSortDescriptors[0] ascending]) ? @"NSAscendingSortIndicator" : @"NSDescendingSortIndicator";
// These NSImage names are available in AppKit, but not as constants.
// https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKitOlderNotes/
NSImageName imageName = ([Preferences.standardPreferences.articleSortDescriptors[0] ascending]) ? @"NSAscendingSortIndicator" : @"NSDescendingSortIndicator";
articleList.highlightedTableColumn = column;
[articleList setIndicatorImage:[NSImage imageNamed:imageName] inTableColumn:column];
} else {
Expand Down
12 changes: 6 additions & 6 deletions Vienna/Sources/Preferences window/PreferenceTabViewItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class PreferenceTabViewItem: NSTabViewItem {
}

switch identifier as? String {
case .some("general"):
image = NSImage(named: "NSPreferencesGeneral")
case .some("updates"):
image = NSImage(named: "NSNetwork")
case .some("advanced"):
image = NSImage(named: "NSAdvanced")
case "general":
image = NSImage(named: NSImage.preferencesGeneralName)
case "updates":
image = NSImage(named: NSImage.networkName)
case "advanced":
image = NSImage(named: NSImage.advancedName)
default:
return
}
Expand Down

0 comments on commit c0be533

Please sign in to comment.