diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index 26362c005..6cd623a98 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -140,6 +140,8 @@ gtk_printer_option_widget_finalize (GObject *object) if (priv->source) { + g_signal_handler_disconnect (priv->source, + priv->source_changed_handler); g_object_unref (priv->source); priv->source = NULL; } @@ -201,6 +203,23 @@ gtk_printer_option_widget_mnemonic_activate (GtkWidget *widget, return gtk_widget_mnemonic_activate (priv->combo, group_cycling); if (priv->entry) return gtk_widget_mnemonic_activate (priv->entry, group_cycling); + if (priv->box) + { + GList *children, *l; + GtkWidget *button = NULL; + + /* Radio buttons: focus the chosen one, don't change the choice */ + children = gtk_container_get_children (GTK_CONTAINER (priv->box)); + for (l = children; l; l = l->next) + if (GTK_IS_TOGGLE_BUTTON (l->data) && + (button == NULL || + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (l->data)))) + button = l->data; + g_list_free (children); + + if (button) + return gtk_widget_mnemonic_activate (button, TRUE); + } return FALSE; } diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index d6fab4bcd..8fb41875a 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -469,11 +469,19 @@ preview_print_idle_done (gpointer data) op = GTK_PRINT_OPERATION (pop->preview); cairo_surface_finish (pop->surface); - /* Surface is destroyed in launch_preview */ - _gtk_print_operation_platform_backend_launch_preview (op, - pop->surface, - pop->parent, - pop->filename); + + if (op->priv->status == GTK_PRINT_STATUS_FINISHED_ABORTED) + { + cairo_surface_destroy (pop->surface); + } + else + { + /* Surface is destroyed in launch_preview */ + _gtk_print_operation_platform_backend_launch_preview (op, + pop->surface, + pop->parent, + pop->filename); + } g_free (pop->filename); @@ -502,7 +510,12 @@ preview_print_idle (gpointer data) if (priv->page_drawing_state == GTK_PAGE_DRAWING_STATE_READY) { - if (!pop->pages_data->initialized) + if (priv->cancelled) + { + done = TRUE; + _gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL); + } + else if (!pop->pages_data->initialized) { pop->pages_data->initialized = TRUE; prepare_data (pop->pages_data); @@ -2412,11 +2425,9 @@ common_render_page (GtkPrintOperation *op, cr = gtk_print_context_get_cairo_context (print_context); cairo_save (cr); - if (priv->manual_scale != 1.0 && priv->manual_number_up <= 1) - cairo_scale (cr, - priv->manual_scale, - priv->manual_scale); + /* rotating and moving into the margins translate by the size of + * the paper and of the margins, so they come before the scale */ if (priv->manual_orientation) _gtk_print_context_rotate_according_to_orientation (print_context); @@ -2601,8 +2612,14 @@ common_render_page (GtkPrintOperation *op, } } else - if (!priv->use_full_page) - _gtk_print_context_translate_into_margin (print_context); + { + if (!priv->use_full_page) + _gtk_print_context_translate_into_margin (print_context); + if (priv->manual_scale != 1.0) + cairo_scale (cr, + priv->manual_scale, + priv->manual_scale); + } priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_DRAWING; diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index ff6471e91..08de92f37 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -1918,6 +1918,7 @@ selected_printer_changed (GtkTreeSelection *selection, priv->options_changed_handler = g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog); + schedule_idle_mark_conflicts (dialog); } update_dialog_from_settings (dialog); diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c index 65326bf7f..12b5cc7a5 100644 --- a/modules/printbackends/cups/gtkprintbackendcups.c +++ b/modules/printbackends/cups/gtkprintbackendcups.c @@ -3993,6 +3993,11 @@ cups_request_ppd_cb (GtkPrintBackendCups *print_backend, /* 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 + /* the option names and choices in the language of the user, where + * the PPD has translations for it */ + ppdLocalize (data->printer->ppd_file); +#endif ppdMarkDefaults (data->printer->ppd_file); diff --git a/modules/printbackends/file/gtkprintbackendfile.c b/modules/printbackends/file/gtkprintbackendfile.c index 8158ada91..38d055da4 100644 --- a/modules/printbackends/file/gtkprintbackendfile.c +++ b/modules/printbackends/file/gtkprintbackendfile.c @@ -253,13 +253,21 @@ output_file_from_settings (GtkPrintSettings *settings, if (locale_name != NULL) { - gchar *current_dir = g_get_current_dir (); - path = g_build_filename (current_dir, locale_name, NULL); - g_free (locale_name); + const gchar *document_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS); + + if (document_dir == NULL) + { + gchar *current_dir = g_get_current_dir (); + path = g_build_filename (current_dir, locale_name, NULL); + g_free (current_dir); + } + else + path = g_build_filename (document_dir, locale_name, NULL); uri = g_filename_to_uri (path, NULL, NULL); + + g_free (locale_name); g_free (path); - g_free (current_dir); } } @@ -378,6 +386,17 @@ file_print_cb (GtkPrintBackendFile *print_backend, gtk_print_job_set_status (ps->job, (error != NULL)?GTK_PRINT_STATUS_FINISHED_ABORTED:GTK_PRINT_STATUS_FINISHED); + /* the file printed to is a recently used file, as one saved */ + if (error == NULL && ps->job) + { + gchar *uri; + + uri = output_file_from_settings (gtk_print_job_get_settings (ps->job), NULL); + if (uri) + gtk_recent_manager_add_item (gtk_recent_manager_get_default (), uri); + g_free (uri); + } + if (ps->job) g_object_unref (ps->job);