Bug 625320 - Move 'Tab Groups' to the 'list all tabs' menu [r=dolske, a=dolske]
authorTim Taubert <tim.taubert@gmx.de>
Sat, 19 Feb 2011 11:35:02 +0100
changeset 62882 3017b3459639e52e488b66b3cde4bc2570b37e33
parent 62881 28bf1def92065e9a6412a14b02eb08cfa9859656
child 62883 a18bb9d573f4eb29f3b98a826483d2f9f54d88a2
push idunknown
push userunknown
push dateunknown
reviewersdolske, dolske
bugs625320
milestone2.0b12pre
Bug 625320 - Move 'Tab Groups' to the 'list all tabs' menu [r=dolske, a=dolske]
browser/base/content/browser-menubar.inc
browser/base/content/browser-syncui.js
browser/base/content/browser.xul
browser/base/content/tabbrowser.xml
browser/themes/gnomestripe/browser/browser.css
browser/themes/pinstripe/browser/browser.css
browser/themes/winstripe/browser/browser.css
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -212,21 +212,16 @@
 #endif
 #endif
               </menupopup>
             </menu>
 
             <menu id="view-menu" label="&viewMenu.label;"
                   accesskey="&viewMenu.accesskey;">
               <menupopup id="menu_viewPopup">
-                <menuitem id="menu_tabview"
-                          key="key_tabview"
-                          label="&viewTabGroups.label;"
-                          accesskey="&viewTabGroups.accesskey;"
-                          command="Browser:ToggleTabView"/>
                 <menu id="viewToolbarsMenu"
                       label="&viewToolbarsMenu.label;"
                       accesskey="&viewToolbarsMenu.accesskey;">
                   <menupopup onpopupshowing="onViewToolbarsPopupShowing(event);">
                     <menuseparator/>
                     <menuitem id="menu_tabsOnTop"
                               command="cmd_ToggleTabsOnTop"
                               type="checkbox"
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -153,26 +153,22 @@ let gSyncUI = {
       return;
     
     let menuitem = document.createElement("menuitem");
     menuitem.setAttribute("id", "sync-tabs-menuitem");
     menuitem.setAttribute("label", label);
     menuitem.setAttribute("class", "alltabs-item");
     menuitem.setAttribute("oncommand", "BrowserOpenSyncTabs();");
 
-    let sep = document.createElement("menuseparator");
-    sep.setAttribute("id", "sync-tabs-sep");
-
     // Fake the tab object on the menu entries, so that we don't have to worry
     // about removing them ourselves. They will just get cleaned up by popup
     // binding.
     menuitem.tab = { "linkedBrowser": { "currentURI": { "spec": label } } };
-    sep.tab = { "linkedBrowser": { "currentURI": { "spec": " " } } };
 
-    popup.insertBefore(sep, popup.firstChild);
+    let sep = document.getElementById("alltabs-popup-separator");
     popup.insertBefore(menuitem, sep);
   },
 
 
   // Functions called by observers
   onActivityStart: function SUI_onActivityStart() {
     if (!gBrowser)
       return;
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -839,17 +839,26 @@
 
       <toolbarbutton id="alltabs-button"
                      class="toolbarbutton-1 chromeclass-toolbar-additional tabs-alltabs-button"
                      type="menu"
                      label="&listAllTabs.label;"
                      tooltiptext="&listAllTabs.label;"
                      removable="true">
         <menupopup id="alltabs-popup"
-                   position="after_end"/>
+                   position="after_end">
+          <menuitem id="menu_tabview"
+                    class="menuitem-iconic"
+                    key="key_tabview"
+                    label="&viewTabGroups.label;"
+                    command="Browser:ToggleTabView"
+                    observes="tabviewGroupsNumber"
+                    keepme="true"/>
+          <menuseparator id="alltabs-popup-separator" keepme="true"/>
+        </menupopup>
       </toolbarbutton>
 
       <toolbarbutton id="tabs-closebutton"
                      class="close-button tabs-closebutton"
                      command="cmd_close"
                      label="&closeTab.label;"
                      tooltiptext="&closeTab.label;"/>
 
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -3685,21 +3685,23 @@
           this._createTabMenuItem(tabs[i]);
         }
         this._updateTabsVisibilityStatus();
       ]]></handler>
 
       <handler event="popuphidden">
       <![CDATA[
         // clear out the menu popup and remove the listeners
-        while (this.hasChildNodes()) {
-          var menuItem = this.lastChild;
-          menuItem.removeEventListener("command", this, false);
-          menuItem.tab.mCorrespondingMenuitem = null;
-          this.removeChild(menuItem);
+        for (let i = this.childNodes.length - 1; i > 0; i--) {
+          let menuItem = this.childNodes[i];
+          if (!menuItem.hasAttribute("keepme")) {
+            menuItem.removeEventListener("command", this, false);
+            menuItem.tab.mCorrespondingMenuitem = null;
+            this.removeChild(menuItem);
+          }
         }
         var tabcontainer = gBrowser.tabContainer;
         tabcontainer.mTabstrip.removeEventListener("scroll", this, false);
         tabcontainer.removeEventListener("TabOpen", this, false);
         tabcontainer.removeEventListener("TabAttrModified", this, false);
         tabcontainer.removeEventListener("TabClose", this, false);
       ]]></handler>
 
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -624,34 +624,39 @@ toolbar[mode="full"] .toolbarbutton-1 > 
   list-style-image: url("moz-icon://stock/gtk-home?size=toolbar");
 }
 #home-button[disabled="true"] {
   list-style-image: url("moz-icon://stock/gtk-home?size=toolbar&state=disabled");
 }
 
 /* tabview button */
 
-#tabview-button {
+#tabview-button,
+#menu_tabview {
   list-style-image: url(chrome://browser/skin/tabview/tabview.png);
   -moz-image-region: rect(0, 80px, 16px, 64px);
 }
 
-#tabview-button[groups="0"] {
+#tabview-button[groups="0"],
+#menu_tabview[groups="0"] {
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
 
-#tabview-button[groups="1"] {
+#tabview-button[groups="1"],
+#menu_tabview[groups="1"] {
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
-#tabview-button[groups="2"] {
+#tabview-button[groups="2"],
+#menu_tabview[groups="2"] {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
-#tabview-button[groups="3"] {
+#tabview-button[groups="3"],
+#menu_tabview[groups="3"] {
   -moz-image-region: rect(0, 64px, 16px, 48px);
 }
 
 #downloads-button {
   -moz-image-region: rect(0px 24px 24px 0px);
 }
 
 #history-button {
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -562,18 +562,22 @@ toolbar[mode="icons"] #forward-button {
 #home-button.bookmark-item > .toolbarbutton-icon {
   display: -moz-box !important;
   -moz-margin-start: -2px;
   -moz-margin-end: 3px;
 }
 
 /* tabview button */
 
+#tabview-button,
+#menu_tabview {
+  list-style-image: url(chrome://browser/skin/tabview/tabview.png);
+}
+
 #tabview-button {
-  list-style-image: url(chrome://browser/skin/tabview/tabview.png);
   -moz-image-region: rect(0, 100px, 20px, 80px);
 }
 
 #tabview-button[groups="0"] {
   -moz-image-region: rect(0, 20px, 20px, 0);
 }
 
 #tabview-button[groups="1"] {
@@ -583,16 +587,36 @@ toolbar[mode="icons"] #forward-button {
 #tabview-button[groups="2"] {
   -moz-image-region: rect(0, 60px, 20px, 40px);
 }
 
 #tabview-button[groups="3"] {
   -moz-image-region: rect(0, 80px, 20px, 60px);
 }
 
+#menu_tabview {
+  -moz-image-region: rect(2px, 98px, 18px, 82px);
+}
+
+#menu_tabview[groups="0"] {
+  -moz-image-region: rect(2px, 18px, 18px, 2px);
+}
+
+#menu_tabview[groups="1"] {
+  -moz-image-region: rect(2px, 38px, 18px, 22px);
+}
+
+#menu_tabview[groups="2"] {
+  -moz-image-region: rect(2px, 58px, 18px, 42px);
+}
+
+#menu_tabview[groups="3"] {
+  -moz-image-region: rect(2px, 78px, 18px, 62px);
+}
+
 /* download manager button */
 
 #downloads-button {
   -moz-image-region: rect(0, 140px, 20px, 120px);
 }
 
 /* history sidebar button */
 
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -877,18 +877,22 @@ toolbar[mode="full"] .toolbarbutton-1 > 
   list-style-image: url("chrome://browser/skin/Toolbar.png");
 }
 #home-button {
   -moz-image-region: rect(0, 90px, 18px, 72px);
 }
 
 /* tabview button */
 
+#tabview-button,
+#menu_tabview {
+  list-style-image: url(chrome://browser/skin/tabview/tabview.png);
+}
+
 #tabview-button {
-  list-style-image: url(chrome://browser/skin/tabview/tabview.png);
   -moz-image-region: rect(0, 90px, 18px, 72px);
 }
 
 #tabview-button[groups="0"] {
   -moz-image-region: rect(0, 18px, 18px, 0);
 }
 
 #tabview-button[groups="1"] {
@@ -898,16 +902,36 @@ toolbar[mode="full"] .toolbarbutton-1 > 
 #tabview-button[groups="2"] {
   -moz-image-region: rect(0, 54px, 18px, 36px);
 }
 
 #tabview-button[groups="3"] {
   -moz-image-region: rect(0, 72px, 18px, 54px);
 }
 
+#menu_tabview {
+  -moz-image-region: rect(1px, 89px, 17px, 73px);
+}
+
+#menu_tabview[groups="0"] {
+  -moz-image-region: rect(1px, 17px, 17px, 1px);
+}
+
+#menu_tabview[groups="1"] {
+  -moz-image-region: rect(1px, 35px, 17px, 19px);
+}
+
+#menu_tabview[groups="2"] {
+  -moz-image-region: rect(1px, 53px, 17px, 37px);
+}
+
+#menu_tabview[groups="3"] {
+  -moz-image-region: rect(1px, 71px, 17px, 55px);
+}
+
 /* download manager button */
 
 #downloads-button {
   -moz-image-region: rect(0, 108px, 18px, 90px);
 }
 
 /* history sidebar button */