Bug 563241 Support dynamic skin switching preference r=Mossop

This commit is contained in:
Neil Rashbrook 2010-05-28 10:07:21 +01:00
Родитель cfcb3b1341
Коммит ed0ee3dce7
1 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -1956,7 +1956,8 @@ var XPIProvider = {
// If the theme we're enabling is the skin currently selected then it doesn't
// require a restart to enable it.
if (aAddon.type == "theme")
return aAddon.internalName != this.currentSkin;
return aAddon.internalName != this.currentSkin &&
!Prefs.getBoolPref(PREF_EM_DSS_ENABLED);
return !aAddon.bootstrap;
},
@ -1974,7 +1975,8 @@ var XPIProvider = {
// a restart if enabling the other theme does too. If the selected skin doesn't
// match the current skin then a restart is necessary.
if (aAddon.type == "theme")
return this.selectedSkin != this.currentSkin;
return this.selectedSkin != this.currentSkin &&
!Prefs.getBoolPref(PREF_EM_DSS_ENABLED);
return !aAddon.bootstrap;
},
@ -1989,7 +1991,8 @@ var XPIProvider = {
installRequiresRestart: function XPI_installRequiresRestart(aAddon) {
// Themes not currently in use can be installed immediately
if (aAddon.type == "theme")
return aAddon.internalName == this.currentSkin;
return aAddon.internalName == this.currentSkin ||
Prefs.getBoolPref(PREF_EM_DSS_ENABLED);
return !aAddon.bootstrap;
},
@ -2004,7 +2007,8 @@ var XPIProvider = {
uninstallRequiresRestart: function XPI_uninstallRequiresRestart(aAddon) {
// Themes not currently in use can be uninstalled immediately
if (aAddon.type == "theme")
return aAddon.internalName == this.currentSkin;
return aAddon.internalName == this.currentSkin ||
Prefs.getBoolPref(PREF_EM_DSS_ENABLED);
return !aAddon.bootstrap;
},
@ -2466,6 +2470,7 @@ var XPIDatabase = {
"type<>'theme' AND bootstrap=0",
getActiveTheme: "SELECT " + FIELDS_ADDON + " FROM addon WHERE " +
"internalName=:internalName AND type='theme'",
getThemes: "SELECT " + FIELDS_ADDON + " FROM addon WHERE type='theme'",
getAddonInLocation: "SELECT " + FIELDS_ADDON + " FROM addon WHERE id=:id " +
"AND location=:location",
@ -3445,7 +3450,7 @@ var XPIDatabase = {
updateAddonActive: function XPIDB_updateAddonActive(aAddon) {
LOG("Updating add-on state");
stmt = this.getStatement("updateAddonActive");
let stmt = this.getStatement("updateAddonActive");
stmt.params.internal_id = aAddon._internal_id;
stmt.params.active = aAddon.active ? 1 : 0;
executeStatement(stmt);
@ -3490,8 +3495,13 @@ var XPIDatabase = {
// The selected skin may come from an inactive theme (the default theme
// when a lightweight theme is applied for example)
text += "\r\n[ThemeDirs]\r\n";
stmt = this.getStatement("getActiveTheme");
stmt.params.internalName = XPIProvider.selectedSkin;
if (Prefs.getBoolPref(PREF_EM_DSS_ENABLED)) {
stmt = this.getStatement("getThemes");
}
else {
stmt = this.getStatement("getActiveTheme");
stmt.params.internalName = XPIProvider.selectedSkin;
}
count = 0;
for (let row in resultRows(stmt)) {
// Don't include add-ons that are waiting to be updated