[gnome-documents] documents: Error out if an attempt was made to load a collection



commit 87a04ee157a8479513488e6a5472331f6b19193e
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jun 7 14:32:49 2017 +0200

    documents: Error out if an attempt was made to load a collection
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781533

 src/documents.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 71aefde..c24967f 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -36,6 +36,7 @@ const Zpj = imports.gi.Zpj;
 const _ = imports.gettext.gettext;
 
 const Lang = imports.lang;
+const Mainloop = imports.mainloop;
 const Signals = imports.signals;
 
 const Application = imports.application;
@@ -413,6 +414,20 @@ const DocCommon = new Lang.Class({
 
     load: function(passwd, cancellable, callback) {
         Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
+
+        if (this.collection) {
+            Mainloop.idle_add(Lang.bind(this,
+                function() {
+                    let error = new GLib.Error(Gio.IOErrorEnum,
+                                               Gio.IOErrorEnum.NOT_SUPPORTED,
+                                               "Collections can't be loaded");
+                    callback(this, null, error);
+                    return GLib.SOURCE_REMOVE;
+                }));
+
+            return;
+        }
+
         this.download(true, cancellable, Lang.bind(this,
             function(fromCache, error) {
                 if (error) {


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