void PrinterListView::_AddPrinter(BDirectory& printer, bool calculateLayout) { BString state; node_ref node; // If the entry is a directory if (printer.InitCheck() == B_OK && printer.GetNodeRef(&node) == B_OK && _FindItem(&node) == NULL && printer.ReadAttrString(PSRV_PRINTER_ATTR_STATE, &state) == B_OK && state == "free") { // Check it's Mime type for a spool director BNodeInfo info(&printer); char buffer[256]; if (info.GetType(buffer) == B_OK && strcmp(buffer, PSRV_PRINTER_FILETYPE) == 0) { // Yes, it is a printer definition node AddItem(new PrinterItem(static_cast<PrintersWindow*>(Window()), printer, fLayoutData)); if (calculateLayout) _LayoutPrinterItems(); } } }