1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 13:47:59 +01:00

Fix stupid :restart confirmation.

This commit is contained in:
Kris Maglione
2011-01-17 15:18:31 -05:00
parent c51a59d40c
commit 45860b0d58

View File

@@ -1089,6 +1089,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
node.collapsed = !visible; node.collapsed = !visible;
}, },
confirmQuit: function confirmQuit()
prefs.withContext(function () {
prefs.set("browser.warnOnQuit", false);
return !window.canQuitApplication();
}),
/** /**
* Quit the host application, no matter how many tabs/windows are open. * Quit the host application, no matter how many tabs/windows are open.
* *
@@ -1098,11 +1104,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* windows could be closed individually. * windows could be closed individually.
*/ */
quit: function (saveSession, force) { quit: function (saveSession, force) {
if (!force && if (!force && !this.confirmQuit())
prefs.withContext(function () {
prefs.set("browser.warnOnQuit", false);
return !canQuitApplication();
}))
return; return;
let pref = "browser.startup.page"; let pref = "browser.startup.page";
@@ -1115,6 +1117,16 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
services.appStartup.quit(Ci.nsIAppStartup[force ? "eForceQuit" : "eAttemptQuit"]); services.appStartup.quit(Ci.nsIAppStartup[force ? "eForceQuit" : "eAttemptQuit"]);
}, },
/**
* Restart the host application.
*/
restart: function () {
if (!this.confirmQuit())
return;
services.appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
},
/** /**
* Returns an array of URLs parsed from *str*. * Returns an array of URLs parsed from *str*.
* *
@@ -1214,16 +1226,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
util.reportError(error); util.reportError(error);
}, },
/**
* Restart the host application.
*/
restart: function () {
if (!canQuitApplication())
return;
services.appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
},
/** /**
* Parses a Dactyl command-line string i.e. the value of the * Parses a Dactyl command-line string i.e. the value of the
* -dactyl command-line option. * -dactyl command-line option.