X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-window.c;h=8443e6bb969ea37548d675400cf0739a00feccdb;hb=6c93a5962ad7052cff3065ddbd8d53b6932d1f1b;hp=aea1c1bd0e3c2eccafcd125ef907275a4cf7561b;hpb=141b0877eea395345987f2b8d9269376b76e4204;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index aea1c1bd..8443e6bb 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -900,7 +900,7 @@ password_dialog_response (GtkWidget *password_dialog, ev_window_title_set_type (ev_window->priv->title, EV_WINDOW_TITLE_DOCUMENT); ev_job_queue_add_job (ev_window->priv->xfer_job, EV_JOB_PRIORITY_HIGH); - gtk_widget_destroy (password_dialog); + gtk_widget_destroy (password_dialog); return; } @@ -1519,8 +1519,16 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, gint response, EvWindow *window) { - EvBackend document_type; - gboolean export_to_ps = TRUE; + EvPrintRange *ranges = NULL; + EvPageCache *page_cache; + gint n_ranges = 0; + gint copies; + gboolean collate; + gboolean reverse; + gdouble scale; + gint current_page; + gint width; + gint height; GtkPrintPages print_pages; if (response != GTK_RESPONSE_OK) { @@ -1544,32 +1552,7 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, window->priv->print_page_setup = g_object_ref ( gtk_print_unix_dialog_get_page_setup (GTK_PRINT_UNIX_DIALOG (dialog))); - document_type = ev_document_factory_get_backend (window->priv->document); - print_pages = gtk_print_settings_get_print_pages (window->priv->print_settings); - - if (print_pages == GTK_PRINT_PAGES_ALL) { - switch (document_type) { - case EV_BACKEND_PDF: - /* Export to ps when printing to file */ - if (gtk_print_settings_has_key (window->priv->print_settings, - GTK_PRINT_SETTINGS_OUTPUT_URI)) { - export_to_ps = TRUE; - } else { - export_to_ps = !gtk_printer_accepts_pdf (window->priv->printer); - } - - break; - case EV_BACKEND_PS: - export_to_ps = FALSE; - break; - default: - export_to_ps = TRUE; - break; - } - } - - if ((export_to_ps || document_type == EV_BACKEND_PS) && - !gtk_printer_accepts_ps (window->priv->printer)) { + if (!gtk_printer_accepts_ps (window->priv->printer)) { GtkWidget *msgdialog; msgdialog = gtk_message_dialog_new (GTK_WINDOW (dialog), @@ -1584,65 +1567,55 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, return FALSE; } - if (export_to_ps) { - EvPrintRange *ranges = NULL; - EvPageCache *page_cache; - gint n_ranges = 0; - gint current_page; - gint width; - gint height; - - ev_window_clear_print_job (window); - - current_page = - gtk_print_unix_dialog_get_current_page (GTK_PRINT_UNIX_DIALOG (dialog)); - - switch (print_pages) { - case GTK_PRINT_PAGES_CURRENT: - ranges = g_new0 (EvPrintRange, 1); - - ranges->start = current_page; - ranges->end = current_page; - n_ranges = 1; - - break; - case GTK_PRINT_PAGES_RANGES: { - GtkPageRange *page_range; - - page_range = gtk_print_settings_get_page_ranges (window->priv->print_settings, - &n_ranges); - if (n_ranges > 0) - ranges = g_memdup (page_range, n_ranges * sizeof (GtkPageRange)); - } - break; - default: - break; - } - - page_cache = ev_page_cache_get (window->priv->document); - ev_page_cache_get_size (page_cache, - current_page, - 0, 1.0, - &width, &height); + ev_window_clear_print_job (window); + + current_page = gtk_print_unix_dialog_get_current_page (GTK_PRINT_UNIX_DIALOG (dialog)); + print_pages = gtk_print_settings_get_print_pages (window->priv->print_settings); - window->priv->print_job = - ev_job_print_new (window->priv->document, - ranges, n_ranges, - (gdouble)width, - (gdouble)height); + switch (print_pages) { + case GTK_PRINT_PAGES_CURRENT: + ranges = g_new0 (EvPrintRange, 1); - g_signal_connect (window->priv->print_job, "finished", - G_CALLBACK (ev_window_print_job_cb), - window); - /* The priority doesn't matter for this job */ - ev_job_queue_add_job (window->priv->print_job, EV_JOB_PRIORITY_LOW); - } else { - gchar *filename; - - filename = g_filename_from_uri (window->priv->uri, NULL, NULL); - ev_window_print_send (window, filename); - g_free (filename); + ranges->start = current_page; + ranges->end = current_page; + n_ranges = 1; + + break; + case GTK_PRINT_PAGES_RANGES: { + GtkPageRange *page_range; + + page_range = gtk_print_settings_get_page_ranges (window->priv->print_settings, + &n_ranges); + if (n_ranges > 0) + ranges = g_memdup (page_range, n_ranges * sizeof (GtkPageRange)); } + break; + default: + break; + } + + scale = gtk_print_settings_get_scale (window->priv->print_settings) * 0.01; + page_cache = ev_page_cache_get (window->priv->document); + ev_page_cache_get_size (page_cache, + current_page, + 0, scale, + &width, &height); + + copies = gtk_print_settings_get_n_copies (window->priv->print_settings); + collate = gtk_print_settings_get_collate (window->priv->print_settings); + reverse = gtk_print_settings_get_reverse (window->priv->print_settings); + + window->priv->print_job = ev_job_print_new (window->priv->document, + (gdouble)width, + (gdouble)height, + ranges, n_ranges, + copies, collate, reverse); + + g_signal_connect (window->priv->print_job, "finished", + G_CALLBACK (ev_window_print_job_cb), + window); + /* The priority doesn't matter for this job */ + ev_job_queue_add_job (window->priv->print_job, EV_JOB_PRIORITY_LOW); gtk_widget_destroy (GTK_WIDGET (dialog)); window->priv->print_dialog = NULL; @@ -2939,7 +2912,8 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window) "Marco Pesenti Gritti ", "Nickolay V. Shmyrev ", "Bryan Clark ", - "Carlos Garcia Campos ", + "Carlos Garcia Campos ", + "Wouter Bolsterlee ", NULL }; @@ -3686,9 +3660,9 @@ set_action_properties (GtkActionGroup *action_group) GtkAction *action; action = gtk_action_group_get_action (action_group, "GoPreviousPage"); + g_object_set (action, "is-important", TRUE, NULL); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Previous"), NULL); - g_object_set (action, "is-important", TRUE, NULL); action = gtk_action_group_get_action (action_group, "GoNextPage"); g_object_set (action, "is-important", TRUE, NULL); @@ -3698,22 +3672,18 @@ set_action_properties (GtkActionGroup *action_group) action = gtk_action_group_get_action (action_group, "ViewZoomIn"); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Zoom In"), NULL); - action = gtk_action_group_get_action (action_group, "ViewZoomIn"); action = gtk_action_group_get_action (action_group, "ViewZoomOut"); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Zoom Out"), NULL); - action = gtk_action_group_get_action (action_group, "ViewZoomIn"); action = gtk_action_group_get_action (action_group, "ViewBestFit"); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Best Fit"), NULL); - action = gtk_action_group_get_action (action_group, "ViewZoomIn"); action = gtk_action_group_get_action (action_group, "ViewPageWidth"); /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Fit Width"), NULL); - action = gtk_action_group_get_action (action_group, "ViewZoomIn"); action = gtk_action_group_get_action (action_group, "LeaveFullscreen"); g_object_set (action, "is-important", TRUE, NULL);