Bug 529769 - notify observers when lightweight theme is selected. r=dtownsend

This commit is contained in:
Dão Gottwald 2009-11-24 16:59:53 +01:00
parent 1ccefba1bf
commit becf5522cc
2 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ function LightweightThemeConsumer(aDocument) {
Components.classes["@mozilla.org/observer-service;1"] Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService) .getService(Components.interfaces.nsIObserverService)
.addObserver(this, "lightweight-theme-changed", false); .addObserver(this, "lightweight-theme-styling-update", false);
var temp = {}; var temp = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp); Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
@ -51,7 +51,7 @@ function LightweightThemeConsumer(aDocument) {
LightweightThemeConsumer.prototype = { LightweightThemeConsumer.prototype = {
observe: function (aSubject, aTopic, aData) { observe: function (aSubject, aTopic, aData) {
if (aTopic != "lightweight-theme-changed") if (aTopic != "lightweight-theme-styling-update")
return; return;
this._update(JSON.parse(aData)); this._update(JSON.parse(aData));
@ -60,7 +60,7 @@ LightweightThemeConsumer.prototype = {
destroy: function () { destroy: function () {
Components.classes["@mozilla.org/observer-service;1"] Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService) .getService(Components.interfaces.nsIObserverService)
.removeObserver(this, "lightweight-theme-changed"); .removeObserver(this, "lightweight-theme-styling-update");
this._doc = null; this._doc = null;
}, },

View File

@ -133,6 +133,7 @@ var LightweightThemeManager = {
_prefs.setBoolPref("isThemeSelected", aData != null); _prefs.setBoolPref("isThemeSelected", aData != null);
_notifyWindows(aData); _notifyWindows(aData);
_observerService.notifyObservers(null, "lightweight-theme-changed", null);
if (PERSIST_ENABLED && aData) if (PERSIST_ENABLED && aData)
_persistImages(aData); _persistImages(aData);
@ -282,7 +283,7 @@ function _updateUsedThemes(aList) {
} }
function _notifyWindows(aThemeData) { function _notifyWindows(aThemeData) {
_observerService.notifyObservers(null, "lightweight-theme-changed", _observerService.notifyObservers(null, "lightweight-theme-styling-update",
JSON.stringify(aThemeData)); JSON.stringify(aThemeData));
} }