Adds animated sync icon -- not yet perfect

This commit is contained in:
Dan Stillman 2008-06-30 15:14:35 +00:00
parent 1bf13aaa1a
commit 50941734b8
5 changed files with 34 additions and 4 deletions

View file

@ -304,10 +304,7 @@
<vbox id="zotero-item-pane" persist="width"> <vbox id="zotero-item-pane" persist="width">
<toolbar align="right"> <toolbar align="right">
<toolbarbutton <toolbarbutton id="zotero-tb-sync" tooltip="_child"
id="zotero-tb-sync"
image="chrome://zotero/skin/arrow_refresh.png"
tooltip="_child"
oncommand="Zotero.Sync.Server.sync()"> oncommand="Zotero.Sync.Server.sync()">
<tooltip <tooltip
onpopupshowing="this.firstChild.nextSibling.value = 'Last sync: ' + (Zotero.Sync.Server.lastLocalSyncTime ? new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000).toLocaleString() : 'Not yet synced')" onpopupshowing="this.firstChild.nextSibling.value = 'Last sync: ' + (Zotero.Sync.Server.lastLocalSyncTime ? new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000).toLocaleString() : 'Not yet synced')"

View file

@ -378,6 +378,8 @@ Zotero.Sync.Server = new function () {
this.logout = logout; this.logout = logout;
this.setSyncTimeout = setSyncTimeout; this.setSyncTimeout = setSyncTimeout;
this.clearSyncTimeout = clearSyncTimeout; this.clearSyncTimeout = clearSyncTimeout;
this.startSyncAnimation = startSyncAnimation;
this.stopSyncAnimation = stopSyncAnimation;
this.__defineGetter__('username', function () { this.__defineGetter__('username', function () {
return Zotero.Prefs.get('sync.server.username'); return Zotero.Prefs.get('sync.server.username');
@ -535,6 +537,7 @@ Zotero.Sync.Server = new function () {
function sync() { function sync() {
Zotero.Sync.Server.clearSyncTimeout(); Zotero.Sync.Server.clearSyncTimeout();
Zotero.Sync.Server.startSyncAnimation();
if (_attempts < 0) { if (_attempts < 0) {
_error('Too many attempts in Zotero.Sync.Server.sync()'); _error('Too many attempts in Zotero.Sync.Server.sync()');
@ -852,6 +855,8 @@ Zotero.Sync.Server = new function () {
if (callback) { if (callback) {
callback(); callback();
} }
Zotero.Sync.Server.stopSyncAnimation();
}); });
} }
@ -1016,6 +1021,22 @@ Zotero.Sync.Server = new function () {
} }
function startSyncAnimation() {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow('navigator:browser');
win.document.getElementById('zotero-tb-sync').setAttribute('animate', 'true');
}
function stopSyncAnimation() {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow('navigator:browser');
win.document.getElementById('zotero-tb-sync').removeAttribute('animate');
}
function _checkResponse(xmlhttp) { function _checkResponse(xmlhttp) {
if (!xmlhttp.responseXML || if (!xmlhttp.responseXML ||
!xmlhttp.responseXML.childNodes[0] || !xmlhttp.responseXML.childNodes[0] ||
@ -1054,6 +1075,8 @@ Zotero.Sync.Server = new function () {
Zotero.Sync.Server.unlock() Zotero.Sync.Server.unlock()
} }
Zotero.Sync.Server.stopSyncAnimation();
throw(e); throw(e);
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

View file

@ -191,6 +191,16 @@
list-style-image: url('chrome://zotero/skin/toolbar-advanced-search.png'); list-style-image: url('chrome://zotero/skin/toolbar-advanced-search.png');
} }
#zotero-tb-sync {
margin-top: -2px;
margin-left: -2px;
list-style-image: url(chrome://zotero/skin/arrow_rotate_static.png);
}
#zotero-tb-sync[animate=true] {
list-style-image: url(chrome://zotero/skin/arrow_rotate_animated.png);
}
#zotero-tb-sync #zotero-last-sync-time #zotero-tb-sync #zotero-last-sync-time
{ {
color: gray; color: gray;