Bug 615435 - Relocate the Home button to the right side of the browser. r=dao ui-r=faaborg+limi a=dolske

This commit is contained in:
Frank Yan 2010-12-08 21:24:46 -08:00
parent 88fa004c5d
commit 8dedc55f53
3 changed files with 33 additions and 17 deletions

View File

@ -491,10 +491,10 @@
fullscreentoolbar="true" mode="icons" customizable="true"
#ifdef WINCE
iconsize="small" defaulticonsize="small"
defaultset="unified-back-forward-button,home-button,urlbar-container,reload-button,stop-button,search-container,bookmarks-menu-button-container,navigator-throbber,fullscreenflex,window-controls"
defaultset="unified-back-forward-button,urlbar-container,reload-button,stop-button,search-container,home-button,bookmarks-menu-button-container,navigator-throbber,fullscreenflex,window-controls"
#else
iconsize="large"
defaultset="unified-back-forward-button,home-button,urlbar-container,reload-button,stop-button,search-container,bookmarks-menu-button-container,fullscreenflex,window-controls"
defaultset="unified-back-forward-button,urlbar-container,reload-button,stop-button,search-container,home-button,bookmarks-menu-button-container,fullscreenflex,window-controls"
#endif
context="toolbar-context-menu">
@ -513,16 +513,6 @@
tooltiptext="&forwardButton.tooltip;"/>
</toolbaritem>
<toolbarbutton id="home-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class" removable="true"
label="&homeButton.label;"
ondragover="homeButtonObserver.onDragOver(event)"
ondragenter="homeButtonObserver.onDragOver(event)"
ondrop="homeButtonObserver.onDrop(event)"
ondragexit="homeButtonObserver.onDragExit(event)"
onclick="BrowserGoHome(event);"
aboutHomeOverrideTooltip="&abouthome.pageTitle;"/>
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true"
title="&locationItem.title;" class="chromeclass-location" removable="true">
<textbox id="urlbar" flex="1"
@ -617,6 +607,16 @@
<searchbar id="searchbar" flex="1"/>
</toolbaritem>
<toolbarbutton id="home-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class" removable="true"
label="&homeButton.label;"
ondragover="homeButtonObserver.onDragOver(event)"
ondragenter="homeButtonObserver.onDragOver(event)"
ondrop="homeButtonObserver.onDrop(event)"
ondragexit="homeButtonObserver.onDragExit(event)"
onclick="BrowserGoHome(event);"
aboutHomeOverrideTooltip="&abouthome.pageTitle;"/>
<toolbaritem id="bookmarks-menu-button-container"
class="chromeclass-toolbar-additional"
removable="true"

View File

@ -1003,7 +1003,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 3;
const UI_VERSION = 4;
let currentUIVersion = 0;
try {
currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
@ -1072,14 +1072,30 @@ BrowserGlue.prototype = {
currentset.indexOf("stop-button") != -1 &&
currentset.indexOf("urlbar-container") != -1 &&
currentset.indexOf("urlbar-container,reload-button,stop-button") == -1) {
currentset = currentset.replace(/(^|,)reload-button($|,)/, "$1$2").
replace(/(^|,)stop-button($|,)/, "$1$2").
replace(/(^|,)urlbar-container($|,)/,
currentset = currentset.replace(/(^|,)reload-button($|,)/, "$1$2")
.replace(/(^|,)stop-button($|,)/, "$1$2")
.replace(/(^|,)urlbar-container($|,)/,
"$1urlbar-container,reload-button,stop-button$2");
this._setPersist(toolbarResource, currentsetResource, currentset);
}
}
if (currentUIVersion < 4) {
// This code moves the home button to the immediate left of the bookmarks menu button.
let currentsetResource = this._rdf.GetResource("currentset");
let toolbarResource = this._rdf.GetResource("chrome://browser/content/browser.xul#nav-bar");
let currentset = this._getPersist(toolbarResource, currentsetResource);
// Need to migrate only if toolbar is customized and the elements are found.
if (currentset &&
currentset.indexOf("home-button") != -1 &&
currentset.indexOf("bookmarks-menu-button-container") != -1) {
currentset = currentset.replace(/(^|,)home-button($|,)/, "$1$2")
.replace(/(^|,)bookmarks-menu-button-container($|,)/,
"$1home-button,bookmarks-menu-button-container$2");
this._setPersist(toolbarResource, currentsetResource, currentset);
}
}
if (this._dirty)
this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();

View File

@ -79,7 +79,7 @@ function run_test() {
getService(Ci.nsIPrefBranch);
ps.setIntPref(PREF_SMART_BOOKMARKS_VERSION, -1);
// Avoid migrateUI, we are just simulating a partial startup.
ps.setIntPref("browser.migration.version", 1);
ps.setIntPref("browser.migration.version", 4);
// Initialize Places through the History Service.
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].