mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-19 23:07:33 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
18869d3807
54 changed files with 362 additions and 1459 deletions
|
|
@ -78,18 +78,6 @@ var gMainPane = {
|
|||
setEventListener("chooseFolder", "command",
|
||||
gMainPane.chooseFolder);
|
||||
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
let uAppData = OS.Constants.Path.userApplicationDataDir;
|
||||
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
|
||||
|
||||
setEventListener("separateProfileMode", "command", gMainPane.separateProfileModeChange);
|
||||
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
|
||||
setEventListener("getStarted", "click", gMainPane.onGetStarted);
|
||||
|
||||
OS.File.stat(ignoreSeparateProfile).then(() => separateProfileModeCheckbox.checked = false,
|
||||
() => separateProfileModeCheckbox.checked = true);
|
||||
}
|
||||
|
||||
// Notify observers that the UI is now ready
|
||||
Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService)
|
||||
|
|
@ -101,71 +89,6 @@ var gMainPane = {
|
|||
// **STUB**
|
||||
},
|
||||
|
||||
separateProfileModeChange: function ()
|
||||
{
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
function quitApp() {
|
||||
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestartNotSameProfile);
|
||||
}
|
||||
function revertCheckbox(error) {
|
||||
separateProfileModeCheckbox.checked = !separateProfileModeCheckbox.checked;
|
||||
if (error) {
|
||||
Cu.reportError("Failed to toggle separate profile mode: " + error);
|
||||
}
|
||||
}
|
||||
function createOrRemoveSpecialDevEditionFile(onSuccess) {
|
||||
let uAppData = OS.Constants.Path.userApplicationDataDir;
|
||||
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
|
||||
|
||||
if (separateProfileModeCheckbox.checked) {
|
||||
OS.File.remove(ignoreSeparateProfile).then(onSuccess, revertCheckbox);
|
||||
} else {
|
||||
OS.File.writeAtomic(ignoreSeparateProfile, new Uint8Array()).then(onSuccess, revertCheckbox);
|
||||
}
|
||||
}
|
||||
|
||||
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
|
||||
let button_index = confirmRestartPrompt(separateProfileModeCheckbox.checked,
|
||||
0, false, true);
|
||||
switch (button_index) {
|
||||
case CONFIRM_RESTART_PROMPT_CANCEL:
|
||||
revertCheckbox();
|
||||
return;
|
||||
case CONFIRM_RESTART_PROMPT_RESTART_NOW:
|
||||
const Cc = Components.classes, Ci = Components.interfaces;
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
|
||||
"restart");
|
||||
if (!cancelQuit.data) {
|
||||
createOrRemoveSpecialDevEditionFile(quitApp);
|
||||
return;
|
||||
}
|
||||
|
||||
// Revert the checkbox in case we didn't quit
|
||||
revertCheckbox();
|
||||
return;
|
||||
case CONFIRM_RESTART_PROMPT_RESTART_LATER:
|
||||
createOrRemoveSpecialDevEditionFile();
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onGetStarted: function (aEvent) {
|
||||
if (AppConstants.MOZ_DEV_EDITION) {
|
||||
const Cc = Components.classes, Ci = Components.interfaces;
|
||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator);
|
||||
let win = wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
if (win) {
|
||||
let accountsTab = win.gBrowser.addTab("about:accounts?action=signin&entrypoint=dev-edition-setup");
|
||||
win.gBrowser.selectedTab = accountsTab;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// HOME PAGE
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -112,17 +112,6 @@
|
|||
hidden="true">
|
||||
<caption><label>&startup.label;</label></caption>
|
||||
|
||||
#ifdef MOZ_DEV_EDITION
|
||||
<vbox id="separateProfileBox">
|
||||
<checkbox id="separateProfileMode"
|
||||
label="&separateProfileMode.label;"/>
|
||||
<hbox align="center" class="indent">
|
||||
<label id="useFirefoxSync">&useFirefoxSync.label;</label>
|
||||
<label id="getStarted" class="text-link">&getStarted.label;</label>
|
||||
</hbox>
|
||||
</vbox>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SHELL_SERVICE
|
||||
<vbox id="defaultBrowserBox">
|
||||
<hbox align="center">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue