diff options
author | Romain Kuntz <rkuntz@java.net> | 2007-10-24 15:07:46 +0000 |
---|---|---|
committer | Romain Kuntz <rkuntz@java.net> | 2007-10-24 15:07:46 +0000 |
commit | 62b58e28b6aad237bb8ac1a63155cd591629261a (patch) | |
tree | 9c3421cd569bcd6f01e20e4e1f97042ff9d9e691 /src/net/java/sip/communicator/impl | |
parent | eee50a66d7495329396d6719621d4c88230f9223 (diff) | |
download | jitsi-62b58e28b6aad237bb8ac1a63155cd591629261a.zip jitsi-62b58e28b6aad237bb8ac1a63155cd591629261a.tar.gz jitsi-62b58e28b6aad237bb8ac1a63155cd591629261a.tar.bz2 |
The systray implementation now takes care of selecting the correct icon to display according to the OS type. Other plugins do not have to take care of the OS type when they want to change the icon, and just need to call setSystrayIcon() with the correct Image type identifier.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
7 files changed, 30 insertions, 29 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 |