Skip to content

Commit e7a693a

Browse files
minor tray menu API adjustments
1 parent 9272d89 commit e7a693a

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
package org.cryptomator.integrations.tray;
22

3-
public record ActionItem(String title, Runnable action) implements TrayMenuItem {
3+
public record ActionItem(String title, Runnable action, boolean enabled) implements TrayMenuItem {
4+
5+
public ActionItem(String title, Runnable action) {
6+
this(title, action, true);
7+
}
48
}

src/main/java/org/cryptomator/integrations/tray/TrayMenuController.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,21 @@ static Optional<TrayMenuController> get() {
2323
/**
2424
* Displays an icon on the system tray.
2525
*
26-
* @param rawImageData What image to show
26+
* @param imageData What image to show
2727
* @param defaultAction Action to perform when interacting with the icon directly instead of its menu
2828
* @param tooltip Text shown when hovering
29-
* @throws IOException thrown when interacting with the given <code>rawImageData</code>
29+
* @throws TrayMenuException thrown when adding the tray icon failed
3030
*/
31-
void showTrayIcon(InputStream rawImageData, Runnable defaultAction, String tooltip) throws IOException;
31+
void showTrayIcon(byte[] imageData, Runnable defaultAction, String tooltip) throws TrayMenuException;
3232

3333
/**
3434
* Show the given options in the tray menu.
3535
* <p>
3636
* This method may be called multiple times, e.g. when the vault list changes.
3737
*
3838
* @param items Menu items
39+
* @throws TrayMenuException thrown when updating the tray menu failed
3940
*/
40-
void updateTrayMenu(List<TrayMenuItem> items);
41+
void updateTrayMenu(List<TrayMenuItem> items) throws TrayMenuException;
4142

4243
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.cryptomator.integrations.tray;
2+
3+
public class TrayMenuException extends Exception {
4+
5+
public TrayMenuException(String message) {
6+
super(message);
7+
}
8+
9+
public TrayMenuException(String message, Throwable cause) {
10+
super(message, cause);
11+
}
12+
13+
}

0 commit comments

Comments
 (0)