|
@@ -11,6 +11,8 @@ import dagger.Provides;
|
|
|
import javafx.application.Application;
|
|
|
import javafx.beans.property.ObjectProperty;
|
|
|
import javafx.beans.property.SimpleObjectProperty;
|
|
|
+import javafx.scene.image.Image;
|
|
|
+import org.apache.commons.lang3.SystemUtils;
|
|
|
import org.cryptomator.common.vaults.Vault;
|
|
|
import org.cryptomator.keychain.KeychainModule;
|
|
|
import org.cryptomator.ui.mainwindow.MainWindowComponent;
|
|
@@ -18,6 +20,11 @@ import org.cryptomator.ui.preferences.PreferencesComponent;
|
|
|
import org.cryptomator.ui.quit.QuitComponent;
|
|
|
import org.cryptomator.ui.unlock.UnlockComponent;
|
|
|
|
|
|
+import javax.inject.Named;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.UncheckedIOException;
|
|
|
+import java.util.Optional;
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
|
@Module(includes = {KeychainModule.class, UpdateCheckerModule.class}, subcomponents = {MainWindowComponent.class, PreferencesComponent.class, UnlockComponent.class, QuitComponent.class})
|
|
@@ -39,6 +46,20 @@ abstract class FxApplicationModule {
|
|
|
return ResourceBundle.getBundle("i18n.strings");
|
|
|
}
|
|
|
|
|
|
+ @Provides
|
|
|
+ @Named("windowIcon")
|
|
|
+ @FxApplicationScoped
|
|
|
+ static Optional<Image> provideWindowIcon() {
|
|
|
+ if (SystemUtils.IS_OS_MAC) {
|
|
|
+ return Optional.empty();
|
|
|
+ }
|
|
|
+ try (InputStream in = FxApplicationModule.class.getResourceAsStream("/window_icon_32.png")) { // TODO: use some higher res depending on display?
|
|
|
+ return Optional.of(new Image(in));
|
|
|
+ } catch (IOException e) {
|
|
|
+ return Optional.empty();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Provides
|
|
|
static MainWindowComponent provideMainWindowComponent(MainWindowComponent.Builder builder) {
|
|
|
return builder.build();
|