Skip to content

Commit

Permalink
Reoder code in FileBrowserViewController.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Jan 7, 2025
1 parent 062a362 commit d0f6f2e
Showing 1 changed file with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ import Defaults
import ControlUI
import URLUtils

/// Column identifiers for outline view.
private extension NSUserInterfaceItemIdentifier {

static let node = NSUserInterfaceItemIdentifier("node")
}


final class FileBrowserViewController: NSViewController, NSMenuItemValidation {

let document: DirectoryDocument
Expand Down Expand Up @@ -815,8 +808,7 @@ extension FileBrowserViewController: NSOutlineViewDelegate {
let cellView = outlineView.makeView(withIdentifier: .node, owner: self) as? FileBrowserTableCellView ?? .init()
cellView.textField?.delegate = self

cellView.imageView!.image = node.kind.image
cellView.imageView!.setAccessibilityLabel(node.kind.label)
cellView.imageView!.image = NSImage(systemSymbolName: node.kind.symbolName, accessibilityDescription: node.kind.label)!
cellView.imageView!.alphaValue = node.isHidden ? 0.5 : 1
cellView.isAlias = node.isAlias

Expand Down Expand Up @@ -928,7 +920,15 @@ extension FileBrowserViewController: NSTextFieldDelegate {

// MARK: -

final class FileBrowserTableCellView: NSTableCellView {
/// Column identifiers for outline view.
private extension NSUserInterfaceItemIdentifier {

static let node = NSUserInterfaceItemIdentifier("node")
}



private final class FileBrowserTableCellView: NSTableCellView {

var isAlias: Bool = false { didSet { self.aliasArrowView?.isHidden = !isAlias } }

Expand Down Expand Up @@ -995,15 +995,3 @@ final class FileBrowserTableCellView: NSTableCellView {
])
}
}


// MARK: - Extensions

private extension FileNode.Kind {

/// The symbol image in `NSImage`.
var image: NSImage {

NSImage(systemSymbolName: self.symbolName, accessibilityDescription: self.label)!
}
}

0 comments on commit d0f6f2e

Please sign in to comment.