mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 529769 - notify observers when lightweight theme is selected. r=dtownsend
This commit is contained in:
parent
1ccefba1bf
commit
becf5522cc
@ -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;
|
||||||
},
|
},
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user