diff options
author | Marek Kasik <mkasik@redhat.com> | 2010-11-19 10:55:25 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2011-03-21 11:11:09 -0400 |
commit | 9a0700e20ce39a6f6cb96036a88919f37143295d (patch) | |
tree | 59fe1ac3187d623c0002907614f0d5deed03197e /modules/printbackends | |
parent | 1876823ef0f1c25e7308b564ecd72da995006d92 (diff) | |
download | gtk+-9a0700e20ce39a6f6cb96036a88919f37143295d.tar.gz |
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
Diffstat (limited to 'modules/printbackends')
-rw-r--r-- | modules/printbackends/cups/gtkprintbackendcups.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 614e752060..2e1e1a9da8 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -4091,23 +4091,29 @@ set_option_from_settings (GtkPrinterOption *option, gtk_printer_option_set (option, cups_value); else { - int res = gtk_print_settings_get_resolution (settings); - int res_x = gtk_print_settings_get_resolution_x (settings); - int res_y = gtk_print_settings_get_resolution_y (settings); + 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_x = gtk_print_settings_get_resolution_x (settings); + int res_y = gtk_print_settings_get_resolution_y (settings); - if (res_x != res_y) - { - value = g_strdup_printf ("%dx%ddpi", res_x, res_y); - gtk_printer_option_set (option, value); - g_free (value); + if (res_x != res_y) + { + value = g_strdup_printf ("%dx%ddpi", res_x, res_y); + gtk_printer_option_set (option, value); + g_free (value); + } + else if (res != 0) + { + value = g_strdup_printf ("%ddpi", res); + gtk_printer_option_set (option, value); + g_free (value); + } } - else if (res != 0) - { - value = g_strdup_printf ("%ddpi", res); - gtk_printer_option_set (option, value); - g_free (value); - } - } + } } else if (strcmp (option->name, "gtk-paper-type") == 0) map_settings_to_option (option, media_type_map, G_N_ELEMENTS (media_type_map), |