Bug 422420 - Revert home button move and related migration code, r=gavin
authormconnor@steelgryphon.com
Mon, 17 Mar 2008 12:44:44 -0700
changeset 13190 3adda797ab437e6e485d8f20ac4498df038d1aef
parent 13189 9bed0cf5248e7d02ecf37ebb214f7705aa6acf9e
child 13191 24084268e67c188cb78cf5135f180d393a4dc84b
push idunknown
push userunknown
push dateunknown
reviewersgavin
bugs422420
milestone1.9b5pre
Bug 422420 - Revert home button move and related migration code, r=gavin
browser/base/content/browser.xul
browser/components/nsBrowserGlue.js
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -286,17 +286,17 @@
                      command="Browser:Reload"
                      tooltiptext="&reloadButton.tooltip;"/>
 
       <toolbarbutton id="stop-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                      label="&stopCmd.label;"
                      command="Browser:Stop"
                      tooltiptext="&stopButton.tooltip;"/>
 
-      <toolbarbutton id="home-button" class="bookmark-item chromeclass-toolbar-additional"
+      <toolbarbutton id="home-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                      persist="class"
                      label="&homeButton.label;"
                      ondragover="nsDragAndDrop.dragOver(event, homeButtonObserver);"
                      ondragdrop="nsDragAndDrop.drop(event, homeButtonObserver);"
                      ondragexit="nsDragAndDrop.dragExit(event, homeButtonObserver);"
                      onclick="BrowserGoHome(event);"/>
 
       <toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
@@ -446,19 +446,19 @@
 
     </toolbarpalette>
 
     <toolbar id="nav-bar" class="toolbar-primary chromeclass-toolbar"
              toolbarname="&navbarCmd.label;" accesskey="&navbarCmd.accesskey;"
              fullscreentoolbar="true" mode="icons" iconsize="large"
              customizable="true"
 #ifdef XP_MACOSX
-             defaultset="unified-back-forward-button,reload-button,stop-button,urlbar-container,search-container,throbber-box"
+             defaultset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,throbber-box"
 #else
-             defaultset="unified-back-forward-button,reload-button,stop-button,urlbar-container,search-container,fullscreenflex,window-controls"
+             defaultset="unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,fullscreenflex,window-controls"
 #endif
              context="toolbar-context-menu">
 #ifndef XP_MACOSX
       <hbox id="fullscreenflex" flex="1" hidden="true" fullscreencontrol="true"/>
       <hbox id="window-controls" hidden="true" fullscreencontrol="true">
         <toolbarbutton id="minimize-button" class="toolbarbutton-1"
                        tooltiptext="&fullScreenMinimize.tooltip;"
                        oncommand="window.minimize();"/>
@@ -475,17 +475,17 @@
     </toolbar>
 
     <toolbarset id="customToolbars" context="toolbar-context-menu"/>
 
     <toolbar id="PersonalToolbar"
              mode="icons" iconsize="small" defaulticonsize="small"
              class="chromeclass-directories"
              context="toolbar-context-menu"
-             defaultset="home-button,personal-bookmarks"
+             defaultset="personal-bookmarks"
              toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"
              customizable="true"/>
   </toolbox>
 
   <hbox flex="1" id="browser">
     <vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
       <sidebarheader align="center">
         <label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -498,59 +498,22 @@ BrowserGlue.prototype = {
       // this code should always migrate pre-FF3 profiles to the current UI state
 
       // grab the localstore.rdf and make changes needed for new UI
       this._rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
       this._dataSource = this._rdf.GetDataSource("rdf:local-store");
       this._dirty = false;
 
       var currentSet = this._rdf.GetResource("currentset");
-      var collapsed = this._rdf.GetResource("collapsed");
-      var target;
-      var moveHome;
-      var homePattern = /(?:^|,)home-button(?:$|,)/;
-
-      // get an nsIRDFResource for the PersonalToolbar item
-      var personalBar = this._rdf.GetResource("chrome://browser/content/browser.xul#PersonalToolbar");
-      var personalBarCollapsed = this._getPersist(personalBar, collapsed) == "true";
 
       // get an nsIRDFResource for the nav-bar item
       var navBar = this._rdf.GetResource("chrome://browser/content/browser.xul#nav-bar");
-      target = this._getPersist(navBar, currentSet);
-      if (target) {
-        let originalTarget = target;
-
-        // move Home if we find it in the nav-bar and the personal toolbar isn't collapsed
-        if (!personalBarCollapsed)
-          target = target.replace(homePattern, ",");
-        moveHome = (target != originalTarget);
-
-        // add the new combined back and forward button
-        if (!/(?:^|,)unified-back-forward-button(?:$|,)/.test(target))
-          target = "unified-back-forward-button," + target;
-
-        if (target != originalTarget)
-          this._setPersist(navBar, currentSet, target);
-      } else {
-        // nav-bar doesn't have a currentset, so the defaultset will be used,
-        // which means Home will be moved
-        moveHome = true;
-      }
-
-      if (moveHome) {
-        // If the personal toolbar has a currentset, add Home. The defaultset will be
-        // used otherwise.
-        target = this._getPersist(personalBar, currentSet);
-        if (target && !homePattern.test(target))
-          this._setPersist(personalBar, currentSet, "home-button," + target);
-
-        // uncollapse the personal toolbar
-        if (personalBarCollapsed)
-          this._setPersist(personalBar, collapsed, "false");
-      }
+      var target = this._getPersist(navBar, currentSet);
+      if (target && !/(?:^|,)unified-back-forward-button(?:$|,)/.test(target))
+        this._setPersist(navBar, currentSet, "unified-back-forward-button," + target);
 
       // force the RDF to be saved
       if (this._dirty)
         this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
 
       // free up the RDF service
       this._rdf = null;
       this._dataSource = null;