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



commit 0d48f069730a879e8588da58141e55802fe759bb
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 a1a340f..7a154fe 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -35,6 +35,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;
@@ -407,6 +408,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]