mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 19:51:27 +00:00
remove unnecessary awtReavealer and trayModule
This commit is contained in:
@@ -10,7 +10,7 @@ import dagger.Subcomponent;
|
||||
import java.awt.SystemTray;
|
||||
|
||||
@TrayMenuScoped
|
||||
@Subcomponent(modules = TrayMenuModule.class)
|
||||
@Subcomponent
|
||||
public interface TrayMenuComponent {
|
||||
|
||||
Lazy<TrayIconController> trayIconController();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.cryptomator.ui.traymenu;
|
||||
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.Volume;
|
||||
import org.cryptomator.ui.fxapp.FxApplication;
|
||||
import org.cryptomator.ui.launcher.AppLifecycleListener;
|
||||
import org.cryptomator.ui.launcher.FxApplicationStarter;
|
||||
@@ -28,16 +27,14 @@ class TrayMenuController {
|
||||
private final AppLifecycleListener appLifecycle;
|
||||
private final FxApplicationStarter fxApplicationStarter;
|
||||
private final ObservableList<Vault> vaults;
|
||||
private final Volume.Revealer revealer;
|
||||
private final PopupMenu menu;
|
||||
|
||||
@Inject
|
||||
TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList<Vault> vaults, Volume.Revealer revealer) {
|
||||
TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList<Vault> vaults) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
this.appLifecycle = appLifecycle;
|
||||
this.fxApplicationStarter = fxApplicationStarter;
|
||||
this.vaults = vaults;
|
||||
this.revealer = revealer;
|
||||
this.menu = new PopupMenu();
|
||||
}
|
||||
|
||||
@@ -124,7 +121,9 @@ class TrayMenuController {
|
||||
}
|
||||
|
||||
private void revealVault(Vault vault) {
|
||||
showMainAppAndThen(app -> app.getVaultService().reveal(vault, revealer));
|
||||
showMainAppAndThen(app -> //
|
||||
app.getVaultService().reveal(vault, p -> app.getHostServices().showDocument(p.toUri().toString())) //
|
||||
);
|
||||
}
|
||||
|
||||
void showMainWindow(@SuppressWarnings("unused") ActionEvent actionEvent) {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.cryptomator.ui.traymenu;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.cryptomator.common.vaults.Volume;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
|
||||
@Module
|
||||
abstract class TrayMenuModule {
|
||||
|
||||
@Provides
|
||||
static Volume.Revealer provideAwtRevealer(){
|
||||
return p -> {
|
||||
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
|
||||
try {
|
||||
Desktop.getDesktop().open(p.toFile());
|
||||
} catch (IOException e) {
|
||||
throw new Volume.VolumeException(e);
|
||||
}
|
||||
} else {
|
||||
throw new Volume.VolumeException("API to browse files not supported. Please try again from inside the application.");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user