printdialog: fix sporadic win32 build failures

Private function `gtk_print_setup_get_printer` unconditionally calls
`gtk_printer_find()`, which does not exist on Win32.

But `gtk_print_setup_get_printer()` is never called either, so usually
that whole code gets optimized out.

Some compilation environment however do not cleanup unused functions,
leading to linker error as `gtk_printer_find()` is not found.

This patch should solve the link issue.
This commit is contained in:
g.willems 2024-07-15 23:05:13 +02:00
parent 86e735cd5c
commit 4fa661b450

View File

@ -188,6 +188,7 @@ gtk_print_setup_set_page_setup (GtkPrintSetup *setup,
static GtkPrinter *
gtk_print_setup_get_printer (GtkPrintSetup *setup)
{
#ifdef HAVE_GIO_UNIX
if (!setup->printer)
{
const char *name = NULL;
@ -198,6 +199,7 @@ gtk_print_setup_get_printer (GtkPrintSetup *setup)
if (name)
setup->printer = gtk_printer_find (name);
}
#endif
return setup->printer;
}
@ -1674,8 +1676,8 @@ gtk_print_dialog_print_file (GtkPrintDialog *self,
#ifdef HAVE_GIO_UNIX
PrintTaskData *ptd;
GFileInputStream *content;
#endif
GError *error = NULL;
#endif
g_return_if_fail (GTK_IS_PRINT_DIALOG (self));
g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));