diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 3e53c72931e..83472328ec4 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -398,6 +398,7 @@ pref("browser.tabs.loadDivertedInBackground", false); pref("browser.tabs.loadBookmarksInBackground", false); pref("browser.tabs.tabClipWidth", 140); pref("browser.tabs.animate", true); +pref("browser.tabs.onTop", true); pref("browser.tabs.drawInTitlebar", true); // Where to show tab close buttons: @@ -968,6 +969,7 @@ pref("services.sync.prefs.sync.browser.tabs.closeButtons", true); pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true); pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true); pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true); +pref("services.sync.prefs.sync.browser.tabs.onTop", true); pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true); pref("services.sync.prefs.sync.browser.urlbar.autoFill", true); pref("services.sync.prefs.sync.browser.urlbar.default.behavior", true); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 44033e8a057..eb93bc13a6b 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1364,7 +1364,7 @@ function BrowserStartup() { allTabs.readPref(); - TabsOnTop.syncCommand(); + TabsOnTop.init(); BookmarksMenuButton.init(); @@ -5278,27 +5278,44 @@ function setToolbarVisibility(toolbar, isVisible) { } var TabsOnTop = { - toggle: function () { - this.enabled = !this.enabled; + init: function TabsOnTop_init() { + this.syncUI(); + Services.prefs.addObserver(this._prefName, this, false); }, - syncCommand: function () { - let enabled = this.enabled; + + toggle: function () { + this.enabled = !Services.prefs.getBoolPref(this._prefName); + }, + + syncUI: function () { + let userEnabled = Services.prefs.getBoolPref(this._prefName); + let enabled = userEnabled && gBrowser.tabContainer.visible; + document.getElementById("cmd_ToggleTabsOnTop") - .setAttribute("checked", enabled); + .setAttribute("checked", userEnabled); + document.documentElement.setAttribute("tabsontop", enabled); + document.getElementById("navigator-toolbox").setAttribute("tabsontop", enabled); document.getElementById("TabsToolbar").setAttribute("tabsontop", enabled); gBrowser.tabContainer.setAttribute("tabsontop", enabled); TabsInTitlebar.allowedBy("tabs-on-top", enabled); }, + get enabled () { return gNavToolbox.getAttribute("tabsontop") == "true"; }, - set enabled (val) { - gNavToolbox.setAttribute("tabsontop", !!val); - this.syncCommand(); + set enabled (val) { + Services.prefs.setBoolPref(this._prefName, !!val); return val; - } + }, + + observe: function (subject, topic, data) { + if (topic == "nsPref:changed") + this.syncUI(); + }, + + _prefName: "browser.tabs.onTop" } var TabsInTitlebar = { diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 531ac3b1074..e5284b74f85 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -444,9 +444,7 @@ + iconsize="large"> @@ -2839,17 +2838,30 @@ this._container.collapsed = !val; - document.getElementById("menu_closeWindow").hidden = !val; - document.getElementById("menu_close").setAttribute("label", - this.tabbrowser.mStringBundle.getString(val ? "tabs.closeTab" : "tabs.close")); - - if (window.TabsInTitlebar) - TabsInTitlebar.allowedBy("tabs-visible", val); + this._propagateVisibility(); return val; ]]> + + + +