this fixes rendering of toolbar icon

pull/2/head
gorhill 10 years ago
parent 764b1a0b7a
commit 5106c4bc44

@ -744,12 +744,13 @@ vAPI.tabs.injectScript = function(tabId, details, callback) {
/******************************************************************************/ /******************************************************************************/
vAPI.setIcon = function(tabId, iconId, badge) { vAPI.setIcon = function(tabId, iconId, badge) {
var iconStatus = typeof iconId === 'number';
// If badge is undefined, then setIcon was called from the TabSelect event // If badge is undefined, then setIcon was called from the TabSelect event
var win = badge === undefined ? var win;
iconId : if ( badge === undefined ) {
Services.wm.getMostRecentWindow('navigator:browser'); win = iconId;
} else {
win = Services.wm.getMostRecentWindow('navigator:browser');
}
var curTabId = vAPI.tabs.getTabId(getTabBrowser(win).selectedTab); var curTabId = vAPI.tabs.getTabId(getTabBrowser(win).selectedTab);
var tb = vAPI.toolbarButton; var tb = vAPI.toolbarButton;
@ -757,7 +758,7 @@ vAPI.setIcon = function(tabId, iconId, badge) {
if ( tabId === undefined ) { if ( tabId === undefined ) {
tabId = curTabId; tabId = curTabId;
} else if ( badge !== undefined ) { } else if ( badge !== undefined ) {
tb.tabs[tabId] = { badge: badge, img: iconStatus === 'on' }; tb.tabs[tabId] = { badge: badge, img: iconId };
} }
if ( tabId === curTabId ) { if ( tabId === curTabId ) {
@ -1600,12 +1601,8 @@ vAPI.toolbarButton.updateState = function(win, tabId) {
var icon = this.tabs[tabId]; var icon = this.tabs[tabId];
button.setAttribute('badge', icon && icon.badge || ''); button.setAttribute('badge', icon && icon.badge || '');
if ( !icon || !icon.img ) { var iconId = icon && icon.img ? icon.img : 'off';
icon = ''; icon = 'url(' + vAPI.getURL('img/browsericons/icon19-' + iconId + '.png') + ')';
}
else {
icon = 'url(' + vAPI.getURL('img/browsericons/icon19-19.png') + ')';
}
button.style.listStyleImage = icon; button.style.listStyleImage = icon;
}; };

@ -149,7 +149,7 @@ return asyncJobManager;
}; };
var updateBadgeAsync = function(tabId) { var updateBadgeAsync = function(tabId) {
if ( typeof tabId !== 'number' || tabId <= 0 ) { if ( vAPI.isBehindTheSceneTabId(tabId) ) {
return; return;
} }
µm.asyncJobs.add('updateBadge-' + tabId, tabId, updateBadge, 500); µm.asyncJobs.add('updateBadge-' + tabId, tabId, updateBadge, 500);

@ -14,7 +14,7 @@ mv $DES/img/icon_128.png $DES/icon.png
cp ./platform/firefox/vapi-*.js $DES/js/ cp ./platform/firefox/vapi-*.js $DES/js/
cp ./platform/firefox/bootstrap.js $DES/ cp ./platform/firefox/bootstrap.js $DES/
cp ./platform/firefox/frame*.js $DES/ cp ./platform/firefox/frame*.js $DES/
cp -R ./platform/firefox/img $DES/ cp -R ./platform/chromium/img $DES/
cp ./platform/firefox/chrome.manifest $DES/ cp ./platform/firefox/chrome.manifest $DES/
cp ./platform/firefox/install.rdf $DES/ cp ./platform/firefox/install.rdf $DES/
cp ./platform/firefox/*.xul $DES/ cp ./platform/firefox/*.xul $DES/

Loading…
Cancel
Save