gnome-shell r141 - trunk/js/ui
- From: marinaz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-shell r141 - trunk/js/ui
- Date: Thu, 8 Jan 2009 23:31:23 +0000 (UTC)
Author: marinaz
Date: Thu Jan 8 23:31:23 2009
New Revision: 141
URL: http://svn.gnome.org/viewvc/gnome-shell?rev=141&view=rev
Log:
Check if the file still exists when displaying matches for the search.
Use get_modified() instead of get_visited() for GtkRecentInfo as get_modified() seems to reflect when the file was last modified or visted, while get_visited() stays the same as get_added(). See http://bugzilla.gnome.org/show_bug.cgi?id=567094
Modified:
trunk/js/ui/docDisplay.js
Modified: trunk/js/ui/docDisplay.js
==============================================================================
--- trunk/js/ui/docDisplay.js (original)
+++ trunk/js/ui/docDisplay.js Thu Jan 8 23:31:23 2009
@@ -121,9 +121,9 @@
// properties are returned during the iteration in the same order in which they were
// defined, but it is not a guarantee according to this
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/for...in
- // So while this._allItems associative array seems to always be ordered by last visited,
+ // While this._allItems associative array seems to always be ordered by last added,
// as the results of this._recentManager.get_items() based on which it is constructed are,
- // we should do the sorting manually anyway.
+ // we should do the sorting manually because we want the order to be based on last visited.
// TODO: would it be better to store an additional array of doc ids as they are
// returned by this._recentManager.get_items() to avoid having to do this sorting?
// This function is called each time the search string is set back to '', so we are
@@ -152,9 +152,12 @@
itemIds.sort(function (a,b) {
let docA = me._allItems[a];
let docB = me._allItems[b];
- if (docA.get_visited() > docB.get_visited())
+ // 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
+ if (docA.get_modified() > docB.get_modified())
return -1;
- else if (docA.get_visited() < docB.get_visited())
+ else if (docA.get_modified() < docB.get_modified())
return 1;
else
return 0;
@@ -165,8 +168,12 @@
// the name of the document. Item info is expected to be GtkRecentInfo.
// Returns a boolean flag indicating if itemInfo is a match.
_isInfoMatching : function(itemInfo, search) {
+ if (!itemInfo.exists())
+ return false;
+
if (search == null || search == '')
return true;
+
let name = itemInfo.get_display_name().toLowerCase();
if (name.indexOf(search) >= 0)
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]