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



commit 338ad6c85e6f7b1db17516d014c9955e0d07893c
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 c620dd4..f990b26 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]