Bug 770559 - Add support for inactive databases (folders) [SeaMonkey part] r=IanN,Standard8 sr=Neil
authorEdmund Wong <ewong@pw-wspx.org>
Sat, 28 Jul 2012 12:11:08 +0800
changeset 10765 a3b46de2b0865c1a39360676f9cf1125283957fc
parent 10764 378040aa810f0166cfd739060481ac777fa52529
child 10766 739480bb940740e77622676245636c30df9db804
push id8091
push userewong@pw-wspx.org
push dateSat, 28 Jul 2012 04:14:54 +0000
treeherdercomm-central@a3b46de2b086 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, Standard8, Neil
bugs770559
Bug 770559 - Add support for inactive databases (folders) [SeaMonkey part] r=IanN,Standard8 sr=Neil
mail/base/modules/Makefile.in
mail/base/modules/msgDBCacheManager.js
mailnews/base/util/Makefile.in
mailnews/base/util/msgDBCacheManager.js
suite/mailnews/msgMail3PaneWindow.js
--- a/mail/base/modules/Makefile.in
+++ b/mail/base/modules/Makefile.in
@@ -15,17 +15,16 @@ EXTRA_JS_MODULES = \
   MailUtils.js \
   attachmentChecker.js \
   dbViewWrapper.js \
   mailViewManager.js \
   quickFilterManager.js \
   searchSpec.js \
   MsgHdrSyntheticView.js \
   sessionStoreManager.js \
-  msgDBCacheManager.js \
   summaryFrameManager.js \
   mailMigrator.js \
   mailInstrumentation.js \
   glodaWebSearch.js \
   oauth.jsm \
   http.jsm \
   distribution.js \
   $(NULL)
--- a/mailnews/base/util/Makefile.in
+++ b/mailnews/base/util/Makefile.in
@@ -62,16 +62,17 @@ EXTRA_JS_MODULES = \
 		iteratorUtils.jsm \
 		jsTreeSelection.js \
 		traceHelper.js \
 		StringBundle.js \
 		templateUtils.js \
 		IOUtils.js \
 		mailnewsMigrator.js \
 		mailServices.js \
+		msgDBCacheManager.js \
 		$(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 DEFINES		+= -D_IMPL_NS_MSG_BASE
 
 ifeq ($(OS_ARCH),WINNT)
rename from mail/base/modules/msgDBCacheManager.js
rename to mailnews/base/util/msgDBCacheManager.js
--- a/mail/base/modules/msgDBCacheManager.js
+++ b/mailnews/base/util/msgDBCacheManager.js
@@ -33,23 +33,23 @@ var msgDBCacheManager =
 
   _msgDBCacheTimerIntervalMS: DBCACHE_INTERVAL_DEFAULT_MS,
 
   /**
    * This is called on startup
    */
   init: function dbcachemgr_init()
   {
+    if (this._initialized)
+      return;
 
     // we listen for "quit-application-granted" instead of
     // "quit-application-requested" because other observers of the
     // latter can cancel the shutdown.
-    var observerSvc = Cc["@mozilla.org/observer-service;1"]
-                      .getService(Ci.nsIObserverService);
-    observerSvc.addObserver(this, "quit-application-granted", false);
+    Services.obs.addObserver(this, "quit-application-granted", false);
 
     this.startPeriodicCheck();
 
     this._initialized = true;
   },
 
 /* ........ Timer Callback ................*/
 
--- a/suite/mailnews/msgMail3PaneWindow.js
+++ b/suite/mailnews/msgMail3PaneWindow.js
@@ -1,14 +1,15 @@
 /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* This is where functions related to the 3 pane window are kept */
+Components.utils.import("resource:///modules/msgDBCacheManager.js");
 
 // from MailNewsTypes.h
 const nsMsgKey_None = 0xFFFFFFFF;
 const nsMsgViewIndex_None = 0xFFFFFFFF;
 const kMailCheckOncePrefName = "mail.startup.enabledMailCheckOnce";
 
 var gFolderTree;
 var gSearchInput;
@@ -668,16 +669,17 @@ function OnLoadMessenger()
 {
   AddMailOfflineObserver();
   CreateMailWindowGlobals();
   pref.addObserver("mail.pane_config.dynamic", MailPrefObserver, false);
   pref.addObserver("mail.showCondensedAddresses", MailPrefObserver, false);
   UpdateMailPaneConfig();
   Create3PaneGlobals();
   verifyAccounts(null, false);
+  msgDBCacheManager.init();
 
   // initialize tabmail system - see tabmail.js and tabmail.xml for details
   let tabmail = GetTabMail();
   tabmail.registerTabType(gMailNewsTabsType);
   tabmail.openFirstTab();
   Services.obs.addObserver(MailWindowIsClosing,
                            "quit-application-requested", false);