commit ba8bf4910f3ed1c17176dabcce0ef3ba80d0b45a
parent daf1899c72fba24a5bbbd35f8ba4cc4414e1bd38
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 12 Mar 2012 16:25:35 -0400
Some tweaks to auto/idle-syncing
- Don't run idle sync if manual sync is required or Zotero is locked
- Don't clear sync error icon when opening pane
- Better debug message on pane open for syncing not being enabled
Diffstat:
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -1057,7 +1057,19 @@ Zotero.Sync.Runner.IdleListener = {
return;
}
+ // TODO: move to Runner.sync()?
+ if (Zotero.locked) {
+ Zotero.debug('Zotero is locked -- skipping idle sync', 4);
+ return;
+ }
+
+ if (Zotero.Sync.Server.manualSyncRequired) {
+ Zotero.debug('Manual sync required -- skipping idle sync', 4);
+ return;
+ }
+
Zotero.debug("Beginning idle sync");
+
Zotero.Sync.Runner.sync(true);
Zotero.Sync.Runner.setSyncTimeout(this._idleTimeout, true);
},
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -411,9 +411,12 @@ var ZoteroPane = new function()
// Auto-sync on pane open
if (Zotero.Prefs.get('sync.autoSync')) {
setTimeout(function () {
- if (!Zotero.Sync.Server.enabled
- || Zotero.Sync.Server.syncInProgress
- || Zotero.Sync.Storage.syncInProgress) {
+ if (!Zotero.Sync.Server.enabled) {
+ Zotero.debug('Sync not enabled -- skipping auto-sync', 4);
+ return;
+ }
+
+ if (Zotero.Sync.Server.syncInProgress || Zotero.Sync.Storage.syncInProgress) {
Zotero.debug('Sync already running -- skipping auto-sync', 4);
return;
}
@@ -433,9 +436,6 @@ var ZoteroPane = new function()
if (Zotero.Sync.Server.syncInProgress || Zotero.Sync.Storage.syncInProgress) {
Zotero.Sync.Runner.setSyncIcon('animate');
}
- else {
- Zotero.Sync.Runner.setSyncIcon();
- }
return true;
}