[gnome-documents] documents: avoid double updates of the document icon



commit fccae8b8630f9e021be052888c3906f058cae632
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Oct 5 17:32:58 2011 -0400

    documents: avoid double updates of the document icon
    
    We called updateIconFromType() twice in populateFromCursor(). Instead,
    track if the file ever tried thumbnailing and call updateIconFromType()
    if it didn't.

 src/documents.js |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 8b50425..c6d5b4f 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -65,7 +65,7 @@ DocCommon.prototype = {
         this.favorite = false;
         this.shared = false;
 
-        this._thumbnailed = false;
+        this.thumbnailed = false;
 
         this.populateFromCursor(cursor);
 
@@ -118,7 +118,6 @@ DocCommon.prototype = {
 
         this.mimeType = cursor.get_string(Query.QueryColumns.MIMETYPE)[0];
         this.rdfType = cursor.get_string(Query.QueryColumns.RDFTYPE)[0];
-        this.updateIconFromType();
 
         this.updateTypeDescription();
 
@@ -247,6 +246,7 @@ LocalDocument.prototype = {
     _init: function(cursor) {
         this._thumbPath = null;
         this._failedThumbnailing = false;
+        this._triedThumbnailing = false;
 
         DocCommon.prototype._init.call(this, cursor);
 
@@ -279,6 +279,12 @@ LocalDocument.prototype = {
             return;
         }
 
+        if (!this._triedThumbnailing) {
+            this.updateIconFromType();
+            this._triedThumbnailing = true;
+        }
+
+        this._triedThumbnailing = true;
         this._file = Gio.file_new_for_uri(this.uri);
         this._file.query_info_async(_FILE_ATTRIBUTES,
                                     0, 0, null,



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