gchar *default_cover_after = NULL;
gboolean remote_printer = FALSE;
gchar **auth_info_required = NULL;
-
+ gint default_number_up = 1;
+
/* Skip leading attributes until we hit a printer...
*/
while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER)
auth_info_required[i] = g_strdup (attr->values[i].string.text);
}
}
+ else if (strcmp (attr->name, "number-up-default") == 0)
+ {
+ default_number_up = attr->values[0].integer;
+ }
else
{
GTK_NOTE (PRINTING,
cups_printer->default_cover_before = g_strdup (default_cover_before);
cups_printer->default_cover_after = g_strdup (default_cover_after);
+ cups_printer->default_number_up = default_number_up;
+
cups_printer->hostname = g_strdup (hostname);
cups_printer->port = port;
"job-sheets-supported",
"job-sheets-default",
"printer-type",
- "auth-info-required"
+ "auth-info-required",
+ "number-up-default"
};
if (cups_backend->reading_ppds > 0 || cups_backend->list_printers_pending)
/* let ppdOpenFd take over the ownership of the open file */
g_io_channel_seek_position (data->ppd_io, 0, G_SEEK_SET, NULL);
data->printer->ppd_file = ppdOpenFd (dup (g_io_channel_unix_get_fd (data->ppd_io)));
+#if (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2) || CUPS_VERSION_MAJOR > 1
+ ppdLocalize (data->printer->ppd_file);
+#endif
ppdMarkDefaults (data->printer->ppd_file);
#ifdef HAVE_COLORD
GtkPrintBackendCupsColordHelper *helper;
#endif
+ char *default_number_up;
set = gtk_printer_option_set_new ();
/* Cups specific, non-ppd related settings */
- /* Translators, this string is used to label the pages-per-sheet option
- * in the print dialog
- */
- option = gtk_printer_option_new ("gtk-n-up", _("Pages per Sheet"), GTK_PRINTER_OPTION_TYPE_PICKONE);
- gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up),
- n_up, n_up);
- gtk_printer_option_set (option, "1");
- set_option_from_settings (option, settings);
- gtk_printer_option_set_add (set, option);
- g_object_unref (option);
-
- if (cups_printer_get_capabilities (printer) & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
- {
- for (i = 0; i < G_N_ELEMENTS (n_up_layout_display); i++)
- n_up_layout_display[i] = _(n_up_layout_display[i]);
-
- /* Translators, this string is used to label the option in the print
- * dialog that controls in what order multiple pages are arranged
- */
- option = gtk_printer_option_new ("gtk-n-up-layout", _("Page Ordering"), GTK_PRINTER_OPTION_TYPE_PICKONE);
- gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up_layout),
- n_up_layout, n_up_layout_display);
-
- text_direction = gtk_widget_get_default_direction ();
- if (text_direction == GTK_TEXT_DIR_LTR)
- gtk_printer_option_set (option, "lrtb");
- else
- gtk_printer_option_set (option, "rltb");
-
- set_option_from_settings (option, settings);
- gtk_printer_option_set_add (set, option);
- g_object_unref (option);
- }
-
for (i = 0; i < G_N_ELEMENTS(prio_display); i++)
prio_display[i] = _(prio_display[i]);
gpointer value;
gint j;
+ /* Translators, this string is used to label the pages-per-sheet option
+ * in the print dialog
+ */
+ option = gtk_printer_option_new ("gtk-n-up", _("Pages per Sheet"), GTK_PRINTER_OPTION_TYPE_PICKONE);
+ gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up),
+ n_up, n_up);
+ default_number_up = g_strdup_printf ("%d", cups_printer->default_number_up);
+ gtk_printer_option_set (option, default_number_up);
+ g_free (default_number_up);
+ set_option_from_settings (option, settings);
+ gtk_printer_option_set_add (set, option);
+ g_object_unref (option);
+
+ if (cups_printer_get_capabilities (printer) & GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT)
+ {
+ for (i = 0; i < G_N_ELEMENTS (n_up_layout_display); i++)
+ n_up_layout_display[i] = _(n_up_layout_display[i]);
+
+ /* Translators, this string is used to label the option in the print
+ * dialog that controls in what order multiple pages are arranged
+ */
+ option = gtk_printer_option_new ("gtk-n-up-layout", _("Page Ordering"), GTK_PRINTER_OPTION_TYPE_PICKONE);
+ gtk_printer_option_choices_from_array (option, G_N_ELEMENTS (n_up_layout),
+ n_up_layout, n_up_layout_display);
+
+ text_direction = gtk_widget_get_default_direction ();
+ if (text_direction == GTK_TEXT_DIR_LTR)
+ gtk_printer_option_set (option, "lrtb");
+ else
+ gtk_printer_option_set (option, "rltb");
+
+ set_option_from_settings (option, settings);
+ gtk_printer_option_set_add (set, option);
+ g_object_unref (option);
+ }
+
num_of_covers = backend->number_of_covers;
cover = g_new (char *, num_of_covers + 1);
cover[num_of_covers] = NULL;