Author: jflesch
Date: 2007-08-09 01:42:30 +0000 (Thu, 09 Aug 2007)
New Revision: 14552
Modified:
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
Log:
Adapt the size of the tray icon popup to the transfers list
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-08-08
23:59:53 UTC (rev 14551)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-08-09
01:42:30 UTC (rev 14552)
@@ -530,10 +530,14 @@
thaw.plugin.transferLogs.chooseFile=Choisisez un fichier
thaw.plugin.transferLogs.importedKey=Clef import?e
+## Tray icon
+
thaw.plugin.trayIcon.pluginName=Ic?ne systray
thaw.plugin.trayIcon.dialogTitle=Transferts Freenet
thaw.plugin.trayIcon.java1.6=D?sol?, ce plugin n?cessite au moins Java 1.6
(parfois appell? J2SE 6)
+thaw.plugin.trayIcon.emptyQueue=Aucun transfert en cours
+
## MDNS
thaw.plugin.MDNS=Autod?tection de la node
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-08-08 23:59:53 UTC
(rev 14551)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-08-09 01:42:30 UTC
(rev 14552)
@@ -541,9 +541,12 @@
thaw.plugin.transferLogs.importedKey=Imported key
+## Tray icon
+
thaw.plugin.trayIcon.pluginName=Tray icon
thaw.plugin.trayIcon.dialogTitle=Freenet transfers
thaw.plugin.trayIcon.java1.6=Sorry, this plugin requires at least Java 1.6
(aka J2SE 6)
+thaw.plugin.trayIcon.emptyQueue=No transfer running
## MDNS
Modified: trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java 2007-08-08 23:59:53 UTC
(rev 14551)
+++ trunk/apps/Thaw/src/thaw/plugins/TrayIcon.java 2007-08-09 01:42:30 UTC
(rev 14552)
@@ -47,8 +47,8 @@
private JDialog dialog;
private JButton closeDialog;
- public final static int DIALOG_X = 300;
- public final static int DIALOG_Y = 500;
+ public final static int DIALOG_X = 500;
+ public final static int DIALOG_Y = 800;
public TrayIcon() {
@@ -243,9 +243,9 @@
}
- private void realDisplayFrame(int x, int y) {
+ private boolean realDisplayFrame(int x, int y) {
dialog = new JDialog((java.awt.Frame)null,
-
I18n.getMessage("thaw.plugin.trayIcon.dialogTitle"));
+
I18n.getMessage("thaw.plugin.trayIcon.dialogTitle"));
dialog.getContentPane().setLayout(new BorderLayout(5, 5));
dialog.setUndecorated(true);
dialog.setResizable(true);
@@ -266,6 +266,14 @@
}
}
+ if (newQueries.size() == 0) {
+ popMessage("Thaw",
+
I18n.getMessage("thaw.plugin.trayIcon.emptyQueue"),
+ SysTrayIcon.MSG_WARNING);
+ dialog = null;
+ return false;
+ }
+
Collections.sort(newQueries, new QueryComparator());
@@ -297,13 +305,39 @@
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
BorderLayout.CENTER);
+ //dialog.setSize(DIALOG_X, DIALOG_Y);
+ dialog.validate();
+ dialog.pack();
+
+ java.awt.Dimension size = dialog.getSize();
+
+ double height = size.getHeight();
+ double width = size.getWidth();
+
+ if (width > DIALOG_X)
+ width = DIALOG_X;
+ if (height > DIALOG_Y)
+ height = DIALOG_Y;
+
+ dialog.setSize((int)width, (int)height);
+
+
+ java.awt.Dimension d =
Toolkit.getDefaultToolkit().getScreenSize();
+ int screen_x = (int)d.getWidth();
+ int screen_y = (int)d.getHeight();
+
+ if (x+width >= screen_x)
+ x -= width;
+ if (y+height >= screen_y)
+ y -= height;
+
+
dialog.setLocation(x, y);
- dialog.setSize(DIALOG_X, DIALOG_Y);
- dialog.validate();
-
dialog.setVisible(true);
dialog.toFront();
+
+ return true;
}
@@ -347,29 +381,23 @@
public void displayFrame(int x, int y) {
- java.awt.Dimension d =
Toolkit.getDefaultToolkit().getScreenSize();
- int screen_x = (int)d.getWidth();
- int screen_y = (int)d.getHeight();
+ if (realDisplayFrame(x, y) && dialog != null) {
- if (x+DIALOG_X >= screen_x)
- x -= DIALOG_X;
- if (y+DIALOG_Y >= screen_y)
- y -= DIALOG_Y;
-
- realDisplayFrame(x, y);
-
- /* progressBars vector is generated at the same time than the
panels */
- refresher = new ProgressBarRefresher(progressBars);
- Thread th = new Thread(refresher);
- th.start();
+ /* progressBars vector is generated at the same time
than the panels */
+ refresher = new ProgressBarRefresher(progressBars);
+ Thread th = new Thread(refresher);
+ th.start();
+ }
}
public void hideFrame() {
- dialog.setVisible(false);
- dialog = null;
- progressBars = null;
- refresher.stop();
- refresher = null;
+ if (dialog != null) {
+ dialog.setVisible(false);
+ dialog = null;
+ progressBars = null;
+ refresher.stop();
+ refresher = null;
+ }
}