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
This commit is contained in:
Dan Stillman 2012-03-12 16:25:35 -04:00
parent daf1899c72
commit ba8bf4910f
2 changed files with 18 additions and 6 deletions

View file

@ -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);
},

View file

@ -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;
}