+static GObject *
+ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print,
+ GtkPrintContext *context)
+{
+ GtkPrintSettings *settings;
+ GtkWidget *label;
+ GtkWidget *table;
+ EvPrintScale page_scale;
+ gboolean autorotate;
+ gboolean use_source_size;
+
+ settings = gtk_print_operation_get_print_settings (print->op);
+ page_scale = gtk_print_settings_get_int_with_default (settings, EV_PRINT_SETTING_PAGE_SCALE, 0);
+ autorotate = gtk_print_settings_has_key (settings, EV_PRINT_SETTING_AUTOROTATE) ?
+ gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_AUTOROTATE) :
+ TRUE;
+ use_source_size = gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_PAGE_SIZE);
+
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 12);
+
+ label = gtk_label_new (_("Page Scaling:"));
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (label);
+
+ print->scale_combo = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("None"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("Shrink to Printable Area"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (print->scale_combo), _("Fit to Printable Area"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (print->scale_combo), page_scale);
+ gtk_widget_set_tooltip_text (print->scale_combo,
+ _("Scale document pages to fit the selected printer page. Select from one of the following:\n"
+ "\n"
+ "• \"None\": No page scaling is performed.\n"
+ "\n"
+ "• \"Shrink to Printable Area\": Document pages larger than the printable area"
+ " are reduced to fit the printable area of the printer page.\n"
+ "\n"
+ "• \"Fit to Printable Area\": Document pages are enlarged or reduced as"
+ " required to fit the printable area of the printer page.\n"));
+ gtk_table_attach (GTK_TABLE (table), print->scale_combo, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (print->scale_combo);
+
+ print->autorotate_button = gtk_check_button_new_with_label (_("Auto Rotate and Center"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (print->autorotate_button), autorotate);
+ gtk_widget_set_tooltip_text (print->autorotate_button,
+ _("Rotate printer page orientation of each page to match orientation of each document page. "
+ "Document pages will be centered within the printer page."));
+ gtk_table_attach (GTK_TABLE (table), print->autorotate_button, 0, 2, 1, 2, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (print->autorotate_button);
+
+ print->source_button = gtk_check_button_new_with_label (_("Select page size using document page size"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (print->source_button), use_source_size);
+ gtk_widget_set_tooltip_text (print->source_button, _("When enabled, each page will be printed on "
+ "the same size paper as the document page."));
+ gtk_table_attach (GTK_TABLE (table), print->source_button, 0, 2, 2, 3, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (print->source_button);
+
+ return G_OBJECT (table);
+}
+
+static void
+ev_print_operation_print_custom_widget_apply (EvPrintOperationPrint *print,
+ GtkPrintContext *context)
+{
+ GtkPrintSettings *settings;
+
+ print->page_scale = gtk_combo_box_get_active (GTK_COMBO_BOX (print->scale_combo));
+ print->autorotate = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print->autorotate_button));
+ print->use_source_size = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (print->source_button));
+ settings = gtk_print_operation_get_print_settings (print->op);
+ gtk_print_settings_set_int (settings, EV_PRINT_SETTING_PAGE_SCALE, print->page_scale);
+ gtk_print_settings_set_bool (settings, EV_PRINT_SETTING_AUTOROTATE, print->autorotate);
+ gtk_print_settings_set_bool (settings, EV_PRINT_SETTING_PAGE_SIZE, print->use_source_size);
+}
+