www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 268f37194ff357123017408c016ab47d09327fd4
parent 19e70b81b5d8b2ea2a86eaec2d451edece413782
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  1 May 2010 05:46:01 +0000

Always show last sync time if available in sync button tooltip -- this should make it clearer when one sync has stopped and another has started


Diffstat:
Mchrome/content/zotero/overlay.xul | 5+++--
Mchrome/content/zotero/xpcom/sync.js | 49+++++++++++++++++++++++++++++--------------------
Mchrome/skin/default/zotero/overlay.css | 2+-
3 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul @@ -387,11 +387,12 @@ oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Server.manualSyncRequired = false; Zotero.Sync.Runner.sync()"> <tooltip id="zotero-tb-sync-tooltip" - onpopupshowing="Zotero.Sync.Runner.registerSyncStatusLabel(this.firstChild.nextSibling)" + onpopupshowing="Zotero.Sync.Runner.registerSyncStatusLabel(this.firstChild.nextSibling, this.firstChild.nextSibling.nextSibling)" onpopuphiding="Zotero.Sync.Runner.registerSyncStatusLabel()" noautohide="true"> <label value="&zotero.sync.button;"/> - <label id="zotero-tb-sync-status"/> + <label id="zotero-tb-sync-status" hidden="true"/> + <label id="zotero-tb-sync-last-sync"/> </tooltip> </toolbarbutton> <toolbarseparator/> diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -492,6 +492,7 @@ Zotero.Sync.Runner = new function () { var _lastSyncStatus; var _currentSyncStatusLabel; + var _currentLastSyncLabel; var _warning = null; @@ -935,9 +936,10 @@ Zotero.Sync.Runner = new function () { * * @param {Tooltip} [label] */ - this.registerSyncStatusLabel = function (label) { - _currentSyncStatusLabel = label; - if (label) { + this.registerSyncStatusLabel = function (statusLabel, lastSyncLabel) { + _currentSyncStatusLabel = statusLabel; + _currentLastSyncLabel = lastSyncLabel; + if (_currentSyncStatusLabel) { _updateSyncStatusLabel(); } } @@ -945,26 +947,33 @@ Zotero.Sync.Runner = new function () { function _updateSyncStatusLabel() { if (_lastSyncStatus) { - var msg = _lastSyncStatus; + _currentSyncStatusLabel.value = _lastSyncStatus; + _currentSyncStatusLabel.hidden = false; } - // If no message, use last sync time else { - var lastSyncTime = Zotero.Sync.Server.lastLocalSyncTime; - if (lastSyncTime) { - var time = new Date(lastSyncTime * 1000); - var msg = Zotero.Date.toRelativeDate(time); - } - else { - var msg = Zotero.getString('sync.status.notYetSynced'); - } - - msg = Zotero.localeJoin([ - Zotero.getString('sync.status.lastSync'), - msg - ]); + _currentSyncStatusLabel.hidden = true; + } + + // Always update last sync time + var lastSyncTime = Zotero.Sync.Server.lastLocalSyncTime; + if (lastSyncTime) { + var time = new Date(lastSyncTime * 1000); + var msg = Zotero.Date.toRelativeDate(time); + } + // Don't show "Not yet synced" if a sync is in progress + else if (_lastSyncStatus) { + _currentLastSyncLabel.hidden = true; + return; + } + else { + var msg = Zotero.getString('sync.status.notYetSynced'); } - _currentSyncStatusLabel.value = msg; + _currentLastSyncLabel.value = Zotero.localeJoin([ + Zotero.getString('sync.status.lastSync'), + msg + ]); + _currentLastSyncLabel.hidden = false; } } @@ -1616,7 +1625,7 @@ Zotero.Sync.Server = new function () { if (!_sessionID) { Zotero.debug("Session ID not available -- logging in"); Zotero.Sync.Server.login(function () { - Zotero.Sync.Server.clear(); + Zotero.Sync.Server.clear(callback); }); return; } diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css @@ -238,7 +238,7 @@ list-style-image: url(chrome://zotero/skin/arrow_rotate_animated.png); } -#zotero-tb-sync #zotero-tb-sync-status +#zotero-tb-sync-status, #zotero-tb-sync-last-sync { color: gray; }