[gnome-documents] selections: don't manually add collections to the cache on creation



commit 876b5f82de8a2e8f0dd5ccf3205c8fd739f23a95
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 8 14:45:32 2011 -0500

    selections: don't manually add collections to the cache on creation
    
    Rely on tracker store's change notifications instead.

 src/selections.js |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index 9e9d911..c81afac 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -303,7 +303,8 @@ CreateCollectionJob.prototype = {
                 if (key == 'res')
                     this._createdUrn = val;
 
-                this._callback(this._createdUrn);
+                if (this._callback)
+                    this._callback(this._createdUrn);
             }));
     }
 };
@@ -482,11 +483,6 @@ OrganizeCollectionView.prototype = {
         job.run(Lang.bind(this,
             function() {
                 this._model.refreshCollectionState();
-
-                // FIXME: we shouldn't be this, but tracker doesn't
-                // notify us for collection changes...
-                let coll = Global.collectionManager.getItemById(collUrn);
-                coll.refresh();
             }));
     },
 
@@ -507,19 +503,7 @@ OrganizeCollectionView.prototype = {
 
         // actually create the new collection
         let job = new CreateCollectionJob(newText);
-        job.run(Lang.bind(this, this._onCollectionCreated));
-    },
-
-    _onCollectionCreated: function(collUrn) {
-        // FIXME: we shouldn't be doing any of this, but tracker doesn't
-        // notify us for collection changes...
-
-        let job = new Documents.SingleItemJob(collUrn);
-        job.run(Query.QueryFlags.UNFILTERED, Lang.bind(this,
-            function(cursor) {
-                if (cursor)
-                    Global.documentManager.addDocumentFromCursor(cursor);
-            }));
+        job.run(null);
     },
 
     _onTextEditCanceled: function() {



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