1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-01 06:25:47 +01:00

[bootstrap] Changes toward proper reinitialization after disabling.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-24 15:51:02 -05:00
parent 0d8f23fea5
commit 2f081bd805
7 changed files with 269 additions and 238 deletions

View File

@@ -136,7 +136,7 @@ const CommandWidgets = Class("CommandWidgets", {
if (this.command && !options.get("guioptions").has("M"))
return this.statusbar;
let statusElem = this.statusbar.message;
if (value && statusElem.editor.rootElement.scrollWidth > statusElem.scrollWidth)
if (value && statusElem.inputField.editor.rootElement.scrollWidth > statusElem.scrollWidth)
return this.commandbar;
return this.activeGroup.mode;
}
@@ -164,9 +164,12 @@ const CommandWidgets = Class("CommandWidgets", {
addElement: function (obj) {
const self = this;
this.elements[obj.name] = obj;
function get(id) obj.getElement ? obj.getElement(id) : document.getElementById(id);
this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-" + (obj.id || obj.name)));
memoize(this.commandbar, obj.name, function () get("dactyl-" + (obj.id || obj.name)));

View File

@@ -38,6 +38,19 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
};
},
cleanup: function () {
delete window.dactyl;
delete window.liberator;
},
destroy: function () {
autocommands.trigger("LeavePre", {});
storage.saveAll();
dactyl.triggerObserver("shutdown", null);
util.dump("All dactyl modules destroyed\n");
autocommands.trigger("Leave", {});
},
observe: {
"dactyl-cleanup": function () {
for (let [, mod] in iter(array(values(modules)).reverse()))
@@ -65,20 +78,6 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
return "unknown";
}),
cleanup: function () {
delete window.dactyl;
delete window.modules;
delete window.liberator;
},
destroy: function () {
autocommands.trigger("LeavePre", {});
storage.saveAll();
dactyl.triggerObserver("shutdown", null);
util.dump("All dactyl modules destroyed\n");
autocommands.trigger("Leave", {});
},
/**
* @property {number} The current main mode.
* @see modes#mainModes