[Basilisk] Issue #67 - begin porting over changes to stop using appconstants

This commit is contained in:
Basilisk-Dev 2023-10-02 17:26:33 -04:00 committed by roytam1
commit e1e2d7e832
3 changed files with 22 additions and 21 deletions

View file

@ -6,7 +6,6 @@
// Services = object with smart getters for common XPCOM services
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
function init(aEvent)
{
@ -69,30 +68,29 @@ function init(aEvent)
let arch = bundle.GetStringFromName(archResource);
versionField.textContent += ` (${arch})`;
// TODO: when we get rid of appconstants make this check for Unix and not MacOS
if (AppConstants.platform == "linux") {
// If Linux append the toolkit "(GTK2)" or "(GTK3)"
let toolkit = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).widgetToolkit.toUpperCase();
versionField.textContent += ` (${toolkit})`;
}
#ifdef MOZ_WIDGET_GTK
// If Linux append the toolkit "(GTK2)" or "(GTK3)"
let toolkit = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).widgetToolkit.toUpperCase();
versionField.textContent += ` (${toolkit})`;
#endif
// Get Release Notes URL from Preferences
let releaseNotesURL = Services.prefs.getCharPref("app.releaseNotesURL");
document.getElementById("releasenotes").setAttribute("href", releaseNotesURL);
if (AppConstants.MOZ_UPDATER) {
gAppUpdater = new appUpdater();
#ifdef MOZ_UPDATER
gAppUpdater = new appUpdater();
let channelLabel = document.getElementById("currentChannel");
let currentChannelText = document.getElementById("currentChannelText");
channelLabel.value = UpdateUtils.UpdateChannel;
if (/^release($|\-)/.test(channelLabel.value))
currentChannelText.hidden = true;
}
let channelLabel = document.getElementById("currentChannel");
let currentChannelText = document.getElementById("currentChannelText");
channelLabel.value = UpdateUtils.UpdateChannel;
if (/^release($|\-)/.test(channelLabel.value))
currentChannelText.hidden = true;
#endif
if (AppConstants.platform == "macosx") {
// it may not be sized at this point, and we need its width to calculate its position
window.sizeToContent();
window.moveTo((screen.availWidth / 2) - (window.outerWidth / 2), screen.availHeight / 5);
}
#ifdef XP_MACOSX
// it may not be sized at this point, and we need its width to calculate its position
window.sizeToContent();
window.moveTo((screen.availWidth / 2) - (window.outerWidth / 2), screen.availHeight / 5);
#endif
}