Check whether a resolution has been set in GtkPrintSettings

If resolution has not been set then use default resolution from ppd.

https://bugzilla.gnome.org/show_bug.cgi?id=635254
This commit is contained in:
Marek Kasik 2010-11-19 10:55:25 +01:00 committed by Matthias Clasen
parent 1876823ef0
commit 9a0700e20c

View File

@ -4090,6 +4090,11 @@ set_option_from_settings (GtkPrinterOption *option,
if (cups_value) if (cups_value)
gtk_printer_option_set (option, cups_value); gtk_printer_option_set (option, cups_value);
else else
{
if (gtk_print_settings_get_int_with_default (settings, GTK_PRINT_SETTINGS_RESOLUTION, -1) != -1 ||
gtk_print_settings_get_int_with_default (settings, GTK_PRINT_SETTINGS_RESOLUTION_X, -1) != -1 ||
gtk_print_settings_get_int_with_default (settings, GTK_PRINT_SETTINGS_RESOLUTION_Y, -1) != -1 ||
option->value == NULL || option->value[0] == '\0')
{ {
int res = gtk_print_settings_get_resolution (settings); int res = gtk_print_settings_get_resolution (settings);
int res_x = gtk_print_settings_get_resolution_x (settings); int res_x = gtk_print_settings_get_resolution_x (settings);
@ -4109,6 +4114,7 @@ set_option_from_settings (GtkPrinterOption *option,
} }
} }
} }
}
else if (strcmp (option->name, "gtk-paper-type") == 0) else if (strcmp (option->name, "gtk-paper-type") == 0)
map_settings_to_option (option, media_type_map, G_N_ELEMENTS (media_type_map), map_settings_to_option (option, media_type_map, G_N_ELEMENTS (media_type_map),
settings, GTK_PRINT_SETTINGS_MEDIA_TYPE, "MediaType"); settings, GTK_PRINT_SETTINGS_MEDIA_TYPE, "MediaType");