Skip to content

Commit

Permalink
Remove “Show Filename Extensions” option
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Aug 16, 2024
1 parent a6b9882 commit 6c63f78
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 55 deletions.
29 changes: 0 additions & 29 deletions CotEditor/Localizables/Document.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -4680,35 +4680,6 @@
}
}
},
"Show Filename Extensions" : {
"comment" : "menu item label (Check how Apple translates the term “filename extension.”)",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Dateinamensuffixe einblenden"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "Show Filename Extensions"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "ファイル名拡張子を表示"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "파일 확장자 보기"
}
}
}
},
"Show Hidden Files" : {
"comment" : "menu item label",
"localizations" : {
Expand Down
1 change: 0 additions & 1 deletion CotEditor/Sources/DefaultKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ extension DefaultKeys {

// file browser
static let fileBrowserShowsHiddenFiles = DefaultKey<Bool>("fileBrowserShowsHiddenFiles")
static let fileBrowserShowsFilenameExtensions = DefaultKey<Bool>("fileBrowserShowsFilenameExtensions")

// settings that are not in the Settings window
static let pinsThemeAppearance = DefaultKey<Bool>("pinsThemeAppearance")
Expand Down
1 change: 0 additions & 1 deletion CotEditor/Sources/DefaultSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ struct DefaultSettings {

// file browser
.fileBrowserShowsHiddenFiles: false,
.fileBrowserShowsFilenameExtensions: true,

// settings not in the Settings window
.pinsThemeAppearance: false,
Expand Down
25 changes: 1 addition & 24 deletions CotEditor/Sources/FileBrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
contextMenu.items = [
NSMenuItem(title: String(localized: "Show in Finder", table: "Document", comment: "menu item label"),
action: #selector(showInFinder), keyEquivalent: ""),
.separator(),

NSMenuItem(title: String(localized: "Open with External Editor", table: "Document", comment: "menu item label"),
action: #selector(openWithExternalEditor), keyEquivalent: ""),
NSMenuItem(title: String(localized: "Open in New Window", table: "Document", comment: "menu item label"),
Expand All @@ -125,8 +123,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
action: #selector(moveToTrash), keyEquivalent: ""),
.separator(),

NSMenuItem(title: String(localized: "Show Filename Extensions", table: "Document", comment: "menu item label (Check how Apple translates the term “filename extension.”)"),
action: #selector(toggleFilenameExtensionVisibility), keyEquivalent: ""),
NSMenuItem(title: String(localized: "Show Hidden Files", table: "Document", comment: "menu item label"),
action: #selector(toggleHiddenFileVisibility), keyEquivalent: ""),
]
Expand Down Expand Up @@ -161,8 +157,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
self.defaultObservers = [
UserDefaults.standard.publisher(for: .fileBrowserShowsHiddenFiles)
.sink { [unowned self] _ in self.outlineView.reloadData() },
UserDefaults.standard.publisher(for: .fileBrowserShowsFilenameExtensions)
.sink { [unowned self] _ in self.outlineView.reloadData() },
]
}

Expand Down Expand Up @@ -196,9 +190,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
menuItem.isHidden = self.clickedNode == nil
return self.clickedNode?.isWritable == true

case #selector(toggleFilenameExtensionVisibility):
menuItem.state = self.showsFilenameExtensions ? .on : .off

case #selector(toggleHiddenFileVisibility):
menuItem.state = self.showsHiddenFiles ? .on : .off

Expand Down Expand Up @@ -293,12 +284,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {
}


@IBAction func toggleFilenameExtensionVisibility(_ sender: Any?) {

self.showsFilenameExtensions.toggle()
}


@IBAction func toggleHiddenFileVisibility(_ sender: Any?) {

self.showsHiddenFiles.toggle()
Expand All @@ -307,14 +292,6 @@ final class FileBrowserViewController: NSViewController, NSMenuItemValidation {

// MARK: Private Methods

/// Whether displaying the filename extensions.
private var showsFilenameExtensions: Bool {

get { UserDefaults.standard[.fileBrowserShowsFilenameExtensions] }
set { UserDefaults.standard[.fileBrowserShowsFilenameExtensions] = newValue }
}


/// Whether displaying hidden files.
private var showsHiddenFiles: Bool {