printers: Fix setting of page size

Set 'PageSize' instead of 'media' for new printers since we use PPD
for construction of the combo for selecting of default paper size.
Previously, we've been setting 'media' attribute for new printers.
Attribute 'media' is used by IPP but we set paper size using 'PageSize'
which comes from PPD in the options dialog. Sometimes (quite often) IPP
gets priority over PPD in print systems. Therefore there was inconsistency
of what user set as default paper size on the options dialog and what was used.

Also don't mark IPP and user's local options as default in PpPPDOptionWidget
since it should use just PPD (we can change PPD values only in this widget).
Since we use PPD for setting of paper size in the options dialog, we shouldn't
show a value which user does not change actually (IPP's 'media' vs. PPD's
'PageSize').

https://bugzilla.gnome.org/show_bug.cgi?id=748569
This commit is contained in:
Marek Kasik 2015-05-22 11:23:19 +02:00
parent 80dce1ee4c
commit b5b421288c
4 changed files with 7 additions and 10 deletions

View file

@ -1326,9 +1326,9 @@ printer_configure_async (PpNewPrinter *new_printer)
/* Set media size for printer */
values = g_new0 (gchar *, 2);
values[0] = g_strdup (get_paper_size_from_locale ());
values[0] = g_strdup (get_page_size_from_locale ());
printer_add_option_async (priv->name, "media", values, TRUE, NULL, pao_cb, data);
printer_add_option_async (priv->name, "PageSize", values, FALSE, NULL, pao_cb, data);
g_strfreev (values);

View file

@ -524,9 +524,6 @@ update_widget_real (PpPPDOptionWidget *widget)
if (ppd_file)
{
ppdMarkDefaults (ppd_file);
cupsMarkOptions (ppd_file,
priv->destination->num_options,
priv->destination->options);
for (iter = ppdFirstOption(ppd_file); iter; iter = ppdNextOption(ppd_file))
{

View file

@ -1331,14 +1331,14 @@ printer_get_hostname (cups_ptype_t printer_type,
return result;
}
/* Returns default media size for current locale */
/* Returns default page size for current locale */
const gchar *
get_paper_size_from_locale ()
get_page_size_from_locale (void)
{
if (g_str_equal (gtk_paper_size_get_default (), GTK_PAPER_NAME_LETTER))
return "na-letter";
return "Letter";
else
return "iso-a4";
return "A4";
}
typedef struct

View file

@ -297,7 +297,7 @@ PpPrintDevice *pp_print_device_copy (PpPrintDevice *device);
void pp_devices_list_free (PpDevicesList *result);
const gchar *get_paper_size_from_locale (void);
const gchar *get_page_size_from_locale (void);
typedef void (*GCDCallback) (GList *devices,
gboolean finished,