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

Move Tab* event handlers to the tabs module.

This commit is contained in:
Doug Kearns
2009-11-14 04:18:01 +11:00
parent 157fa3b2e5
commit d979eb7326
3 changed files with 27 additions and 22 deletions

View File

@@ -1326,28 +1326,6 @@ const Events = Module("events", {
}
}
let tabContainer = tabs.getBrowser().mTabContainer;
tabContainer.addEventListener("TabMove", function (event) {
statusline.updateTabCount(true);
}, false);
tabContainer.addEventListener("TabOpen", function (event) {
statusline.updateTabCount(true);
}, false);
tabContainer.addEventListener("TabClose", function (event) {
statusline.updateTabCount(true);
}, false);
tabContainer.addEventListener("TabSelect", function (event) {
// TODO: is all of that necessary?
// I vote no. --Kris
modes.reset();
statusline.updateTabCount(true);
tabs.updateSelectionHistory();
if (options["focuscontent"])
setTimeout(function () { liberator.focusContent(true); }, 10); // just make sure, that no widget has focus
}, false);
tabs.getBrowser().addEventListener("DOMContentLoaded", onDOMContentLoaded, true);
// this adds an event which is is called on each page load, even if the

View File

@@ -24,12 +24,36 @@ const Tabs = Module("tabs", {
this._lastBufferSwitchArgs = "";
this._lastBufferSwitchSpecial = true;
let tabContainer = this.getBrowser().mTabContainer;
this._updateTabCount = function () { statusline.updateTabCount(true); };
["TabMove", "TabOpen", "TabClose"].forEach(function (event) {
tabContainer.addEventListener(event, this._updateTabCount, false);
}, this);
this._onTabSelect = function () {
// TODO: is all of that necessary?
// I vote no. --Kris
modes.reset();
statusline.updateTabCount(true);
this.updateSelectionHistory();
if (options["focuscontent"])
setTimeout(function () { liberator.focusContent(true); }, 10); // just make sure, that no widget has focus
};
tabContainer.addEventListener("TabSelect", this.closure._onTabSelect, false);
// hide tabs initially to prevent flickering when 'stal' would hide them
// on startup
if (config.hasTabbrowser)
this.getBrowser().mTabContainer.collapsed = true; // FIXME: see 'stal' comment
},
destroy: function () {
let tabContainer = this.getBrowser().mTabContainer;
["TabMove", "TabOpen", "TabClose"].forEach(function (event) {
tabContainer.removeEventListener(event, this._updateTabCount, false);
}, this);
tabContainer.removeEventListener("TabSelect", this.closure._onTabSelect, false);
},
/**
* @property {Object} The previously accessed tab or null if no tab
* other than the current one has been accessed.

View File

@@ -12,6 +12,9 @@ ARCHITECTURE:
hell, and/or lack support for JS 1.8. --Kris
BUGS:
- Class#closure seems to be throwing [Exception... "Could not convert
JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"]
in as yet underdetermined circumstances.
- add window resize support to hints
- searching backwards incrementally does not work i.e. with 'incsearch' set
- insert abbreviations broken on <space>