[gnome-documents/gnome-3-22] selections: Enable printing only for documents handled by EvView



commit 5bc32b64c10aafafc17d72c3f3a1c5b085766224
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jun 7 14:54:12 2017 +0200

    selections: Enable printing only for documents handled by EvView
    
    Now that we don't convert everything to PDFs, we might not be able to
    print everything that's not a collection. eg., we can't print EPUBs,
    ODFs and OOXMLs. Therefore it is not enough to only check for
    collecitons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781533

 src/selections.js |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index b864c8f..0b0377d 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -946,7 +946,7 @@ const SelectionToolbar = new Lang.Class({
         let hasSelection = (selection.length > 0);
 
         let showTrash = hasSelection;
-        let showPrint = hasSelection;
+        let showPrint = false;
         let showProperties = hasSelection;
         let showOpen = hasSelection;
         let showShare = hasSelection;
@@ -967,16 +967,22 @@ const SelectionToolbar = new Lang.Class({
                     showShare = false;
 
                 showTrash &= doc.canTrash();
-                showPrint &= !doc.collection;
             }));
 
         showOpen = (apps.length > 0);
 
-        if (selection.length > 1) {
-            showPrint = false;
-            showProperties = false;
+        if (selection.length == 1) {
+            let doc = Application.documentManager.getItemById(selection[0]);
+            doc.load(null, null, Lang.bind(this,
+                function(doc, docModel, error) {
+                    showPrint = doc.canPrint(docModel);
+                    this._toolbarPrint.set_sensitive(showPrint);
+                }));
         }
 
+        if (selection.length > 1)
+            showProperties = false;
+
         let openLabel = null;
         if (apps.length == 1) {
             // Translators: this is the Open action in a context menu


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