[gnome-documents] documents: Use recommended app as the external viewer



commit dd94d852de8f47859094209e54034d38382bcc5c
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 16 13:01:03 2014 +0100

    documents: Use recommended app as the external viewer
    
    This avoids ZIP-based documents from being opened with the Archive
    Manager. This is especially important for ePubs and CBZ files.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740978

 src/documents.js |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 9b93a94..3d7ddcf 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -658,8 +658,15 @@ const LocalDocument = new Lang.Class({
         this.sourceName = _("Local");
 
         let defaultApp = null;
-        if (this.mimeType)
-            defaultApp = Gio.app_info_get_default_for_type(this.mimeType, true);
+        if (this.mimeType) {
+            let apps = Gio.app_info_get_recommended_for_type (this.mimeType);
+            for (let i = 0; i < apps.length; i++) {
+                if (apps[i].supports_uris ()) {
+                    defaultApp = apps[i];
+                    break;
+                }
+            }
+        }
 
         if (defaultApp)
             this.defaultAppName = defaultApp.get_name();


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