Commit c65ddad7 authored by Mickaël Guessant's avatar Mickaël Guessant

SWT: Try to detect if system tray is indeed available

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2448 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent 8796d74f
......@@ -6,6 +6,9 @@
<pathelement location="classes"/>
<fileset dir="lib">
<include name="*.jar"/>
<!-- make sure we compile with swt gtk 64 -->
<exclude name="swt-*-x86.jar"/>
<exclude name="swt-*-win32-*.jar"/>
</fileset>
</path>
......
......@@ -33,6 +33,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.internal.gtk.GdkRectangle;
import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.*;
......@@ -223,6 +224,16 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
trayItem = new TrayItem(tray, SWT.NONE);
trayItem.setToolTipText(BundleMessage.format("UI_DAVMAIL_GATEWAY"));
// check if tray is indeed available
if (systemLookAndFeelClassName.contains("gtk")) {
GdkRectangle area = new GdkRectangle();
OS.gtk_status_icon_get_geometry(trayItem.handle, 0, area, 0);
if (area.x == 0 && area.y == 0) {
throw new Error("System tray not available");
}
}
awtImage = DavGatewayTray.loadImage(AwtGatewayTray.TRAY_PNG);
image = loadSwtImage(AwtGatewayTray.TRAY_PNG);
image2 = loadSwtImage(AwtGatewayTray.TRAY_ACTIVE_PNG);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment