fix systray envelope icon notifications

cusax-fix
Yana Stamcheva 19 years ago
parent d86c11fc15
commit e24d790d39

@ -609,7 +609,8 @@ public void addActiveContact(MetaContact metaContact)
ImageLoader.SYSTRAY_ENVELOPE_ICON));
}
this.activeContacts.add(metaContact);
if(!activeContacts.contains(metaContact))
this.activeContacts.add(metaContact);
}
}
@ -622,11 +623,14 @@ public void removeActiveContact(MetaContact metaContact)
{
synchronized (activeContacts)
{
this.activeContacts.remove(metaContact);
if(activeContacts.contains(metaContact))
this.activeContacts.remove(metaContact);
if(activeContacts.size() == 0)
{
GuiActivator.getSystrayService().setSystrayIcon(
ImageLoader.getImageInBytes(ImageLoader.SYSTRAY_ICON));
}
}
}

@ -256,29 +256,6 @@ else if (messageType == SystrayService.WARNING_MESSAGE_TYPE)
if(messageContent.length() > 100)
messageContent = messageContent.substring(0, 100).concat("...");
GraphicsEnvironment ge
= GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gs.getDefaultConfiguration();
// Create an image that does not support transparency
BufferedImage img = gc.createCompatibleImage(logoIcon.getIconWidth(),
logoIcon.getIconHeight(), Transparency.TRANSLUCENT);
Image msgImg = new ImageIcon(
Resources.getImage("messageIcon")).getImage();
Graphics2D g = (Graphics2D) img.getGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.drawImage(logoIcon.getImage(), 0, 0, null);
g.drawImage(msgImg,
logoIcon.getIconWidth()/2 - msgImg.getWidth(null)/2,
logoIcon.getIconHeight()/2 - msgImg.getHeight(null)/2, null);
this.trayIcon.setIcon(new ImageIcon(img));
this.trayIcon.displayMessage(
title, messageContent, trayMsgType);
}

Loading…
Cancel
Save