summaryrefslogtreecommitdiffstats
path: root/printing/backend
diff options
context:
space:
mode:
Diffstat (limited to 'printing/backend')
-rw-r--r--printing/backend/print_backend_cups.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc
index 9b6976c..8578a7c 100644
--- a/printing/backend/print_backend_cups.cc
+++ b/printing/backend/print_backend_cups.cc
@@ -156,10 +156,11 @@ bool PrintBackendCUPS::EnumeratePrinters(PrinterList* printer_list) {
}
std::string PrintBackendCUPS::GetDefaultPrinterName() {
- // TODO(thestig) Figure out why cupsGetDefault() lies about the default
- // printer. :-(
- // Return an empty string for now.
- return std::string();
+ // Not using cupsGetDefault() because it lies about the default printer.
+ cups_dest_t* dests;
+ int num_dests = GetDests(&dests);
+ cups_dest_t* dest = cupsGetDest(NULL, NULL, num_dests, dests);
+ return dest ? std::string(dest->name) : std::string();
}
bool PrintBackendCUPS::GetPrinterCapsAndDefaults(