commit 50941734b8253deb1d89d833672706b80bcef91c
parent 1bf13aaa1a445fe630f5e177ac92131dcd94d304
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 30 Jun 2008 15:14:35 +0000
Adds animated sync icon -- not yet perfect
Diffstat:
5 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -304,10 +304,7 @@
<vbox id="zotero-item-pane" persist="width">
<toolbar align="right">
- <toolbarbutton
- id="zotero-tb-sync"
- image="chrome://zotero/skin/arrow_refresh.png"
- tooltip="_child"
+ <toolbarbutton id="zotero-tb-sync" tooltip="_child"
oncommand="Zotero.Sync.Server.sync()">
<tooltip
onpopupshowing="this.firstChild.nextSibling.value = 'Last sync: ' + (Zotero.Sync.Server.lastLocalSyncTime ? new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000).toLocaleString() : 'Not yet synced')"
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -378,6 +378,8 @@ Zotero.Sync.Server = new function () {
this.logout = logout;
this.setSyncTimeout = setSyncTimeout;
this.clearSyncTimeout = clearSyncTimeout;
+ this.startSyncAnimation = startSyncAnimation;
+ this.stopSyncAnimation = stopSyncAnimation;
this.__defineGetter__('username', function () {
return Zotero.Prefs.get('sync.server.username');
@@ -535,6 +537,7 @@ Zotero.Sync.Server = new function () {
function sync() {
Zotero.Sync.Server.clearSyncTimeout();
+ Zotero.Sync.Server.startSyncAnimation();
if (_attempts < 0) {
_error('Too many attempts in Zotero.Sync.Server.sync()');
@@ -852,6 +855,8 @@ Zotero.Sync.Server = new function () {
if (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) {
if (!xmlhttp.responseXML ||
!xmlhttp.responseXML.childNodes[0] ||
@@ -1054,6 +1075,8 @@ Zotero.Sync.Server = new function () {
Zotero.Sync.Server.unlock()
}
+ Zotero.Sync.Server.stopSyncAnimation();
+
throw(e);
}
}
diff --git a/chrome/skin/default/zotero/arrow_rotate_animated.png b/chrome/skin/default/zotero/arrow_rotate_animated.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/arrow_rotate_static.png b/chrome/skin/default/zotero/arrow_rotate_static.png
Binary files differ.
diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css
@@ -191,6 +191,16 @@
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
{
color: gray;