     // Not NSTableViewDataSource, but related
 
 
-    func searchIncidents(incidents: [Incident]) -> [Incident] {
+    func searchIncidents(incidents incidents: [Incident], searchText: String) -> [Incident] {
         let searchText = self.searchText
 
         if searchText.characters.count == 0 {

    }


    var viewableIncidents: [Incident] {
        guard let stateFilterPopUp = stateFilterPopUp else {
            logError("No state filter popup?")
            return []
        }
        
        let selected = stateFilterPopUp.selectedTag()
        
        guard let filterTag = StateFilterTag(rawValue: selected) else {
            logError("Unknown filter tag: \(selected)")
            return []
        }
        
        let filteredIncidents: [Incident]
        
        switch filterTag {
            case .All   : filteredIncidents = filteredIncidentsCache.allIncidents
            case .Open  : filteredIncidents = filteredIncidentsCache.openIncidents
            case .Active: filteredIncidents = filteredIncidentsCache.activeIncidents
        }

        return searchIncidents(filteredIncidents)
    }


    @IBAction func updateViewedIncidents(sender: AnyObject?) {
        if let dispatchTable = self.dispatchTable {
            // Make sure UI stuff goes to the main thread



struct FilteredIncidentsCache {
    let allIncidents: [Incident]
    let openIncidents: [Incident]
    let activeIncidents: [Incident]
}



struct ViewableIncidentsCache {
    let searchText: String
    let filterTag: StateFilterTag
    let incidents: [Incident]
}


