[gnome-documents/rhel-7.4: 10/16] selections: Enable printing only for documents handled by EvView



commit 7d63e3fc760aef6ec56868a16e930af8977f0973
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Apr 20 14:59: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
    collections.
    
    Instead, let's use canPrint which encapsulates all the conditions that
    need to be met for printing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781533

 src/selections.js |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index b864c8f..ecfd3ec 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,21 @@ 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.canPrint(null, null, Lang.bind(this,
+                function(doc, supported) {
+                    this._toolbarPrint.set_sensitive(supported);
+                }));
         }
 
+        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]