Bug 648543 - Restart popup is still displayed when the current language pack is selected again [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2011-04-15 12:44:30 +02:00
Родитель 5d7ce76ef4
Коммит 671bc8629e
1 изменённых файлов: 5 добавлений и 10 удалений

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

@ -39,7 +39,6 @@ var PreferencesView = {
_currentLocale: null, _currentLocale: null,
_languages: null, _languages: null,
_msg: null, _msg: null,
_restartCount: 0,
_messageActions: function pv__messageActions(aData) { _messageActions: function pv__messageActions(aData) {
if (aData == "prefs-restart-app") { if (aData == "prefs-restart-app") {
@ -78,9 +77,6 @@ var PreferencesView = {
}, },
showRestart: function ev_showRestart() { showRestart: function ev_showRestart() {
// Increment the count in case the view is not completely initialized
this._restartCount++;
if (this._msg) { if (this._msg) {
let strings = Strings.browser; let strings = Strings.browser;
this.showMessage(strings.GetStringFromName("notificationRestart.normal"), "restart-app", this.showMessage(strings.GetStringFromName("notificationRestart.normal"), "restart-app",
@ -89,8 +85,7 @@ var PreferencesView = {
}, },
hideRestart: function ev_hideRestart() { hideRestart: function ev_hideRestart() {
this._restartCount--; if (this._msg) {
if (this._restartCount == 0 && this._msg) {
let notification = this._msg.getNotificationWithValue("restart-app"); let notification = this._msg.getNotificationWithValue("restart-app");
if (notification) if (notification)
notification.close(); notification.close();
@ -112,10 +107,10 @@ var PreferencesView = {
// Query available and selected locales // Query available and selected locales
let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry); let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
chrome.QueryInterface(Ci.nsIToolkitChromeRegistry); chrome.QueryInterface(Ci.nsIToolkitChromeRegistry);
let selectedLocale = chrome.getSelectedLocale("browser"); let selectedLocale = chrome.getSelectedLocale("browser");
let availableLocales = chrome.getLocalesForPackage("browser"); let availableLocales = chrome.getLocalesForPackage("browser");
let strings = Services.strings.createBundle("chrome://browser/content/languages.properties"); let strings = Services.strings.createBundle("chrome://browser/content/languages.properties");
// Render locale menulist by iterating through the query result from getLocalesForPackage() // Render locale menulist by iterating through the query result from getLocalesForPackage()
@ -142,7 +137,7 @@ var PreferencesView = {
autoDetect = Services.prefs.getBoolPref("intl.locale.matchOS"); autoDetect = Services.prefs.getBoolPref("intl.locale.matchOS");
} }
catch (e) {} catch (e) {}
// Highlight current locale (or auto-detect entry) // Highlight current locale (or auto-detect entry)
if (autoDetect) { if (autoDetect) {
this._languages.selectedItem = document.getElementById("prefs-languages-auto"); this._languages.selectedItem = document.getElementById("prefs-languages-auto");
@ -150,7 +145,7 @@ var PreferencesView = {
} else { } else {
this._languages.selectedItem = selectedItem; this._languages.selectedItem = selectedItem;
} }
// Hide the setting if we only have one locale // Hide the setting if we only have one locale
if (localeCount == 1) if (localeCount == 1)
document.getElementById("prefs-uilanguage").hidden = true; document.getElementById("prefs-uilanguage").hidden = true;