[gnome-shell] Replace lastVisited method in DocInfo with timestamp attribute



commit f3efbf432f04dcd4fcbd1c87a1873034a2cd2afa
Author: Siegfried-Angel Gevatter Pujals <rainct ubuntu com>
Date:   Sat Jul 25 17:00:37 2009 +0200

    Replace lastVisited method in DocInfo with timestamp attribute
    
    This is not only more consistent with the name, uri and
    mimeType attributes, but makes adding Zeitgeist support easier.

 js/misc/docInfo.js  |   13 ++++---------
 js/ui/docDisplay.js |    4 ++--
 js/ui/widget.js     |    2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/js/misc/docInfo.js b/js/misc/docInfo.js
index 94d9ee3..29e56e9 100644
--- a/js/misc/docInfo.js
+++ b/js/misc/docInfo.js
@@ -18,6 +18,10 @@ function DocInfo(recentInfo) {
 DocInfo.prototype = {
     _init : function(recentInfo) {
         this._recentInfo = recentInfo;
+        // We actually used get_modified() instead of get_visited()
+        // here, as GtkRecentInfo doesn't updated get_visited()
+        // correctly. See http://bugzilla.gnome.org/show_bug.cgi?id=567094
+        this.timestamp = recentInfo.get_modified().getTime() / 1000;
         this.name = recentInfo.get_display_name();
         this.uri = recentInfo.get_uri();
         this.mimeType = recentInfo.get_mime_type();
@@ -76,15 +80,6 @@ DocInfo.prototype = {
 
     exists : function() {
         return this._recentInfo.exists();
-    },
-
-    lastVisited : function() {
-        // We actually used get_modified() instead of get_visited()
-        // here, as GtkRecentInfo doesn't updated get_visited()
-        // correctly. See
-        // http://bugzilla.gnome.org/show_bug.cgi?id=567094
-
-        return this._recentInfo.get_modified();
     }
 };
 
diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js
index 3027936..02886f7 100644
--- a/js/ui/docDisplay.js
+++ b/js/ui/docDisplay.js
@@ -82,7 +82,7 @@ DocDisplayItem.prototype = {
 
     // Updates the last visited time displayed in the description text for the item. 
     _resetTimeDisplay: function(currentSecs) {
-        let lastSecs = this._docInfo.lastVisited().getTime() / 1000;
+        let lastSecs = this._docInfo.timestamp;
         let timeDelta = currentSecs - lastSecs;
         let [text, nextUpdate] = Shell.Global.get().format_time_relative_pretty(timeDelta);
         this._timeoutTime = currentSecs + nextUpdate;
@@ -182,7 +182,7 @@ DocDisplay.prototype = {
         let docA = this._allItems[itemIdA];
         let docB = this._allItems[itemIdB];
 
-        return docB.lastVisited() - docA.lastVisited();
+        return docB.timestamp - docA.timestamp;
     },
 
     // Checks if the item info can be a match for the search string by checking
diff --git a/js/ui/widget.js b/js/ui/widget.js
index cb41e83..4445aba 100644
--- a/js/ui/widget.js
+++ b/js/ui/widget.js
@@ -359,7 +359,7 @@ RecentDocsWidget.prototype = {
                 items.push(docInfo);
         }
 
-        items.sort(function (a,b) { return b.lastVisited() - a.lastVisited(); });
+        items.sort(function (a,b) { return b.timestamp - a.timestamp; });
         for (i = 0; i < Math.min(items.length, 5); i++)
             this.addItem(items[i]);
     }



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