From ba8bf4910f3ed1c17176dabcce0ef3ba80d0b45a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 12 Mar 2012 16:25:35 -0400 Subject: [PATCH] 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 --- chrome/content/zotero/xpcom/sync.js | 12 ++++++++++++ chrome/content/zotero/zoteroPane.js | 12 ++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 9dce984c7..8221f981f 100644 --- 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 index 343998364..c2ee3f936 100644 --- 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; }