1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-31 01:12:27 +01:00

move Option constructor to Options, move

Options.{getPref,setPref,getFirefoxPref,setFirefoxPref} to a slot in
vimperator.options and move all option initialisation to Options()
This commit is contained in:
Doug Kearns
2007-08-06 12:52:33 +00:00
parent 0ab80a8d3a
commit 6508cb8c65
4 changed files with 108 additions and 102 deletions

View File

@@ -266,7 +266,7 @@ const vimperator = (function() //{{{
*/
log: function(msg, level)
{
// if (Options.getPref("verbose") >= level) // FIXME: hangs vimperator, probably timing issue --mst
// if (vimperator.options.getPref("verbose") >= level) // FIXME: hangs vimperator, probably timing issue --mst
console_service.logStringMessage('vimperator: ' + msg);
},
@@ -365,9 +365,9 @@ const vimperator = (function() //{{{
quit: function(save_session)
{
if (save_session)
Options.setFirefoxPref("browser.startup.page", 3); // start with saved session
vimperator.options.setFirefoxPref("browser.startup.page", 3); // start with saved session
else
Options.setFirefoxPref("browser.startup.page", 1); // start with default homepage session
vimperator.options.setFirefoxPref("browser.startup.page", 1); // start with default homepage session
goQuitApplication();
},
@@ -626,32 +626,18 @@ const vimperator = (function() //{{{
vimperator.registerCallback("submit", vimperator.modes.EX, function(command) { vimperator.execute(command); } );
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return exTabCompletion(str); } );
// TODO: move most of the following code to Options constructor
// work around firefox popup blocker
popup_allowed_events = Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit');
if (!popup_allowed_events.match("keypress"))
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events + " keypress");
// we have our own typeahead find implementation
Options.setFirefoxPref('accessibility.typeaheadfind.autostart', false);
Options.setFirefoxPref('accessibility.typeaheadfind', false); // actually the above setting should do it, but has no effect in firefox
// first time intro message
if (Options.getPref("firsttime", true))
if (vimperator.options.getPref("firsttime", true))
{
setTimeout(function() {
vimperator.help(null, null, null, { inTab: true });
Options.setPref("firsttime", false);
vimperator.options.setPref("firsttime", false);
}, 1000);
}
//gURLBar.blur(); // TODO: needed anymore?
vimperator.focusContent();
// firefox preferences which we need to be changed to work well with vimperator
Options.setFirefoxPref("browser.startup.page", 3); // start with saved session
// finally, read a ~/.vimperatorrc
// make sourcing asynchronous, otherwise commands that open new tabs won't work
setTimeout(function() {
@@ -683,12 +669,8 @@ const vimperator = (function() //{{{
// save our preferences
vimperator.commandline.destroy();
vimperator.events.destroy();
vimperator.options.destroy();
vimperator.quickmarks.destroy();
// reset some modified firefox prefs
if (Options.getFirefoxPref('dom.popup_allowed_events', 'change click dblclick mouseup reset submit')
== popup_allowed_events + " keypress")
Options.setFirefoxPref('dom.popup_allowed_events', popup_allowed_events);
},
// @param value MUST be a string, it can have the following form: "+20%", "200%", "-30"