Bug 688824 - Only show restart notification when locale changes. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Mon, 03 Oct 2011 15:13:23 -0700
changeset 79385 077a86b75bdb1156a0c8431ec553652efc4a7121
parent 79384 752009d34465fb99bd7fdf5342b21c67e220f820
child 79386 00de1043242f8bea5438f6ae7545db1767b6a848
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs688824
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 688824 - Only show restart notification when locale changes. r=mfinkle
mobile/chrome/content/preferences.js
--- a/mobile/chrome/content/preferences.js
+++ b/mobile/chrome/content/preferences.js
@@ -99,21 +99,27 @@ var PreferencesView = {
     this._loadLocales();
 
     this._loadHomePage();
 
     MasterPasswordUI.updatePreference();
     WeaveGlue.init();
 
     Services.prefs.addObserver("general.useragent.locale", this, false);
+    let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
+    chrome.QueryInterface(Ci.nsIToolkitChromeRegistry);
+    this._currentLocale = chrome.getSelectedLocale("browser");
   },
 
   observe: function(aSubject, aTopic, aData) {
     if (aData == "general.useragent.locale") {
-      this.showRestart();
+      if (Services.prefs.getCharPref("general.useragent.locale") != this._currentLocale)
+        this.showRestart();
+      else
+        this.hideRestart();
       this._loadLocales();
     }
   },
 
   _loadLocales: function _loadLocales() {
     // Query available and selected locales
     let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
     chrome.QueryInterface(Ci.nsIToolkitChromeRegistry);
@@ -135,17 +141,16 @@ var PreferencesView = {
       let locale = availableLocales.getNext();
       try {
         var label = strings.GetStringFromName(locale);
       } catch (e) {
         label = locale;
       }
       if (locale == selectedLocale) {
         selectedLabel = label;
-        this._currentLocale = locale;
         break;
       }
     }
     document.getElementById("prefs-uilanguage-button").setAttribute("label", selectedLabel);
   },
 
   showLocalePicker: function showLocalePicker() {
     Services.ww.openWindow(window, "chrome://browser/content/localePicker.xul", "_browser", "chrome,dialog=no,all", null);