[evince] ev-window: set output basename for print to file



commit a5e2a06e57b86de5347f340f7bed29e9e42d9b53
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Thu May 16 17:13:43 2013 +0200

    ev-window: set output basename for print to file
    
    Set the document filename as output basename.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700466

 shell/ev-window.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 19191d4..633d30f 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3447,6 +3447,9 @@ ev_window_print_range (EvWindow *ev_window,
        gint              current_page;
        gint              document_last_page;
        gboolean          embed_page_setup;
+       gchar            *output_basename;
+       const gchar      *document_uri;
+       gchar            *dot;
 
        g_return_if_fail (EV_IS_WINDOW (ev_window));
        g_return_if_fail (ev_window->priv->document != NULL);
@@ -3494,6 +3497,18 @@ ev_window_print_range (EvWindow *ev_window,
                                                    &range, 1);
        }
 
+       document_uri = ev_document_get_uri (ev_window->priv->document);
+       output_basename = g_path_get_basename (document_uri);
+       dot = g_strrstr (output_basename, ".");
+       if (dot)
+               dot[0] = '\0';
+
+       /* Set output basename for printing to file */
+       gtk_print_settings_set (print_settings,
+                               GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
+                               output_basename);
+       g_free (output_basename);
+
        ev_print_operation_set_job_name (op, gtk_window_get_title (GTK_WINDOW (ev_window)));
        ev_print_operation_set_current_page (op, current_page);
        ev_print_operation_set_print_settings (op, print_settings);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]