mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:47:57 +01:00
move Options.{setPref,getPref,setFirefoxPref,getFirefoxPref} to slots of vimperator.options
This commit is contained in:
@@ -739,7 +739,7 @@ function QuickMarks() //{{{
|
|||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
var qmarks = {};
|
var qmarks = {};
|
||||||
var saved_marks = Options.getPref("quickmarks", "").split("\n");
|
var saved_marks = vimperator.options.getPref("quickmarks", "").split("\n");
|
||||||
|
|
||||||
// load the saved quickmarks -- TODO: change to sqlite
|
// load the saved quickmarks -- TODO: change to sqlite
|
||||||
for (var i = 0; i < saved_marks.length - 1; i += 2)
|
for (var i = 0; i < saved_marks.length - 1; i += 2)
|
||||||
@@ -833,7 +833,7 @@ function QuickMarks() //{{{
|
|||||||
saved_qmarks += qmarks[i] + "\n";
|
saved_qmarks += qmarks[i] + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Options.setPref("quickmarks", saved_qmarks);
|
vimperator.options.setPref("quickmarks", saved_qmarks);
|
||||||
}
|
}
|
||||||
//}}}
|
//}}}
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ function Events() //{{{
|
|||||||
case vimperator.modes.CARET:
|
case vimperator.modes.CARET:
|
||||||
// setting this option will trigger an observer which will care about all other details
|
// setting this option will trigger an observer which will care about all other details
|
||||||
// like setting the NORMAL mode
|
// like setting the NORMAL mode
|
||||||
Options.setFirefoxPref("accessibility.browsewithcaret", false);
|
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vimperator.modes.INSERT:
|
case vimperator.modes.INSERT:
|
||||||
@@ -905,7 +905,7 @@ function Events() //{{{
|
|||||||
switch (aData)
|
switch (aData)
|
||||||
{
|
{
|
||||||
case "accessibility.browsewithcaret":
|
case "accessibility.browsewithcaret":
|
||||||
var value = Options.getFirefoxPref("accessibility.browsewithcaret", false);
|
var value = vimperator.options.getFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
vimperator.mode = value ? vimperator.modes.CARET : vimperator.modes.NORMAL;
|
vimperator.mode = value ? vimperator.modes.CARET : vimperator.modes.NORMAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ function Mappings() //{{{
|
|||||||
{
|
{
|
||||||
// setting this option triggers an observer
|
// setting this option triggers an observer
|
||||||
// which takes care of the mode setting
|
// which takes care of the mode setting
|
||||||
Options.setFirefoxPref("accessibility.browsewithcaret", true);
|
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", true);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
short_help: "Start caret mode",
|
short_help: "Start caret mode",
|
||||||
|
|||||||
@@ -103,9 +103,9 @@ vimperator.modes = (function()
|
|||||||
|
|
||||||
if (newmode == vimperator.modes.NORMAL)
|
if (newmode == vimperator.modes.NORMAL)
|
||||||
{
|
{
|
||||||
var value = Options.getFirefoxPref("accessibility.browsewithcaret", false);
|
var value = vimperator.options.getFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
if (value)
|
if (value)
|
||||||
Options.setFirefoxPref("accessibility.browsewithcaret", false);
|
vimperator.options.setFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
|
|
||||||
vimperator.statusline.updateUrl();
|
vimperator.statusline.updateUrl();
|
||||||
vimperator.focusContent();
|
vimperator.focusContent();
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ function Option(names, type, extra_info) //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: forced defaults need to use Options.getPref
|
// NOTE: forced defaults need to use vimperator.options.getPref
|
||||||
this.__defineGetter__("value",
|
this.__defineGetter__("value",
|
||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
@@ -363,22 +363,22 @@ function Options() //{{{
|
|||||||
|
|
||||||
// TODO: separate Preferences from Options? Would these utility functions
|
// TODO: separate Preferences from Options? Would these utility functions
|
||||||
// be better placed in the 'core' vimperator namespace somewhere?
|
// be better placed in the 'core' vimperator namespace somewhere?
|
||||||
Options.setPref = function(name, value)
|
this.setPref = function(name, value)
|
||||||
{
|
{
|
||||||
return storePreference(name, value, true);
|
return storePreference(name, value, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Options.getPref = function(name, forced_default)
|
this.getPref = function(name, forced_default)
|
||||||
{
|
{
|
||||||
return loadPreference(name, forced_default, true);
|
return loadPreference(name, forced_default, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Options.setFirefoxPref = function(name, value)
|
this.setFirefoxPref = function(name, value)
|
||||||
{
|
{
|
||||||
return storePreference(name, value);
|
return storePreference(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Options.getFirefoxPref = function(name, forced_default)
|
this.getFirefoxPref = function(name, forced_default)
|
||||||
{
|
{
|
||||||
return loadPreference(name, forced_default);
|
return loadPreference(name, forced_default);
|
||||||
}
|
}
|
||||||
@@ -688,7 +688,7 @@ function Options() //{{{
|
|||||||
addOption(new Option(["visualbell", "vb"], "boolean",
|
addOption(new Option(["visualbell", "vb"], "boolean",
|
||||||
{
|
{
|
||||||
short_help: "Use visual bell instead of beeping on errors",
|
short_help: "Use visual bell instead of beeping on errors",
|
||||||
setter: function(value) { Options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
|
setter: function(value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
|
||||||
default_value: false
|
default_value: false
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ function CommandLine() //{{{
|
|||||||
|
|
||||||
load: function()
|
load: function()
|
||||||
{
|
{
|
||||||
this.cmd = Options.getPref("commandline_cmd_history", "").split("\n");
|
this.cmd = vimperator.options.getPref("commandline_cmd_history", "").split("\n");
|
||||||
this.search = Options.getPref("commandline_search_history", "").split("\n");
|
this.search = vimperator.options.getPref("commandline_search_history", "").split("\n");
|
||||||
},
|
},
|
||||||
|
|
||||||
save: function()
|
save: function()
|
||||||
{
|
{
|
||||||
Options.setPref("commandline_cmd_history", this.cmd.join("\n"));
|
vimperator.options.setPref("commandline_cmd_history", this.cmd.join("\n"));
|
||||||
Options.setPref("commandline_search_history", this.search.join("\n"));
|
vimperator.options.setPref("commandline_search_history", this.search.join("\n"));
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function(str)
|
add: function(str)
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ const vimperator = (function() //{{{
|
|||||||
// if msg is an object, it is beautified
|
// if msg is an object, it is beautified
|
||||||
log: function(msg, level)
|
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
|
||||||
if (typeof msg == "object")
|
if (typeof msg == "object")
|
||||||
msg = this.objectToString(msg, false);
|
msg = this.objectToString(msg, false);
|
||||||
|
|
||||||
@@ -366,9 +366,9 @@ const vimperator = (function() //{{{
|
|||||||
quit: function(save_session)
|
quit: function(save_session)
|
||||||
{
|
{
|
||||||
if (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
|
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();
|
goQuitApplication();
|
||||||
},
|
},
|
||||||
@@ -614,16 +614,16 @@ const vimperator = (function() //{{{
|
|||||||
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return vimperator.completion.exTabCompletion(str); } );
|
vimperator.registerCallback("complete", vimperator.modes.EX, function(str) { return vimperator.completion.exTabCompletion(str); } );
|
||||||
|
|
||||||
// first time intro message
|
// first time intro message
|
||||||
if (Options.getPref("firsttime", true))
|
if (vimperator.options.getPref("firsttime", true))
|
||||||
{
|
{
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
vimperator.help(null, null, null, { inTab: true });
|
vimperator.help(null, null, null, { inTab: true });
|
||||||
Options.setPref("firsttime", false);
|
vimperator.options.setPref("firsttime", false);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable caret browsing initially
|
// disable caret browsing initially
|
||||||
//Options.setFirefoxPref("accessibility.browsewithcaret", false);
|
//vimperator.options.setFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
//vimperator.focusContent();
|
//vimperator.focusContent();
|
||||||
|
|
||||||
// always start in normal mode
|
// always start in normal mode
|
||||||
|
|||||||
Reference in New Issue
Block a user