Bug 464791 - Add ifdef MOZ_UPDATER for the app update preferences UI and Help menu. r=mconnor, approval1.9.1=mconnor

This commit is contained in:
Robert Strong 2008-11-26 00:45:24 -08:00
parent 6f59dac480
commit 83ed1268e6
6 changed files with 43 additions and 17 deletions

View File

@ -67,6 +67,10 @@ ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DHAVE_SHELL_SERVICE=1 DEFINES += -DHAVE_SHELL_SERVICE=1
endif endif
ifdef MOZ_UPDATER
DEFINES += -DMOZ_UPDATER=1
endif
ifneq (,$(filter mac cocoa, $(MOZ_WIDGET_TOOLKIT))) ifneq (,$(filter mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET
endif endif

View File

@ -98,11 +98,13 @@
oncommand="openReleaseNotes(event)" oncommand="openReleaseNotes(event)"
onclick="checkForMiddleClick(this, event);"/> onclick="checkForMiddleClick(this, event);"/>
<menuseparator id="updateSeparator"/> <menuseparator id="updateSeparator"/>
#ifdef MOZ_UPDATER
<menuitem id="checkForUpdates" <menuitem id="checkForUpdates"
accesskey="&updateCmd.accesskey;" accesskey="&updateCmd.accesskey;"
label="&updateCmd.label;" label="&updateCmd.label;"
class="menuitem-iconic" class="menuitem-iconic"
oncommand="checkForUpdates();"/> oncommand="checkForUpdates();"/>
#endif
<menuseparator id="aboutSeparator"/> <menuseparator id="aboutSeparator"/>
<menuitem id="aboutName" <menuitem id="aboutName"
accesskey="&aboutCmd.accesskey;" accesskey="&aboutCmd.accesskey;"

View File

@ -442,7 +442,8 @@ function openReleaseNotes(event)
openUILink(relnotesURL, event, false, true); openUILink(relnotesURL, event, false, true);
} }
#ifdef MOZ_UPDATER
/** /**
* Opens the update manager and checks for updates to the application. * Opens the update manager and checks for updates to the application.
*/ */
@ -463,6 +464,7 @@ function checkForUpdates()
else else
prompter.checkForUpdates(); prompter.checkForUpdates();
} }
#endif
function buildHelpMenu() function buildHelpMenu()
{ {
@ -471,6 +473,7 @@ function buildHelpMenu()
if (typeof safebrowsing != "undefined") if (typeof safebrowsing != "undefined")
safebrowsing.setReportPhishingMenu(); safebrowsing.setReportPhishingMenu();
#ifdef MOZ_UPDATER
var updates = var updates =
Components.classes["@mozilla.org/updates/update-service;1"]. Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService); getService(Components.interfaces.nsIApplicationUpdateService);
@ -519,6 +522,10 @@ function buildHelpMenu()
checkForUpdates.setAttribute("loading", "true"); checkForUpdates.setAttribute("loading", "true");
else else
checkForUpdates.removeAttribute("loading"); checkForUpdates.removeAttribute("loading");
#else
// Needed by safebrowsing for inserting its menuitem so just hide it
document.getElementById("updateSeparator").hidden = true;
#endif
} }
function isElementVisible(aElement) function isElementVisible(aElement)

View File

@ -57,3 +57,7 @@ DEFINES += \
ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT))) ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DHAVE_SHELL_SERVICE=1 DEFINES += -DHAVE_SHELL_SERVICE=1
endif endif
ifdef MOZ_UPDATER
DEFINES += -DMOZ_UPDATER=1
endif

View File

@ -61,9 +61,11 @@ var gAdvancedPane = {
advancedPrefs.selectedIndex = preference.value; advancedPrefs.selectedIndex = preference.value;
} }
#ifdef MOZ_UPDATER
this.updateAppUpdateItems(); this.updateAppUpdateItems();
this.updateAutoItems(); this.updateAutoItems();
this.updateModeItems(); this.updateModeItems();
#endif
this.updateOfflineApps(); this.updateOfflineApps();
}, },
@ -375,6 +377,7 @@ var gAdvancedPane = {
* iii 0/1/2 t true * iii 0/1/2 t true
* *
*/ */
#ifdef MOZ_UPDATER
updateAppUpdateItems: function () updateAppUpdateItems: function ()
{ {
var aus = var aus =
@ -421,18 +424,6 @@ var gAdvancedPane = {
warnIncompatible.disabled = disable; warnIncompatible.disabled = disable;
}, },
/**
* The Extensions checkbox and button are disabled only if the enable Addon
* update preference is locked.
*/
updateAddonUpdateUI: function ()
{
var enabledPref = document.getElementById("extensions.update.enabled");
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
enableAddonUpdate.disabled = enabledPref.locked;
},
/** /**
* Stores the value of the app.update.mode preference, which is a tristate * Stores the value of the app.update.mode preference, which is a tristate
* integer preference. We store the value here so that we can properly * integer preference. We store the value here so that we can properly
@ -483,6 +474,19 @@ var gAdvancedPane = {
.createInstance(Components.interfaces.nsIUpdatePrompt); .createInstance(Components.interfaces.nsIUpdatePrompt);
prompter.showUpdateHistory(window); prompter.showUpdateHistory(window);
}, },
#endif
/**
* The Extensions checkbox and button are disabled only if the enable Addon
* update preference is locked.
*/
updateAddonUpdateUI: function ()
{
var enabledPref = document.getElementById("extensions.update.enabled");
var enableAddonUpdate = document.getElementById("enableAddonUpdate");
enableAddonUpdate.disabled = enabledPref.locked;
},
// ENCRYPTION TAB // ENCRYPTION TAB

View File

@ -85,14 +85,11 @@
<preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/> <preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/>
<!-- Update tab --> <!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled" name="app.update.enabled" type="bool" <preference id="app.update.enabled" name="app.update.enabled" type="bool"
onchange="gAdvancedPane.updateAppUpdateItems(); onchange="gAdvancedPane.updateAppUpdateItems();
gAdvancedPane.updateAutoItems(); gAdvancedPane.updateAutoItems();
gAdvancedPane.updateModeItems();"/> gAdvancedPane.updateModeItems();"/>
<preference id="extensions.update.enabled" name="extensions.update.enabled" type="bool"
onchange="gAdvancedPane.updateAddonUpdateUI();"/>
<preference id="browser.search.update" name="browser.search.update" type="bool"/>
<preference id="app.update.auto" name="app.update.auto" type="bool" <preference id="app.update.auto" name="app.update.auto" type="bool"
onchange="gAdvancedPane.updateAutoItems(); onchange="gAdvancedPane.updateAutoItems();
gAdvancedPane.updateModeItems();"/> gAdvancedPane.updateModeItems();"/>
@ -102,7 +99,11 @@
<preference id="app.update.disable_button.showUpdateHistory" <preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory" name="app.update.disable_button.showUpdateHistory"
type="bool"/> type="bool"/>
#endif
<preference id="extensions.update.enabled" name="extensions.update.enabled" type="bool"
onchange="gAdvancedPane.updateAddonUpdateUI();"/>
<preference id="browser.search.update" name="browser.search.update" type="bool"/>
<!-- Encryption tab --> <!-- Encryption tab -->
<preference id="security.enable_ssl3" name="security.enable_ssl3" type="bool"/> <preference id="security.enable_ssl3" name="security.enable_ssl3" type="bool"/>
@ -267,10 +268,12 @@
<tabpanel id="updatePanel" orient="vertical" align="start"> <tabpanel id="updatePanel" orient="vertical" align="start">
<label control="autoUpdateGroup">&autoCheck.label;</label> <label control="autoUpdateGroup">&autoCheck.label;</label>
<vbox class="indent" id="autoUpdateGroup" role="group"> <vbox class="indent" id="autoUpdateGroup" role="group">
#ifdef MOZ_UPDATER
<checkbox id="enableAppUpdate" <checkbox id="enableAppUpdate"
label="&enableAppUpdate.label;" label="&enableAppUpdate.label;"
accesskey="&enableAppUpdate.accesskey;" accesskey="&enableAppUpdate.accesskey;"
preference="app.update.enabled"/> preference="app.update.enabled"/>
#endif
<checkbox id="enableAddonUpdate" <checkbox id="enableAddonUpdate"
label="&enableAddonsUpdate.label;" label="&enableAddonsUpdate.label;"
accesskey="&enableAddonsUpdate.accesskey;" accesskey="&enableAddonsUpdate.accesskey;"
@ -281,6 +284,7 @@
preference="browser.search.update"/> preference="browser.search.update"/>
</vbox> </vbox>
#ifdef MOZ_UPDATER
<separator id="updateSeparator1"/> <separator id="updateSeparator1"/>
<label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label> <label id="updateModeLabel" control="updateMode">&whenUpdatesFound.label;</label>
@ -309,6 +313,7 @@
preference="app.update.disable_button.showUpdateHistory" preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/> oncommand="gAdvancedPane.showUpdates();"/>
</hbox> </hbox>
#endif
</tabpanel> </tabpanel>
<!-- Encryption --> <!-- Encryption -->