* BUG: Setting Printer.OutputFile now should automatically switch to the
  "print to a file" printer.


git-svn-id: svn://localhost/gambas/trunk@3466 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-01-17 22:41:29 +00:00
parent 9deaebf84d
commit 20a5a8e549

View File

@ -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);