Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Nov 30, 2023
1 parent bcda16b commit 0f6a426
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ private static DBusConnection getNewConnection() throws DBusException {
} catch (DBusConnectionException | DBusExecutionException de) {
LOG.warn("Connecting to SESSION bus failed.", de);
LOG.warn("Falling back to SYSTEM DBus");
try {
return DBusConnectionBuilder.forSystemBus().build();
} catch (DBusException e) {
throw e;
}
return DBusConnectionBuilder.forSystemBus().build();
}
}

Expand Down Expand Up @@ -144,7 +140,7 @@ public char[] loadPassphrase(String key) throws KeychainAccessException {
} else {
LOG.debug("loadPassphrase: wallet is closed.");
}
return (password.equals("")) ? null : password.toCharArray();
return (password.isEmpty()) ? null : password.toCharArray();
} catch (RuntimeException e) {
throw new KeychainAccessException("Loading the passphrase failed.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class AppindicatorTrayMenuController implements TrayMenuController {
private static final Arena ARENA = Arena.global();
private MemorySegment indicator;
private MemorySegment menu = gtk_menu_new();
private Optional<String> svgSourcePath;

@CheckAvailability
public static boolean isAvailable() {
Expand All @@ -48,9 +47,9 @@ public void showTrayIcon(Consumer<TrayIconLoader> iconLoader, Runnable runnable,

private void showTrayIconWithSVG(String s) {
try (var arena = Arena.ofConfined()) {
svgSourcePath = Optional.ofNullable(System.getProperty(SVG_SOURCE_PROPERTY));
var svgSourcePath = System.getProperty(SVG_SOURCE_PROPERTY);
// flatpak
if (svgSourcePath.isEmpty()) {
if (svgSourcePath != null) {
indicator = app_indicator_new(arena.allocateUtf8String(APP_INDICATOR_ID),
arena.allocateUtf8String(s),
APP_INDICATOR_CATEGORY_APPLICATION_STATUS());
Expand All @@ -60,7 +59,7 @@ private void showTrayIconWithSVG(String s) {
arena.allocateUtf8String(s),
APP_INDICATOR_CATEGORY_APPLICATION_STATUS(),
// find tray icons theme in mounted AppImage / installed on system by ppa
arena.allocateUtf8String(svgSourcePath.get()));
arena.allocateUtf8String(svgSourcePath));
}
}
}
Expand Down Expand Up @@ -105,7 +104,7 @@ private void addChildren(MemorySegment menu, List<TrayMenuItem> items) {
}
gtk_menu_shell_append(menu, gtkMenuItem);
}
case SeparatorItem separatorItem -> {
case SeparatorItem _ -> {
var gtkSeparator = gtk_menu_item_new();
gtk_menu_shell_append(menu, gtkSeparator);
}
Expand Down

0 comments on commit 0f6a426

Please sign in to comment.