diff --git a/gb.gtk/src/gprinter.cpp b/gb.gtk/src/gprinter.cpp index c54e9419c..e8f00f1e4 100644 --- a/gb.gtk/src/gprinter.cpp +++ b/gb.gtk/src/gprinter.cpp @@ -109,6 +109,10 @@ static gboolean find_default_printer(GtkPrinter *gtk_printer, gPrinter *printer) if (gtk_printer_is_default(gtk_printer)) { + #if DEBUG_ME + fprintf(stderr, "find_default_printer: %s\n", gtk_printer_get_name(gtk_printer)); + #endif + printer->setName(gtk_printer_get_name(gtk_printer)); return TRUE; } @@ -116,6 +120,21 @@ static gboolean find_default_printer(GtkPrinter *gtk_printer, gPrinter *printer) return FALSE; } +static gboolean find_file_printer(GtkPrinter *gtk_printer, gPrinter *printer) +{ + if (gtk_printer_get_capabilities(gtk_printer) == 0) // heuristic + { + #if DEBUG_ME + fprintf(stderr, "find_file_printer: %s\n", gtk_printer_get_name(gtk_printer)); + #endif + + printer->setName(gtk_printer_get_name(gtk_printer)); + return TRUE; + } + + return FALSE; +} + gPrinter::gPrinter() { _operation = NULL; @@ -512,6 +531,8 @@ void gPrinter::setOutputFileName(const char *file) else format = NULL; + gtk_enumerate_printers((GtkPrinterFunc)find_file_printer, this, NULL, TRUE); + gtk_print_settings_set(_settings, GTK_PRINT_SETTINGS_OUTPUT_URI, uri); g_free(uri);