1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 15:24:12 +01:00

Add bookmarks, diverted, links to 'activate'.

This commit is contained in:
Kris Maglione
2010-09-28 10:39:40 -04:00
parent d6aa3d5ef0
commit 017258955b
5 changed files with 33 additions and 21 deletions

View File

@@ -847,8 +847,10 @@ const Options = Module("options", {
return this._loadPreference(name, forcedDefault);
},
_checkPrefSafe: function (name, message) {
_checkPrefSafe: function (name, message, value) {
let curval = this._loadPreference(name, null, false);
if (arguments.length > 2 && curval === value)
return;
let defval = this._loadPreference(name, null, true);
let saved = this._loadPreference(Options.SAVED + name);
@@ -881,7 +883,7 @@ const Options = Module("options", {
* @param {value} value The new preference value.
*/
safeSetPref: function (name, value, message) {
this._checkPrefSafe(name, message);
this._checkPrefSafe(name, message, value);
this._storePreference(name, value);
this._storePreference(Options.SAVED + name, value);
},

View File

@@ -1014,20 +1014,33 @@ const Tabs = Module("tabs", {
});
if (config.hasTabbrowser) {
let activateGroups = [
["addons", ":addo[ns] command"],
["bookmarks", "Tabs loaded from bookmarks", "loadBookmarksInBackground"],
["diverted", "Links with targets set to new tabs", "loadDivertedInBackground"],
["downloads", ":downl[oads] command"],
["extoptions", ":exto[ptions] command"],
["help", ":h[elp] command"],
["homepage", "gH mapping"],
["links", "Middle- or Control-clicked links", "loadInBackground"],
["quickmark", "go and gn mappings"],
["tabopen", ":tabopen[!] command"],
["paste", "P and gP mappings"]
];
options.add(["activate", "act"],
"Define when tabs are automatically activated",
"stringlist", "addons,downloads,extoptions,help,homepage,quickmark,tabopen,paste",
"stringlist", [g[0] for (g in values(activateGroups)) if (!g[2] || !options.getPref("browser.tabs." + g[2]))].join(","),
{
completer: function (context) [
["addons", ":addo[ns] command"],
["downloads", ":downl[oads] command"],
["extoptions", ":exto[ptions] command"],
["help", ":h[elp] command"],
["homepage", "gH mapping"],
["quickmark", "go and gn mappings"],
["tabopen", ":tabopen[!] command"],
["paste", "P and gP mappings"]
]
completer: function (context) activateGroups,
setter: function (newValues) {
let valueSet = set(newValues);
for (let group in values(activateGroups))
if (group[2])
options.safeSetPref("browser.tabs." + group[2],
!(valueSet["all"] || valueSet[group[0]]),
"See the 'activate' option");
return newValues;
}
});
options.add(["newtab"],