Add print to PDF to recent manager

Printing a file with to PDF/etc. with the virtual printer option doesn't add
the file to the list of recently used files. It should be there, so I can
easily access it.

https://bugzilla.gnome.org/show_bug.cgi?id=668598
This commit is contained in:
Siegfried Gevatter (RainCT) 2012-01-24 18:29:00 +00:00 committed by William Jon McCann
parent 3f5af532f7
commit f682aabf74

View File

@ -384,7 +384,10 @@ file_print_cb_locked (GtkPrintBackendFile *print_backend,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
gchar *uri;
_PrintStreamData *ps = (_PrintStreamData *) user_data; _PrintStreamData *ps = (_PrintStreamData *) user_data;
GtkRecentManager *recent_manager;
if (ps->target_io_stream != NULL) if (ps->target_io_stream != NULL)
g_output_stream_close (G_OUTPUT_STREAM (ps->target_io_stream), NULL, NULL); g_output_stream_close (G_OUTPUT_STREAM (ps->target_io_stream), NULL, NULL);
@ -398,6 +401,11 @@ file_print_cb_locked (GtkPrintBackendFile *print_backend,
gtk_print_job_set_status (ps->job, gtk_print_job_set_status (ps->job,
(error != NULL)?GTK_PRINT_STATUS_FINISHED_ABORTED:GTK_PRINT_STATUS_FINISHED); (error != NULL)?GTK_PRINT_STATUS_FINISHED_ABORTED:GTK_PRINT_STATUS_FINISHED);
recent_manager = gtk_recent_manager_get_default ();
uri = output_file_from_settings (gtk_print_job_get_settings (ps->job), NULL);
gtk_recent_manager_add_item (recent_manager, uri);
g_free (uri);
if (ps->job) if (ps->job)
g_object_unref (ps->job); g_object_unref (ps->job);