"Show in app tab" and "show in separate tab" are separate preferences.

Thanks to voxel for the patch
This commit is contained in:
Simon Kornblith 2011-08-03 20:05:33 +00:00
parent 841c6f5b7b
commit 4901870c8a
5 changed files with 14 additions and 5 deletions

View file

@ -50,14 +50,14 @@ var ZoteroOverlay = new function()
showInPref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch('extensions.zotero.').getIntPref('showIn');
this.isTab = showInPref === 2;
this.isTab = showInPref !== 1;
if(!isFx36) {
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
var zoteroObserver = function(subject, topic, data) {
if(subject != window) return;
observerService.removeObserver(this, "browser-delayed-startup-finished");
if(showInPref === 2) {
if(showInPref === 3) {
var tabbar = document.getElementById("TabsToolbar");
if(tabbar && window.getComputedStyle(tabbar).display !== "none") {
// load Zotero as a tab, if it isn't loading by default
@ -314,7 +314,7 @@ var ZoteroOverlay = new function()
// If no existing tab, add a new tab
if(!tab) tab = gBrowser.addTab(ZOTERO_TAB_URL);
// Pin tab
if(!isFx36) gBrowser.pinTab(tab);
if(!isFx36 && showInPref == 3) gBrowser.pinTab(tab);
// If requested, activate tab
if(!background) gBrowser.selectedTab = tab;
}

View file

@ -73,6 +73,11 @@ function init()
} else if(document.location.hash == "#cite") {
document.getElementById('zotero-prefs').showPane(document.getElementById("zotero-prefpane-cite"));
}
var showInAppTab;
if(!Zotero.isFx4 && (showInAppTab = document.getElementById("zotero-prefpane-general-showIn-appTab"))) {
showInAppTab.setAttribute("hidden", "true");
}
}
@ -1791,6 +1796,7 @@ function updateProxyPrefs() {
document.getElementById('zotero-proxies-autoRecognize').disabled =
document.getElementById('zotero-proxies-disableByDomain-checkbox').disabled =
document.getElementById('zotero-proxies-disableByDomain-textbox').disabled = !transparent;
}
/**
@ -1810,8 +1816,9 @@ function updateWordProcessorInstructions() {
*/
function handleShowInPreferenceChange() {
var showInSeparateTab = document.getElementById("zotero-prefpane-general-showIn-separateTab");
var showInAppTab = document.getElementById("zotero-prefpane-general-showIn-appTab");
if(Zotero.isFx4) {
if(showInSeparateTab.selected) {
if(showInAppTab.selected) {
document.getElementById('statusBarIcon').selectedItem = document.getElementById('statusBarIcon-none');
Zotero.Prefs.set("statusBarIcon", 0);
} else if(Zotero.isFx4) {

View file

@ -59,6 +59,7 @@ To add a new preference:
<radiogroup id="showIn" orient="horizontal" preference="pref-showIn" oncommand="handleShowInPreferenceChange()">
<radio id="zotero-prefpane-general-showIn-browserPane" label="&zotero.preferences.showIn.browserPane;" value="1"/>
<radio id="zotero-prefpane-general-showIn-separateTab" label="&zotero.preferences.showIn.separateTab;" value="2"/>
<radio id="zotero-prefpane-general-showIn-appTab" label="&zotero.preferences.showIn.appTab;" value="3"/>
</radiogroup>
</row>
<row position="2" id="zotero-prefpane-general-statusBarIcon-row">

View file

@ -104,7 +104,7 @@ var ZoteroTab = new function()
if(tabs.length > 1) {
window.close();
} else {
if(Zotero.isFx4) this.containerWindow.gBrowser.unpinTab(tabs[0]);
if(Zotero.isFx4 && tabs[0].pinned) this.containerWindow.gBrowser.unpinTab(tabs[0]);
document.location.replace(this.containerWindow.gHomeButton.getHomePage());
}
return;

View file

@ -10,6 +10,7 @@
<!ENTITY zotero.preferences.showIn "Load Zotero in:">
<!ENTITY zotero.preferences.showIn.browserPane "Browser pane">
<!ENTITY zotero.preferences.showIn.separateTab "Separate tab">
<!ENTITY zotero.preferences.showIn.appTab "App tab">
<!ENTITY zotero.preferences.statusBarIcon "Status bar icon:">
<!ENTITY zotero.preferences.statusBarIcon.none "None">
<!ENTITY zotero.preferences.fontSize "Font size:">