Skip to content

Commit

Permalink
Fix startup under Linux (#272)
Browse files Browse the repository at this point in the history
* Upgrade dependencies

* Fix startup failure under Linux

java.lang.UnsupportedOperationException: Unable to load glass GTK library.
        at com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(GtkApplication.java:176)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
        at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:163)

* Add changelog entry

---------

Co-authored-by: kaklakariada <[email protected]>
  • Loading branch information
kaklakariada and kaklakariada authored Apr 14, 2024
1 parent 7ae5699 commit b2e2081
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This release requires Java 21.
* Added build with Java 20
* UI-Tests run only in non-headless mode due to restrictions with the latest JavaFX version, see #261
* [#132](https://github.com/itsallcode/white-rabbit/issues/132): Fix display of negative zero duration
* [#272](https://github.com/itsallcode/white-rabbit/pull/272): Fix startup under Linux

## [1.8.0] - 2022-01-22

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'eclipse'
id "org.sonarqube" version "4.4.1.3373"
id "org.sonarqube" version "5.0.0.4638"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id "io.codearte.nexus-staging" version "0.30.0"
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class App
{
public static void main(String[] args)
public static void main(final String[] args)
{
System.setProperty("javafx.preloader", SplashScreenLoader.class.getName());
System.setProperty("log4j.skipJansi", "false");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.itsallcode.whiterabbit.jfxui;


import java.awt.Desktop;
import java.util.Locale;

Expand Down Expand Up @@ -55,6 +54,13 @@ else if (os.indexOf("linux") >= 0)

public boolean isDesktopSupported()
{
if (getOperatingSystemType() == OSType.LINUX)
{
// Calling Desktop.isDesktopSupported() on Linux throws exception
// "java.lang.UnsupportedOperationException: Unable to load glass
// GTK library."
return false;
}
return Desktop.isDesktopSupported();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public interface Tray
{
static Tray create(TrayCallback callback)
static Tray create(final TrayCallback callback)
{
return SwingUtil.runOnSwingThread(() -> {
if (!isAwtSystemTraySupported())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class AppUi
private final ActivitiesTable activitiesTable;
private final Tray tray;

private AppUi(Builder builder)
private AppUi(final Builder builder)
{
dayRecordTable = builder.dayRecordTable;
activitiesTable = builder.activitiesTable;
Expand All @@ -70,12 +70,12 @@ public void shutdown()
tray.removeTrayIcon();
}

public void selectDay(LocalDate date)
public void selectDay(final LocalDate date)
{
dayRecordTable.selectRow(date);
}

public void updateActivities(DayRecord dayRecord)
public void updateActivities(final DayRecord dayRecord)
{
activitiesTable.updateTableValues(dayRecord);
}
Expand All @@ -93,7 +93,8 @@ public static class Builder
private ActivitiesTable activitiesTable;
private Tray tray;

public Builder(JavaFxApp app, UiActions actions, AppService appService, Stage primaryStage, AppState appState)
public Builder(final JavaFxApp app, final UiActions actions, final AppService appService,
final Stage primaryStage, final AppState appState)
{
this.app = app;
this.actions = actions;
Expand Down Expand Up @@ -269,7 +270,7 @@ private ToolBar createToolBar()
UiWidget.button("update-button", "Update", e -> appService.updateNow()));
}

private void gotoMonth(int step)
private void gotoMonth(final int step)
{
final YearMonth selecteMonth = state.currentMonth.get().getYearMonth().plusMonths(step);
app.loadMonth(selecteMonth);
Expand Down Expand Up @@ -346,7 +347,8 @@ private Node monthDropDownBox()
return comboBox;
}

private void dateChanged(ObservableValue<? extends LocalDate> observable, LocalDate oldDate, LocalDate newDate)
private void dateChanged(final ObservableValue<? extends LocalDate> observable, final LocalDate oldDate,
final LocalDate newDate)
{
dayRecordTable.selectRow(newDate);
if (oldDate.getMonth() != newDate.getMonth())
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencyResolutionManagement {
library('junitParams', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junitJupiter')
library('assertj', 'org.assertj:assertj-core:3.25.3')
library('junitPioneer', 'org.junit-pioneer:junit-pioneer:2.2.0')
library('equalsverifier', 'nl.jqno.equalsverifier:equalsverifier:3.15.8')
library('equalsverifier', 'nl.jqno.equalsverifier:equalsverifier:3.16.1')
library('tostringverifier', 'com.jparams:to-string-verifier:1.4.8')
library('hamcrest', 'org.hamcrest:hamcrest-all:1.3')
library('mockito', 'org.mockito', 'mockito-core').versionRef('mockito')
Expand All @@ -37,7 +37,7 @@ dependencyResolutionManagement {
library('testfx', 'org.testfx:testfx-junit5:4.0.18')
library('monocle', 'org.pdfsam:javafx-monocle:21')

library('jsonBindApi', 'jakarta.json.bind:jakarta.json.bind-api:3.0.0')
library('jsonBindApi', 'jakarta.json.bind:jakarta.json.bind-api:3.0.1')
library('yasson', 'org.eclipse:yasson:3.0.3')

library('jdtAnnotations', 'org.eclipse.jdt:org.eclipse.jdt.annotation:2.3.0')
Expand Down

0 comments on commit b2e2081

Please sign in to comment.