bug 451373 — code cleanup: makes it possible for extensions to add another panel without the risk that multiple such extensions would break each other
authorDaniel Brooks <db48x@db48x.net>
Sun, 28 Sep 2008 08:45:47 -0500
changeset 64893 9067c9b8a52c9fe122f52e35d65607492f81991b
parent 64891 ba7266b719381243a634fd9ec7aa15cc220b3f7b
child 64894 028682e80266a3f2c3628a06873a93c4ead8532d
push id1
push userclegnitto@mozilla.com
push dateTue, 12 Apr 2011 01:19:02 +0000
treeherdermozilla-aurora@0cfe6840e0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs451373
bug 451373 — code cleanup: makes it possible for extensions to add another panel without the risk that multiple such extensions would break each other
mobile/chrome/content/browser-ui.js
mobile/chrome/content/browser.xul
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -389,16 +389,20 @@ var BrowserUI = {
     if (!addons.hasAttribute("src"))
       addons.setAttribute("src", "chrome://mozapps/content/extensions/extensions.xul");
     let dloads = document.getElementById("downloads-container");
     if (!dloads.hasAttribute("src"))
       dloads.setAttribute("src", "chrome://mozapps/content/downloads/downloads.xul");
     Shortcuts.init();
   },
 
+  switchPane : function(id) {
+    document.getElementById("panel-items").selectedPanel = document.getElementById(id);
+  },
+
   _sizeControls : function(aEvent) {
     var rect = document.getElementById("browser-container").getBoundingClientRect();
     var containerW = rect.right - rect.left;
     var containerH = rect.bottom - rect.top;
     var toolbar = document.getElementById("toolbar-main");
     var toolbarH = toolbar.boxObject.height;
 
     var browser = document.getElementById("browser");
--- a/mobile/chrome/content/browser.xul
+++ b/mobile/chrome/content/browser.xul
@@ -236,21 +236,21 @@
       <toolbarbutton id="tool-back" class="browser-control-button" command="cmd_back"/>
       <toolbarbutton id="tool-forward" class="browser-control-button" command="cmd_forward"/>
       <toolbarspring/>
       <toolbarbutton id="tool-actions" class="browser-control-button" command="cmd_actions"/>
       <toolbarbutton id="tool-stuff" class="browser-control-button" command="cmd_panel"/>
     </vbox>
 
     <hbox id="panel-container" style="-moz-stack-sizing: ignore;" top="0" left="0">
-      <vbox id="panel-controls">
-        <toolbarbutton id="tool-addons" class="browser-control-button" oncommand="this.parentNode.nextSibling.selectedIndex=0;"/>
-        <toolbarbutton id="tool-downloads" class="browser-control-button" oncommand="this.parentNode.nextSibling.selectedIndex=1;"/>
-        <toolbarbutton id="tool-preferences" class="browser-control-button" oncommand="this.parentNode.nextSibling.selectedIndex=2;"/>
-        <toolbarbutton id="tool-shortcuts" class="browser-control-button" oncommand="this.parentNode.nextSibling.selectedIndex=3;"/>
+      <vbox id="panel-controls" oncommand="BrowserUI.switchPane(event.target.getAttribute('paneid'));">
+        <toolbarbutton id="tool-addons" class="browser-control-button" paneid="addons-container"/>
+        <toolbarbutton id="tool-downloads" class="browser-control-button" paneid="downloads-container"/>
+        <toolbarbutton id="tool-preferences" class="browser-control-button" paneid="prefs-container"/>
+        <toolbarbutton id="tool-shortcuts" class="browser-control-button" paneid="shortcuts-container"/>
       </vbox>
       <deck id="panel-items" flex="1">
         <iframe id="addons-container" flex="1"/>
         <iframe id="downloads-container" flex="1"/>
 
         <vbox id="prefs-container">
           <hbox pack="center" id="buttons"/>
           <scrollbox orient="vertical" id="pref-list" seltype="single" flex="1">