mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-28 11:25:46 +01:00
Migrage from liberator.saved. to extensions.liberator.saved.
This commit is contained in:
@@ -448,8 +448,8 @@ function Options() //{{{
|
|||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// TODO: migrate liberator.saved.* prefs to extensions.liberator.saved.*
|
|
||||||
const SAVED = "extensions.liberator.saved.";
|
const SAVED = "extensions.liberator.saved.";
|
||||||
|
const OLD_SAVED = "liberator.saved.";
|
||||||
|
|
||||||
const optionHash = {};
|
const optionHash = {};
|
||||||
|
|
||||||
@@ -925,9 +925,7 @@ function Options() //{{{
|
|||||||
liberator.registerObserver("load_completion", function () {
|
liberator.registerObserver("load_completion", function () {
|
||||||
completion.setFunctionCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
|
completion.setFunctionCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
|
||||||
completion.setFunctionCompleter([options.getPref, options.safeSetPref, options.setPref, options.resetPref, options.invertPref],
|
completion.setFunctionCompleter([options.getPref, options.safeSetPref, options.setPref, options.resetPref, options.invertPref],
|
||||||
[function () services.get("pref")
|
[function () options.allPrefs().map(function (pref) [pref, ""])]);
|
||||||
.getChildList("", { value: 0 })
|
|
||||||
.map(function (pref) [pref, ""])]);
|
|
||||||
|
|
||||||
completion.option = function option(context, scope) {
|
completion.option = function option(context, scope) {
|
||||||
context.title = ["Option"];
|
context.title = ["Option"];
|
||||||
@@ -990,7 +988,7 @@ function Options() //{{{
|
|||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
context.title = [config.hostApplication + " Preference", "Value"];
|
context.title = [config.hostApplication + " Preference", "Value"];
|
||||||
context.keys = { text: function (item) item, description: function (item) options.getPref(item) };
|
context.keys = { text: function (item) item, description: function (item) options.getPref(item) };
|
||||||
context.completions = services.get("pref").getChildList("", { value: 0 });
|
context.completions = options.allPrefs();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1095,6 +1093,14 @@ function Options() //{{{
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the names of all preferences.
|
||||||
|
*
|
||||||
|
* @param {string} branch The branch in which to search preferences.
|
||||||
|
* @default ""
|
||||||
|
*/
|
||||||
|
allPrefs: function (branch) services.get("pref").getChildList(branch || "", { value: 0 }),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the option with <b>name</b> in the specified <b>scope</b>.
|
* Returns the option with <b>name</b> in the specified <b>scope</b>.
|
||||||
*
|
*
|
||||||
@@ -1402,6 +1408,14 @@ function Options() //{{{
|
|||||||
}
|
}
|
||||||
}; //}}}
|
}; //}}}
|
||||||
|
|
||||||
|
for (let [, pref] in Iterator(self.allPrefs(OLD_SAVED)))
|
||||||
|
{
|
||||||
|
let saved = SAVED + pref.substr(OLD_SAVED.length)
|
||||||
|
if (!self.getPref(saved))
|
||||||
|
self.setPref(saved, self.getPref(pref));
|
||||||
|
self.resetPref(pref);
|
||||||
|
}
|
||||||
|
|
||||||
self.prefObserver.register();
|
self.prefObserver.register();
|
||||||
liberator.registerObserver("shutdown", function () {
|
liberator.registerObserver("shutdown", function () {
|
||||||
self.prefObserver.unregister();
|
self.prefObserver.unregister();
|
||||||
|
|||||||
Reference in New Issue
Block a user