Skip to content

Commit 833e24a

Browse files
Merge pull request #29 from purejava/appindicator-jdk-21
Update to appindicator based on JDK 21
2 parents 8de65ef + 7fbd198 commit 833e24a

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/setup-java@v3
1212
with:
1313
distribution: 'zulu'
14-
java-version: 20
14+
java-version: 21
1515
cache: 'maven'
1616
- name: Ensure to use tagged version
1717
if: startsWith(github.ref, 'refs/tags/')

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/setup-java@v3
2222
with:
2323
distribution: 'zulu'
24-
java-version: 20
24+
java-version: 21
2525
cache: 'maven'
2626
- name: Initialize CodeQL
2727
uses: github/codeql-action/init@v2

.github/workflows/publish-central.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/setup-java@v3
1717
with:
1818
distribution: 'zulu'
19-
java-version: 20
19+
java-version: 21
2020
cache: 'maven'
2121
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
2222
server-username: MAVEN_USERNAME # env variable for username in deploy

.github/workflows/publish-github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/setup-java@v3
1212
with:
1313
distribution: 'zulu'
14-
java-version: 20
14+
java-version: 21
1515
cache: 'maven'
1616
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
1717
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636

3737
<properties>
3838
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39-
<project.jdk.version>20</project.jdk.version>
39+
<project.jdk.version>21</project.jdk.version>
4040

4141
<!-- runtime dependencies -->
4242

4343
<api.version>1.3.0</api.version>
4444
<secret-service.version>1.8.1-jdk17</secret-service.version>
4545
<kdewallet.version>1.3.2</kdewallet.version>
46-
<appindicator.version>1.3.4</appindicator.version>
46+
<appindicator.version>1.3.6</appindicator.version>
4747
<guava.version>32.0.0-jre</guava.version>
4848
<slf4j.version>1.7.36</slf4j.version>
4949
<commons-lang3.version>3.12.0</commons-lang3.version>

src/main/java/org/cryptomator/linux/tray/AppindicatorTrayMenuController.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.cryptomator.linux.tray;
22

3-
import org.apache.commons.lang3.StringUtils;
43
import org.cryptomator.integrations.common.CheckAvailability;
54
import org.cryptomator.integrations.common.OperatingSystem;
65
import org.cryptomator.integrations.common.Priority;
@@ -16,7 +15,6 @@
1615

1716
import java.lang.foreign.Arena;
1817
import java.lang.foreign.MemorySegment;
19-
import java.lang.foreign.SegmentScope;
2018
import java.util.List;
2119
import java.util.Optional;
2220
import java.util.function.Consumer;
@@ -30,7 +28,7 @@ public class AppindicatorTrayMenuController implements TrayMenuController {
3028
private static final String APP_INDICATOR_ID = "org.cryptomator.Cryptomator";
3129
private static final String SVG_SOURCE_PROPERTY = "cryptomator.integrationsLinux.trayIconsDir";
3230

33-
private static final SegmentScope SCOPE = SegmentScope.global();
31+
private static final Arena ARENA = Arena.global();
3432
private MemorySegment indicator;
3533
private MemorySegment menu = gtk_menu_new();
3634
private Optional<String> svgSourcePath;
@@ -49,7 +47,7 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,
4947
}
5048

5149
private void showTrayIconWithSVG(String s) {
52-
try (var arena = Arena.openConfined()) {
50+
try (var arena = Arena.ofConfined()) {
5351
svgSourcePath = Optional.ofNullable(System.getProperty(SVG_SOURCE_PROPERTY));
5452
// flatpak
5553
if (svgSourcePath.isEmpty()) {
@@ -74,7 +72,7 @@ public void updateTrayIcon(Consumer<TrayIconLoader> iconLoader) {
7472
}
7573

7674
private void updateTrayIconWithSVG(String s) {
77-
try (var arena = Arena.openConfined()) {
75+
try (var arena = Arena.ofConfined()) {
7876
app_indicator_set_icon(indicator, arena.allocateUtf8String(s));
7977
}
8078
}
@@ -97,11 +95,11 @@ private void addChildren(MemorySegment menu, List<TrayMenuItem> items) {
9795
switch (item) {
9896
case ActionItem a -> {
9997
var gtkMenuItem = gtk_menu_item_new();
100-
try (var arena = Arena.openConfined()) {
98+
try (var arena = Arena.ofConfined()) {
10199
gtk_menu_item_set_label(gtkMenuItem, arena.allocateUtf8String(a.title()));
102100
g_signal_connect_object(gtkMenuItem,
103101
arena.allocateUtf8String("activate"),
104-
GCallback.allocate(new ActionItemCallback(a), SCOPE),
102+
GCallback.allocate(new ActionItemCallback(a), ARENA),
105103
menu,
106104
0);
107105
}
@@ -114,7 +112,7 @@ private void addChildren(MemorySegment menu, List<TrayMenuItem> items) {
114112
case SubMenuItem s -> {
115113
var gtkMenuItem = gtk_menu_item_new();
116114
var gtkSubmenu = gtk_menu_new();
117-
try (var arena = Arena.openConfined()) {
115+
try (var arena = Arena.ofConfined()) {
118116
gtk_menu_item_set_label(gtkMenuItem, arena.allocateUtf8String(s.title()));
119117
}
120118
addChildren(gtkSubmenu, s.items());

0 commit comments

Comments
 (0)