[gnome-documents] documents: populate the model at startup



commit e93d153d8a6e9feb10b53ef68c8d831de9ff6ef5
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 26 16:02:28 2011 -0400

    documents: populate the model at startup
    
    Fixes empty view on mode change.

 src/documents.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index a1d59ff..d2eb24e 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -289,6 +289,10 @@ DocumentManager.prototype = {
         });
         this._docs = [];
         this.emit('clear');
+    },
+
+    getDocuments: function() {
+        return this._docs;
     }
 };
 Signals.addSignalMethods(DocumentManager.prototype);
@@ -312,8 +316,14 @@ DocumentModel.prototype = {
     _init: function() {
         this.model = Gd.create_list_store();
         this._documentManager = Global.documentManager;
+
         this._documentManager.connect('clear', Lang.bind(this, this._onManagerClear));
         this._documentManager.connect('new-document', Lang.bind(this, this._onNewDocument));
+
+        this._documentManager.getDocuments().forEach(Lang.bind(this,
+            function(document) {
+                this._onNewDocument(this._documentManager, document);
+            }));
     },
 
     _onManagerClear: function() {



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