Browse Source

this fixes rendering of toolbar icon

pull/2/head
gorhill 10 years ago
parent
commit
5106c4bc44
  1. 21
      platform/firefox/vapi-background.js
  2. 2
      src/js/async.js
  3. 2
      tools/make-firefox.sh

21
platform/firefox/vapi-background.js

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

2
src/js/async.js

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

2
tools/make-firefox.sh

@ -14,7 +14,7 @@ mv $DES/img/icon_128.png $DES/icon.png
cp ./platform/firefox/vapi-*.js $DES/js/
cp ./platform/firefox/bootstrap.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/install.rdf $DES/
cp ./platform/firefox/*.xul $DES/

Loading…
Cancel
Save