diff options
8 files changed, 42 insertions, 31 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListModel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListModel.java index 3deb73c..e9fc4c9 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListModel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListModel.java @@ -19,6 +19,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.systray.*; /** * The list model of the ContactList. This class use as a data model the @@ -607,12 +608,9 @@ public class ContactListModel synchronized (activeContacts) { if(activeContacts.size() == 0) - { GuiActivator.getSystrayService().setSystrayIcon( - ImageLoader.getImageInBytes( - ImageLoader.SYSTRAY_ENVELOPE_ICON)); - } - + SystrayService.ENVELOPE_IMG_TYPE); + if(!activeContacts.contains(metaContact)) this.activeContacts.add(metaContact); } @@ -631,10 +629,8 @@ public class ContactListModel this.activeContacts.remove(metaContact); if(activeContacts.size() == 0) - { GuiActivator.getSystrayService().setSystrayIcon( - ImageLoader.getImageInBytes(ImageLoader.SYSTRAY_ICON)); - } + SystrayService.SC_IMG_TYPE); } } @@ -650,7 +646,7 @@ public class ContactListModel this.activeContacts.removeAllElements(); GuiActivator.getSystrayService().setSystrayIcon( - ImageLoader.getImageInBytes(ImageLoader.SYSTRAY_ICON)); + SystrayService.SC_IMG_TYPE); } } } diff --git a/src/net/java/sip/communicator/impl/gui/resources/common/systrayEnvelopeIcon.png b/src/net/java/sip/communicator/impl/gui/resources/common/systrayEnvelopeIcon.png Binary files differdeleted file mode 100644 index fb014f1..0000000 --- a/src/net/java/sip/communicator/impl/gui/resources/common/systrayEnvelopeIcon.png +++ /dev/null diff --git a/src/net/java/sip/communicator/impl/gui/resources/common/systrayIcon.png b/src/net/java/sip/communicator/impl/gui/resources/common/systrayIcon.png Binary files differdeleted file mode 100644 index 85bc142..0000000 --- a/src/net/java/sip/communicator/impl/gui/resources/common/systrayIcon.png +++ /dev/null diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java index 739d266..e4f63cf 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java @@ -537,18 +537,6 @@ public class ImageLoader { = new ImageID("MESSAGE_RECEIVED_ICON"); /** - * The image used to set to the systray when a new message is received. - */ - public static final ImageID SYSTRAY_ICON - = new ImageID("SYSTRAY_ICON"); - - /** - * The image used to set to the systray when a new message is received. - */ - public static final ImageID SYSTRAY_ENVELOPE_ICON - = new ImageID("SYSTRAY_ENVELOPE_ICON"); - - /** * The image used to set to the chat room "join" right button menu. */ public static final ImageID JOIN_ICON diff --git a/src/net/java/sip/communicator/impl/gui/utils/images.properties b/src/net/java/sip/communicator/impl/gui/utils/images.properties index a754f97..95afba2 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/images.properties +++ b/src/net/java/sip/communicator/impl/gui/utils/images.properties @@ -203,11 +203,8 @@ MESSAGE_RECEIVED_ICON=net/java/sip/communicator/impl/gui/resources/common/envelo REASON_DIALOG_ICON=net/java/sip/communicator/impl/gui/resources/common/reasonDialogIcon.png -SYSTRAY_ICON=net/java/sip/communicator/impl/gui/resources/common/systrayIcon.png -SYSTRAY_ENVELOPE_ICON=net/java/sip/communicator/impl/gui/resources/common/systrayEnvelopeIcon.png - JOIN_ICON=net/java/sip/communicator/impl/gui/resources/common/join.png JOIN_AS_ICON=net/java/sip/communicator/impl/gui/resources/common/join.png LEAVE_ICON=net/java/sip/communicator/impl/gui/resources/common/leave.png -WINDOW_LOGO=net/java/sip/communicator/impl/gui/resources/common/windowLogo.png
\ No newline at end of file +WINDOW_LOGO=net/java/sip/communicator/impl/gui/resources/common/windowLogo.png diff --git a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java index 52a5fda..05dcfc0 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java @@ -75,7 +75,11 @@ public class SystrayServiceJdicImpl private static Logger logger = Logger.getLogger(SystrayServiceJdicImpl.class.getName()); + /** + * The various icons used on the systray + */ private ImageIcon logoIcon; + private ImageIcon envelopeIcon; /** * Creates an instance of <tt>Systray</tt>. @@ -115,16 +119,24 @@ public class SystrayServiceJdicImpl { logoIcon = new ImageIcon( Resources.getImage("trayIconWindows")); + envelopeIcon = new ImageIcon( + Resources.getImage("messageIconWindows")); } + // If we're running under MacOSX, we use a special back and + // white icons without background. else if (osName.startsWith("Mac OS X")) { logoIcon = new ImageIcon( Resources.getImage("trayIconMacOSX")); + envelopeIcon = new ImageIcon( + Resources.getImage("messageIconMacOSX")); } else { logoIcon = new ImageIcon( Resources.getImage("trayIcon")); + envelopeIcon = new ImageIcon( + Resources.getImage("messageIcon")); } trayIcon = new TrayIcon(logoIcon, "SIP Communicator", menu); @@ -322,12 +334,18 @@ public class SystrayServiceJdicImpl /** * Sets a new Systray icon. * - * @param image the icon to set. + * @param imageType the type of the image to set. */ - public void setSystrayIcon(byte[] image) + public void setSystrayIcon(int imageType) { - if (image != null) - this.trayIcon.setIcon(new ImageIcon(image)); + if (imageType == SystrayService.SC_IMG_TYPE) + { + this.trayIcon.setIcon(logoIcon); + } + else if (imageType == SystrayService.ENVELOPE_IMG_TYPE) + { + this.trayIcon.setIcon(envelopeIcon); + } } /** diff --git a/src/net/java/sip/communicator/impl/systray/resources.properties b/src/net/java/sip/communicator/impl/systray/resources.properties index e307802..3a7e048 100644 --- a/src/net/java/sip/communicator/impl/systray/resources.properties +++ b/src/net/java/sip/communicator/impl/systray/resources.properties @@ -14,6 +14,8 @@ closeMenuIcon=net/java/sip/communicator/impl/systray/resources/quit.png sipLogo=net/java/sip/communicator/impl/systray/resources/sipLogo.png sipLogoOffline=net/java/sip/communicator/impl/systray/resources/sipLogoOffline.png messageIcon=net/java/sip/communicator/impl/systray/resources/envelope.png +messageIconWindows=net/java/sip/communicator/impl/systray/resources/envelope.png +messageIconMacOSX=net/java/sip/communicator/impl/systray/resources/envelopeMacOSX.png settings=Settings... addContact=Add contact... setStatus=Set Status diff --git a/src/net/java/sip/communicator/service/systray/SystrayService.java b/src/net/java/sip/communicator/service/systray/SystrayService.java index f00c2d0..3199812 100644 --- a/src/net/java/sip/communicator/service/systray/SystrayService.java +++ b/src/net/java/sip/communicator/service/systray/SystrayService.java @@ -37,6 +37,16 @@ public interface SystrayService public static final int NONE_MESSAGE_TYPE = -1; /** + * Image type corresponding to the sip-communicator icon + */ + public static final int SC_IMG_TYPE = 0; + + /** + * Image type corresponding to the envelope icon + */ + public static final int ENVELOPE_IMG_TYPE = 1; + + /** * Shows a system tray message with the given title and message content. The * message type will affect the icon used to present the message. * @@ -66,7 +76,7 @@ public interface SystrayService /** * Sets a new icon to the systray. * - * @param image the image to set + * @param imageType the type of the image to set */ - public void setSystrayIcon(byte[] image); + public void setSystrayIcon(int imageType); } |