Bug 480696 - Add ifdef MOZ_UPDATER for the app update preferences UI and Help menu. r=Neil f=sgautherie
authorEdmund Wong <ewong@pw-wspx.org>
Wed, 27 Apr 2011 00:48:00 +0200
changeset 7703 6d6c201242f38cc63b77a0c96284d89edb3a3844
parent 7702 a65037910984149a1836c0dbb265fdc7f78e7902
child 7704 82c95f65d579756e3e99ddd44943de5c9d7e3d05
push idunknown
push userunknown
push dateunknown
reviewersNeil
bugs480696
Bug 480696 - Add ifdef MOZ_UPDATER for the app update preferences UI and Help menu. r=Neil f=sgautherie
suite/common/pref/pref-smartupdate.js
suite/common/pref/pref-smartupdate.xul
suite/common/utilityOverlay.js
--- a/suite/common/pref/pref-smartupdate.js
+++ b/suite/common/pref/pref-smartupdate.js
@@ -37,22 +37,32 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 var gCanCheckForUpdates;
 
 function Startup()
 {
-  var aus = Components.classes["@mozilla.org/updates/update-service;1"]
-                      .getService(Components.interfaces.nsIApplicationUpdateService);
-  gCanCheckForUpdates = aus.canCheckForUpdates;
+  var hasUpdater = "nsIApplicationUpdateService" in Components.interfaces;
+
+  if (hasUpdater)
+  {
+    var aus = Components.classes["@mozilla.org/updates/update-service;1"]
+                        .getService(Components.interfaces.nsIApplicationUpdateService);
+    gCanCheckForUpdates = aus.canCheckForUpdates;
 
-  UpdateAddonsItems();
-  UpdateAppItems();
+    UpdateAddonsItems();
+    UpdateAppItems();
+  }
+  else
+  {
+    var appGroupBox = document.getElementById("appUpdatesGroupBox");
+    appGroupBox.hidden = true;
+  }
 }
 
 /*
  * Preferences:
  *
  * app.update.enabled
  * - boolean:
  * - true if updates to the application are enabled, false otherwise
--- a/suite/common/pref/pref-smartupdate.xul
+++ b/suite/common/pref/pref-smartupdate.xul
@@ -136,17 +136,17 @@
                     preference="extensions.getAddons.cache.enabled"/>
           <label id="addonManagerLink"
                  class="text-link"
                  onclick="toEM('addons://list/extension');"
                  value="&addonManagerLink.label;"/>
         </hbox>
     </groupbox>
 
-    <groupbox>
+    <groupbox id="appUpdatesGroupBox">
       <caption label="&appUpdates.caption;"/>
          <hbox>
            <checkbox id="appUpdatesEnabled"
                      label="&autoAppUpdates.label;"
                      accesskey="&autoAppUpdates.accesskey;"
                      preference="app.update.enabled"/>
            <radiogroup id="appUpdateFrequency"
                        orient="horizontal"
--- a/suite/common/utilityOverlay.js
+++ b/suite/common/utilityOverlay.js
@@ -682,26 +682,38 @@ function checkForUpdates()
   if (um.activeUpdate && um.activeUpdate.state == "pending")
     prompter.showUpdateDownloaded(um.activeUpdate);
   else
     prompter.checkForUpdates();
 }
 
 function updateCheckUpdatesItem()
 {
+  var hasUpdater = "nsIApplicationUpdateService" in Components.interfaces;
+  var checkForUpdates = document.getElementById("checkForUpdates");
+
+  if (!hasUpdater)
+  {
+    var updateSeparator = document.getElementById("updateSeparator");
+
+    checkForUpdates.hidden = true;
+    updateSeparator.hidden = true;
+    return;
+  }
+
   var updates = Components.classes["@mozilla.org/updates/update-service;1"]
                           .getService(Components.interfaces.nsIApplicationUpdateService);
   var um = Components.classes["@mozilla.org/updates/update-manager;1"]
                      .getService(Components.interfaces.nsIUpdateManager);
 
   // Disable the UI if the update enabled pref has been locked by the
   // administrator or if we cannot update for some other reason.
-  var checkForUpdates = document.getElementById("checkForUpdates");
   var canCheckForUpdates = updates.canCheckForUpdates;
   checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
+
   if (!canCheckForUpdates)
     return;
 
   // By default, show "Check for Updates..."
   var key = "default";
   if (um.activeUpdate) {
     switch (um.activeUpdate.state) {
     case "downloading":