[gnome-documents] documents: don't manually remove the document from the cache on trash



commit b3f91b7c9a665ea9340acee4a4fb91bf9c1fe4a0
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 8 14:43:29 2011 -0500

    documents: don't manually remove the document from the cache on trash
    
    Rely on tracker store's change notifications instead.

 src/documents.js |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 6f27a18..46d5940 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -115,7 +115,8 @@ DeleteItemJob.prototype = {
                     log(e);
                 }
 
-                this._callback();
+                if (this._callback)
+                    this._callback();
             }));
     }
 };
@@ -649,14 +650,7 @@ LocalDocument.prototype = {
     trash: function() {
         if (this.collection) {
             let job = new DeleteItemJob(this.id);
-            job.run(Lang.bind(this,
-                function() {
-                    // FIXME: this should be done automatically when tracker
-                    // will support change notifications for collections
-                    Global.documentManager.getModel().documentRemoved(this);
-                    Global.documentManager.removeItemById(this.id);
-                    Global.collectionManager.removeItemById(this.id);
-                }));
+            job.run(null);
         }
     }
 };



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