Bug 875775 - Allow widgets created by createWidget to specify if they're removable or not. r=mconley

--HG--
extra : rebase_source : 317bb5500c18a38314e835fc78dbcb658620cae7
This commit is contained in:
Jared Wein 2013-05-28 13:00:49 -04:00
parent 62a48e69ec
commit 7c39bcadda
2 changed files with 15 additions and 1 deletions

View File

@ -685,6 +685,7 @@ let CustomizableUIInternal = {
if (aWidget.disabled) {
node.setAttribute("disabled", true);
}
node.setAttribute("removable", aWidget.removable);
node.setAttribute("label", aWidget.name);
node.setAttribute("tooltiptext", aWidget.description);
//XXXunf Need to hook this up to a <key> element or something.
@ -1170,7 +1171,7 @@ let CustomizableUIInternal = {
createBuiltinWidget: function(aData) {
// This should only ever be called on startup, before any windows are
// openned - so we know there's no build areas to handle. Also, builtin
// opened - so we know there's no build areas to handle. Also, builtin
// widgets are expected to be (mostly) static, so shouldn't affect the
// current placement settings.
let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
@ -1197,6 +1198,7 @@ let CustomizableUIInternal = {
source: aSource || "addon",
instances: new Map(),
currentArea: null,
removable: false,
defaultArea: null,
allowedAreas: [],
shortcut: null,
@ -1224,6 +1226,10 @@ let CustomizableUIInternal = {
}
}
if ("removable" in aData && typeof aData.removable == "boolean") {
widget.removable = aData.removable;
}
if (aData.defaultArea && gAreas.has(aData.defaultArea)) {
widget.defaultArea = aData.defaultArea;
}

View File

@ -34,6 +34,7 @@ const CustomizableWidgets = [{
viewId: "PanelUI-history",
name: "History...",
description: "History",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL, CustomizableUI.AREA_NAVBAR],
icons: {
@ -103,6 +104,7 @@ const CustomizableWidgets = [{
id: "privatebrowsing-button",
name: "Private Browsing\u2026",
description: "Open a new Private Browsing window",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -123,6 +125,7 @@ const CustomizableWidgets = [{
name: "Save Page",
shortcut: "Ctrl+S",
description: "Save this page",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -143,6 +146,7 @@ const CustomizableWidgets = [{
name: "Find",
shortcut: "Ctrl+F",
description: "Find in this page",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -163,6 +167,7 @@ const CustomizableWidgets = [{
name: "Open File",
shortcut: "Ctrl+O",
description: "Open file",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -183,6 +188,7 @@ const CustomizableWidgets = [{
name: "Developer",
shortcut: "Shift+F11",
description: "Toggle Developer Tools",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -203,6 +209,7 @@ const CustomizableWidgets = [{
name: "Add-ons",
shortcut: "Ctrl+Shift+A",
description: "Add-ons Manager",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {
@ -223,6 +230,7 @@ const CustomizableWidgets = [{
name: "Preferences",
shortcut: "Ctrl+Shift+O",
description: "Preferences\u2026",
removable: true,
defaultArea: CustomizableUI.AREA_PANEL,
allowedAreas: [CustomizableUI.AREA_PANEL],
icons: {