mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 08:47:59 +01:00
Cleanup sidebar menu generation.
This commit is contained in:
@@ -51,6 +51,24 @@ var ConfigBase = Class("ConfigBase", {
|
||||
|
||||
Local: function Local(dactyl, modules, window)
|
||||
let ({modes} = modules) ({
|
||||
init: function init() {
|
||||
|
||||
let append = <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||
<menupopup id="viewSidebarMenu"/>
|
||||
<broadcasterset id="mainBroadcasterSet"/>
|
||||
</e4x>;
|
||||
for each (let [id, [name, key, uri]] in Iterator(this.sidebars)) {
|
||||
append.XUL::menupopup[0].* +=
|
||||
<menuitem observes={"pentadactyl-" + id + "Sidebar"} label={name} accesskey={key} xmlns={XUL}/>
|
||||
append.XUL::broadcasterset[0].* +=
|
||||
<broadcaster id={"pentadactyl-" + id + "Sidebar"}
|
||||
autoCheck="false" type="checkbox" group="sidebar"
|
||||
sidebartitle={name} sidebarurl={uri}
|
||||
oncommand="toggleSidebar(this.id);" xmlns={XUL}/>
|
||||
}
|
||||
|
||||
util.overlayWindow(window, { append: append.elements() });
|
||||
},
|
||||
|
||||
get browser() window.gBrowser,
|
||||
get tabbrowser() window.gBrowser,
|
||||
|
||||
@@ -16,51 +16,6 @@ var Config = Module("config", ConfigBase, {
|
||||
|
||||
Local: function Local(dactyl, modules, window)
|
||||
let ({ config } = modules) ({
|
||||
init: function init() {
|
||||
init.superapply(this, arguments);
|
||||
|
||||
util.overlayWindow(window, {
|
||||
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||
<menupopup id="viewSidebarMenu">
|
||||
<menuitem observes="pentadactyl-viewAddonsSidebar" label="Add-ons" accesskey="A"/>
|
||||
<menuitem observes="pentadactyl-viewConsoleSidebar" label="Console" accesskey="C"/>
|
||||
<menuitem observes="pentadactyl-viewDownloadsSidebar" label="Downloads" accesskey="D"/>
|
||||
<menuitem observes="pentadactyl-viewPreferencesSidebar" label="Preferences" accesskey="P"/>
|
||||
</menupopup>
|
||||
|
||||
<broadcasterset id="mainBroadcasterSet">
|
||||
<broadcaster id="pentadactyl-viewAddonsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
|
||||
sidebartitle="Add-ons"
|
||||
oncommand="toggleSidebar(this.id);"/>
|
||||
<broadcaster id="pentadactyl-viewConsoleSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://global/content/console.xul"
|
||||
sidebartitle="Console"
|
||||
oncommand="toggleSidebar(this.id);"/>
|
||||
<broadcaster id="pentadactyl-viewDownloadsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
|
||||
sidebartitle="Downloads"
|
||||
oncommand="toggleSidebar(this.id);"/>
|
||||
<broadcaster id="pentadactyl-viewPreferencesSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="about:config"
|
||||
sidebartitle="Preferences"
|
||||
oncommand="toggleSidebar(this.id);"/>
|
||||
</broadcasterset>
|
||||
</e4x>.elements()
|
||||
});
|
||||
},
|
||||
|
||||
dialogs: {
|
||||
about: ["About Firefox",
|
||||
@@ -200,6 +155,13 @@ var Config = Module("config", ConfigBase, {
|
||||
"sanitizer",
|
||||
"tabs"
|
||||
],
|
||||
|
||||
sidebars: {
|
||||
viewAddons: ["Add-ons", "A", "chrome://mozapps/content/extensions/extensions.xul"],
|
||||
viewConsole: ["Console", "C", "chrome://global/content/console.xul"],
|
||||
viewDownloads: ["Downloads", "D", "chrome://mozapps/content/downloads/downloads.xul"],
|
||||
viewPreferences: ["Preferences", "P", "about:config"]
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
commands: function (dactyl, modules, window) {
|
||||
|
||||
Reference in New Issue
Block a user