[gnome-documents] documents: Miscellaneous printing fixes



commit 36f3a8d8fbe2544faa4a7c254ab889908526bf96
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Feb 10 16:01:16 2014 +0100

    documents: Miscellaneous printing fixes
    
    Show a message if a document failed to print, and exit the selection
    mode immediately after printing has started.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724037

 src/documents.js |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index dc03e17..7c71f8c 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -567,10 +567,32 @@ const DocCommon = new Lang.Class({
                 }
 
                 let printOp = EvView.PrintOperation.new(docModel.get_document());
+
+                printOp.connect('begin-print', Lang.bind(this,
+                    function() {
+                        Application.selectionController.setSelectionMode(false);
+                    }));
+
                 printOp.connect('done', Lang.bind(this,
                     function(op, res) {
-                        if (res == Gtk.PrintOperationResult.APPLY)
-                            Application.selectionController.setSelectionMode(false);
+                        if (res == Gtk.PrintOperationResult.ERROR) {
+                            try {
+                                printOp.get_error();
+                            } catch (e) {
+                                let errorDialog = new Gtk.MessageDialog ({ transient_for: toplevel,
+                                                                           modal: true,
+                                                                           destroy_with_parent: true,
+                                                                           buttons: Gtk.ButtonsType.OK,
+                                                                           message_type: 
Gtk.MessageType.ERROR,
+                                                                           text: _("Failed to print 
document"),
+                                                                           secondary_text: e.message });
+                                errorDialog.connect ('response', Lang.bind(this,
+                                    function() {
+                                        errorDialog.destroy();
+                                    }));
+                                errorDialog.show();
+                            }
+                        }
                     }));
 
                 let printNotification = new Notifications.PrintNotification(printOp, doc);


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