Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
fix PanoramaTreeView.openTabs for #26
Browse files Browse the repository at this point in the history
 * 非アクティブなグループへのドロップ:
   全てバックグラウンドに開く
 * アクティブなグループへのドロップ:
   `browser.tabs.loadInBackground` に依存。
   `true` なら全てバックグラウンド、`false`なら最初のタブが選択される
  • Loading branch information
teramako committed Sep 9, 2011
1 parent 3e83d28 commit b6239af
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions modules/panoramaTree.jsm
Expand Up @@ -420,20 +420,41 @@ PanoramaTreeView.prototype = {
return items;
},
openTabs: function PTV_openTabs (aURLs, aGroupItem, aTabPos) {
var group;
var group,
activeGroupItem = this.GI._activeGroupItem,
background = true;
if (!aGroupItem)
group = this.GI._activeGroupItem;
else if ("group" in aGroupItem)
group = aGroupItem.group;
else
group = this.GI.newGroup();

this.GI.setActiveGroupItem(group);
var tab = this.gBrowser.loadOneTab(null, { inBackground: false, skipAnimation: true });
if (aTabPos >= 0)
this.gBrowser.moveTabTo(tab, aTabPos);
var isActive = (activeGroupItem === group);
if (isActive)
background = Services.prefs.getBoolPref("browser.tabs.loadInBackground");

this.gBrowser.loadTabs(aURLs, false, true);
try {
var tab;
for (let i = 0; i < aURLs.length; ++i) {
if (!isActive)
this.GI.setActiveGroupItem(group);

tab = this.gBrowser.loadOneTab(aURLs[i], {
inBackground: (i === 0 ? background : true),
ownerTab: tab,
skipAnimation: true
});
if (!isActive)
this.gBrowser.hideTab(tab);

if (aTabPos >= 0)
this.gBrowser.moveTabTo(tab, aTabPos++);
}
} finally {
if (!isActive)
this.tabView._window.UI.setActive(activeGroupItem);
}
},
getDropPosition: function PTV_getDropPosition (aTargetIndex, aOrientation) {
var targetItem = this.rows[aTargetIndex],
Expand Down

0 comments on commit b6239af

Please sign in to comment.