mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 719717 - Move the tabs preferences to in-content UI. r=bmcbride
This commit is contained in:
parent
69f7f81ef1
commit
1b6b9e278e
@ -4,3 +4,5 @@ browser.jar:
|
||||
* content/browser/preferences/in-content/preferences.xul
|
||||
* content/browser/preferences/in-content/main.xul
|
||||
content/browser/preferences/in-content/main.js
|
||||
* content/browser/preferences/in-content/tabs.xul
|
||||
* content/browser/preferences/in-content/tabs.js
|
||||
|
@ -18,6 +18,9 @@ function init_all() {
|
||||
window.addEventListener("popstate", onStatePopped, true);
|
||||
updateCommands();
|
||||
gMainPane.init();
|
||||
#ifdef XP_WIN
|
||||
gTabsPane.init();
|
||||
#endif
|
||||
var initFinished = document.createEvent("Event");
|
||||
initFinished.initEvent("Initialized", true, true);
|
||||
document.dispatchEvent(initFinished);
|
||||
|
@ -91,6 +91,7 @@
|
||||
<prefpane flex="1" id="mainPrefPane">
|
||||
#include landing.xul
|
||||
#include main.xul
|
||||
#include tabs.xul
|
||||
</prefpane>
|
||||
</hbox>
|
||||
|
||||
|
66
browser/components/preferences/in-content/tabs.js
Normal file
66
browser/components/preferences/in-content/tabs.js
Normal file
@ -0,0 +1,66 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var gTabsPane = {
|
||||
|
||||
/*
|
||||
* Preferences:
|
||||
*
|
||||
* browser.link.open_newwindow
|
||||
* - determines where pages which would open in a new window are opened:
|
||||
* 1 opens such links in the most recent window or tab,
|
||||
* 2 opens such links in a new window,
|
||||
* 3 opens such links in a new tab
|
||||
* browser.tabs.autoHide
|
||||
* - true if the tab bar is hidden when only one tab is open, false to always
|
||||
* show it
|
||||
* browser.tabs.loadInBackground
|
||||
* - true if display should switch to a new tab which has been opened from a
|
||||
* link, false if display shouldn't switch
|
||||
* browser.tabs.warnOnClose
|
||||
* - true if when closing a window with multiple tabs the user is warned and
|
||||
* allowed to cancel the action, false to just close the window
|
||||
* browser.tabs.warnOnOpen
|
||||
* - true if the user should be warned if he attempts to open a lot of tabs at
|
||||
* once (e.g. a large folder of bookmarks), false otherwise
|
||||
* browser.taskbar.previews.enable
|
||||
* - true if tabs are to be shown in the Windows 7 taskbar
|
||||
*/
|
||||
|
||||
#ifdef XP_WIN
|
||||
/**
|
||||
* Initialize any platform-specific UI.
|
||||
*/
|
||||
init: function () {
|
||||
try {
|
||||
let sysInfo = Cc["@mozilla.org/system-info;1"].
|
||||
getService(Ci.nsIPropertyBag2);
|
||||
let ver = parseFloat(sysInfo.getProperty("version"));
|
||||
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
|
||||
showTabsInTaskbar.hidden = ver < 6.1 || (ver >= 6.1 && history.state != "tabs");
|
||||
} catch (ex) {}
|
||||
},
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determines where a link which opens a new window will open.
|
||||
*
|
||||
* @returns |true| if such links should be opened in new tabs
|
||||
*/
|
||||
readLinkTarget: function() {
|
||||
var openNewWindow = document.getElementById("browser.link.open_newwindow");
|
||||
return openNewWindow.value != 2;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determines where a link which opens a new window will open.
|
||||
*
|
||||
* @returns 2 if such links should be opened in new windows,
|
||||
* 3 if such links should be opened in new tabs
|
||||
*/
|
||||
writeLinkTarget: function() {
|
||||
var linkTargeting = document.getElementById("linkTargeting");
|
||||
return linkTargeting.checked ? 3 : 2;
|
||||
}
|
||||
};
|
76
browser/components/preferences/in-content/tabs.xul
Normal file
76
browser/components/preferences/in-content/tabs.xul
Normal file
@ -0,0 +1,76 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
- v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/preferences/in-content/tabs.js"/>
|
||||
|
||||
<preferences id="tabsPreferences">
|
||||
<preference id="browser.link.open_newwindow"
|
||||
name="browser.link.open_newwindow"
|
||||
type="int"/>
|
||||
<preference id="browser.tabs.autoHide"
|
||||
name="browser.tabs.autoHide"
|
||||
type="bool"
|
||||
inverted="true"/>
|
||||
<preference id="browser.tabs.loadInBackground"
|
||||
name="browser.tabs.loadInBackground"
|
||||
type="bool"
|
||||
inverted="true"/>
|
||||
<preference id="browser.tabs.warnOnClose"
|
||||
name="browser.tabs.warnOnClose"
|
||||
type="bool"/>
|
||||
<preference id="browser.tabs.warnOnOpen"
|
||||
name="browser.tabs.warnOnOpen"
|
||||
type="bool"/>
|
||||
#ifdef XP_WIN
|
||||
<preference id="browser.taskbar.previews.enable"
|
||||
name="browser.taskbar.previews.enable"
|
||||
type="bool"/>
|
||||
#endif
|
||||
</preferences>
|
||||
|
||||
<hbox class="heading" data-category="paneTabs" hidden="true">
|
||||
<image class="preference-icon" type="tabs"/>
|
||||
<html:h1>&paneTabs.title;</html:h1>
|
||||
</hbox>
|
||||
|
||||
<checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&newWindowsAsTabs.accesskey;"
|
||||
preference="browser.link.open_newwindow"
|
||||
onsyncfrompreference="return gTabsPane.readLinkTarget();"
|
||||
onsynctopreference="return gTabsPane.writeLinkTarget();"
|
||||
class="indent"/>
|
||||
|
||||
<checkbox id="warnCloseMultiple" label="&warnCloseMultipleTabs.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&warnCloseMultipleTabs.accesskey;"
|
||||
preference="browser.tabs.warnOnClose"
|
||||
class="indent"/>
|
||||
|
||||
<checkbox id="warnOpenMany" label="&warnOpenManyTabs.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&warnOpenManyTabs.accesskey;"
|
||||
preference="browser.tabs.warnOnOpen"
|
||||
class="indent"/>
|
||||
|
||||
<checkbox id="showTabBar" label="&showTabBar.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&showTabBar.accesskey;"
|
||||
preference="browser.tabs.autoHide"
|
||||
class="indent"/>
|
||||
|
||||
<checkbox id="switchToNewTabs" label="&switchToNewTabs.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&switchToNewTabs.accesskey;"
|
||||
preference="browser.tabs.loadInBackground"
|
||||
class="indent"/>
|
||||
|
||||
#ifdef XP_WIN
|
||||
<checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
|
||||
data-category="paneTabs" hidden="true"
|
||||
accesskey="&showTabsInTaskbar.accesskey;"
|
||||
preference="browser.taskbar.previews.enable"
|
||||
class="indent"/>
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user