Bug 529769 - notify observers when lightweight theme is selected. r=dtownsend
authorDão Gottwald <dao@mozilla.com>
Tue, 24 Nov 2009 16:59:53 +0100
changeset 35218 21e65793a3ccd94aac98baffe39a55e9be7ed7c7
parent 35217 941ad9d7d079246481f365c3cfbfc75a5bbefc94
child 35219 d10f2f103f43bf9abf11759c1cd558f012fcbca1
push idunknown
push userunknown
push dateunknown
reviewersdtownsend
bugs529769
milestone1.9.3a1pre
Bug 529769 - notify observers when lightweight theme is selected. r=dtownsend
toolkit/content/LightweightThemeConsumer.jsm
toolkit/mozapps/extensions/src/LightweightThemeManager.jsm
--- a/toolkit/content/LightweightThemeConsumer.jsm
+++ b/toolkit/content/LightweightThemeConsumer.jsm
@@ -37,35 +37,35 @@
 let EXPORTED_SYMBOLS = ["LightweightThemeConsumer"];
 
 function LightweightThemeConsumer(aDocument) {
   this._doc = aDocument;
   this._footerId = aDocument.documentElement.getAttribute("lightweightthemesfooter");
 
   Components.classes["@mozilla.org/observer-service;1"]
             .getService(Components.interfaces.nsIObserverService)
-            .addObserver(this, "lightweight-theme-changed", false);
+            .addObserver(this, "lightweight-theme-styling-update", false);
 
   var temp = {};
   Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
   this._update(temp.LightweightThemeManager.currentThemeForDisplay);
 }
 
 LightweightThemeConsumer.prototype = {
   observe: function (aSubject, aTopic, aData) {
-    if (aTopic != "lightweight-theme-changed")
+    if (aTopic != "lightweight-theme-styling-update")
       return;
 
     this._update(JSON.parse(aData));
   },
 
   destroy: function () {
     Components.classes["@mozilla.org/observer-service;1"]
               .getService(Components.interfaces.nsIObserverService)
-              .removeObserver(this, "lightweight-theme-changed");
+              .removeObserver(this, "lightweight-theme-styling-update");
 
     this._doc = null;
   },
 
   _update: function (aData) {
     if (!aData)
       aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
 
--- a/toolkit/mozapps/extensions/src/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/src/LightweightThemeManager.jsm
@@ -128,16 +128,17 @@ var LightweightThemeManager = {
 
     if (_previewTimer) {
       _previewTimer.cancel();
       _previewTimer = null;
     }
 
     _prefs.setBoolPref("isThemeSelected", aData != null);
     _notifyWindows(aData);
+    _observerService.notifyObservers(null, "lightweight-theme-changed", null);
 
     if (PERSIST_ENABLED && aData)
       _persistImages(aData);
 
     return aData;
   },
 
   getUsedTheme: function (aId) {
@@ -277,17 +278,17 @@ function _updateUsedThemes(aList) {
     aList.length = MAX_USED_THEMES_COUNT;
 
   _prefs.setCharPref("usedThemes", JSON.stringify(aList));
 
   _observerService.notifyObservers(null, "lightweight-theme-list-changed", null);
 }
 
 function _notifyWindows(aThemeData) {
-  _observerService.notifyObservers(null, "lightweight-theme-changed",
+  _observerService.notifyObservers(null, "lightweight-theme-styling-update",
                                    JSON.stringify(aThemeData));
 }
 
 var _previewTimer;
 var _previewTimerCallback = {
   notify: function () {
     LightweightThemeManager.resetPreview();
   }