[gnumeric] win32 print preview: better error handling.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] win32 print preview: better error handling.
- Date: Thu, 17 Mar 2011 17:21:44 +0000 (UTC)
commit ef5fc2824d2c7b20e1bbf3bc6cc79169fc57e4de
Author: Morten Welinder <terra gnome org>
Date: Thu Mar 17 13:21:21 2011 -0400
win32 print preview: better error handling.
ChangeLog | 4 ++++
src/print.c | 38 ++++++++++++++++++--------------------
2 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5d9ce53..31f8fde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-17 Morten Welinder <terra gnome org>
+
+ * src/print.c (gnm_print_sheet): Improve error handling.
+
2011-03-16 Morten Welinder <terra gnome org>
* src/print.c (gnm_print_sheet): On WIN32, do previews as
diff --git a/src/print.c b/src/print.c
index 83fe24e..dee59b9 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1626,36 +1626,34 @@ gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
gtk_print_operation_set_use_full_page (print, FALSE);
gtk_print_operation_set_unit (print, GTK_UNIT_POINTS);
- if (preview_via_pdf) {
- GError *err = NULL;
-
- if (NULL != wbc && IS_WBC_GTK(wbc))
- parent = wbcg_toplevel (WBC_GTK (wbc));
+ if (NULL != wbc && IS_WBC_GTK(wbc))
+ parent = wbcg_toplevel (WBC_GTK (wbc));
- tmp_file_fd = g_file_open_tmp ("pdfXXXXXX", &tmp_file_name, &err);
- if (err) {
- /* FIXME */
- g_error_free (err);
- goto out;
- }
- action = GTK_PRINT_OPERATION_ACTION_EXPORT;
- gtk_print_operation_set_export_filename (print, tmp_file_name);
- gtk_print_operation_set_show_progress (print, TRUE);
- } else if (export_dst) {
+ if (preview_via_pdf || export_dst) {
GError *err = NULL;
- tmp_file_fd = g_file_open_tmp ("pdfXXXXXX", &tmp_file_name, &err);
+ tmp_file_fd = g_file_open_tmp ("gnmXXXXXX.pdf",
+ &tmp_file_name, &err);
if (err) {
- gsf_output_set_error (export_dst, 0, "%s", err->message);
+ if (export_dst)
+ gsf_output_set_error (export_dst, 0,
+ "%s", err->message);
+ else {
+ char *text = g_strdup_printf
+ (_("Failed to create temporary file for printing: %s"),
+ err->message);
+ go_cmd_context_error_export
+ (GO_CMD_CONTEXT (wbc), text);
+ g_free (text);
+ }
g_error_free (err);
goto out;
}
+
action = GTK_PRINT_OPERATION_ACTION_EXPORT;
gtk_print_operation_set_export_filename (print, tmp_file_name);
- gtk_print_operation_set_show_progress (print, FALSE);
+ gtk_print_operation_set_show_progress (print, preview_via_pdf);
} else {
- if (NULL != wbc && IS_WBC_GTK(wbc))
- parent = wbcg_toplevel (WBC_GTK (wbc));
action = preview
? GTK_PRINT_OPERATION_ACTION_PREVIEW
: GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]