diff --git a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/IRow.java b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/IRow.java index d6cd9cb..79bfc34 100644 --- a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/IRow.java +++ b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/IRow.java @@ -65,7 +65,7 @@ public class IRow extends Box { public Entry setEntry(String value, Consumer onChanged) { Entry entry = new Entry(); - entry.text = value; + entry.text = value == null ? "" : value; entry.hexpand = true; entry.valign = Align.CENTER; entry.halign = Align.FILL; diff --git a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/InstanceListEntryFactory.java b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/InstanceListEntryFactory.java index bf456a2..7c9727d 100644 --- a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/InstanceListEntryFactory.java +++ b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/control/InstanceListEntryFactory.java @@ -32,10 +32,9 @@ public class InstanceListEntryFactory extends SignalListItemFactory { var thumbnail = new InstanceThumbnail(); thumbnail.name = "inceptum-thumbnail"; - var launch = new Button(); + var launch = Button.newFromIconName("media-playback-start-symbolic"); launch.addCssClass("flat"); launch.name = "inceptum-launch"; - launch.iconName = "media-playback-start-symbolic"; launch.tooltipText = I18n.get("instance.launch"); launch.hasTooltip = true; diff --git a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.java b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.java index 15883f8..45a55d5 100644 --- a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.java +++ b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/MainWindow.java @@ -35,8 +35,7 @@ public class MainWindow extends ApplicationWindow { super(app); HeaderBar header = new HeaderBar(); - Button newButton = new Button(); - newButton.iconName = "list-add-symbolic"; + Button newButton = Button.newFromIconName("list-add-symbolic"); newButton.onClicked(() -> new NewInstanceWindow(app).show()); MenuButton accountsButton = new MenuButton(); diff --git a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/ExportTab.java b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/ExportTab.java index c21e8e7..e12df41 100644 --- a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/ExportTab.java +++ b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/ExportTab.java @@ -36,10 +36,14 @@ public class ExportTab extends SettingsTab { "_" + I18n.get("save"), "_" + I18n.get("cancel") ); + var filter = new FileFilter(); + filter.name = exporter.name + " Pack"; + filter.addPattern("*." + exporter.fileExtension); + dialog.addFilter(filter); dialog.currentName = exporter.getDefaultFileName(instance); dialog.onResponse(responseId -> { if (responseId == ResponseType.ACCEPT.value) { - var file = dialog.getFile().path; + var file = dialog.file.path; if (file == null) { GtkEnvBackend.simpleDialog( window, diff --git a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/GeneralTab.java b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/GeneralTab.java index c3b9571..2d697e4 100644 --- a/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/GeneralTab.java +++ b/launcher-gtk/src/main/java/io/gitlab/jfronny/inceptum/gtk/window/edit/GeneralTab.java @@ -1,6 +1,8 @@ package io.gitlab.jfronny.inceptum.gtk.window.edit; +import io.github.jwharm.javagi.GErrorException; import io.gitlab.jfronny.commons.ArgumentsTokenizer; +import io.gitlab.jfronny.commons.OSUtils; import io.gitlab.jfronny.commons.io.JFiles; import io.gitlab.jfronny.inceptum.common.*; import io.gitlab.jfronny.inceptum.gtk.control.ILabel; @@ -13,6 +15,7 @@ import io.gitlab.jfronny.inceptum.launcher.model.inceptum.InstanceMeta; import io.gitlab.jfronny.inceptum.launcher.model.mojang.VersionsList; import io.gitlab.jfronny.inceptum.launcher.system.instance.*; import io.gitlab.jfronny.inceptum.launcher.util.GameVersionParser; +import org.gtk.gio.File; import org.gtk.gobject.BindingFlags; import org.gtk.gtk.*; @@ -114,7 +117,39 @@ public class GeneralTab extends SettingsTab { instance.writeMeta(); }); } - //TODO Custom Java (checkbox) + String: path + { + var row = section.row("instance.settings.general.game.java", "instance.settings.general.game.java.subtitle"); + var entry = row.setEntry(instance.meta.java, s -> { + instance.meta.java = s.isBlank() ? null : s; + instance.writeMeta(); + }); + var btn = Button.newFromIconName("folder-symbolic"); + btn.valign = Align.CENTER; + btn.onClicked(() -> { + FileChooserNative dialog = new FileChooserNative( + I18n.get("instance.settings.general.game.java"), + window, + FileChooserAction.OPEN, + "_" + I18n.get("select"), + "_" + I18n.get("cancel") + ); + if (instance.meta.java != null && Files.exists(Path.of(instance.meta.java))) { + try { + dialog.setFile(File.newForPath(instance.meta.java)); + } catch (GErrorException e) { + Utils.LOGGER.error("Could not set starting point", e); + } + } + dialog.onResponse(responseId -> { + if (responseId == ResponseType.ACCEPT.value) { + var file = dialog.file.path; + if (file != null) entry.text = file; + } + }); + dialog.show(); + }); + row.append(btn); + } //TODO minMem/maxMem (slider?) }); section("instance.settings.general.args", section -> { diff --git a/launcher-gtk/src/main/resources/inceptum.properties b/launcher-gtk/src/main/resources/inceptum.properties index b7ac639..b96b938 100644 --- a/launcher-gtk/src/main/resources/inceptum.properties +++ b/launcher-gtk/src/main/resources/inceptum.properties @@ -20,6 +20,7 @@ ok=Ok cancel=Cancel show=Show save=Save +select=Select menu.hamburger.support=Support menu.hamburger.preferences=Preferences menu.hamburger.about=About @@ -87,4 +88,6 @@ settings.author-name.subtitle=The author name to add to packs where the metadata instance.settings.general.game.fabric.enabled=Fabric instance.settings.general.game.fabric.enabled.subtitle=Whether the Fabric Loader should be used for this instance instance.settings.general.game.fabric.version=Fabric Version -instance.settings.general.game.fabric.version.subtitle=Version of the Fabric Loader to use \ No newline at end of file +instance.settings.general.game.fabric.version.subtitle=Version of the Fabric Loader to use +instance.settings.general.game.java=Java +instance.settings.general.game.java.subtitle=The path of the custom Java binary to use (or empty for default) \ No newline at end of file diff --git a/launcher-gtk/src/main/resources/inceptum_de.properties b/launcher-gtk/src/main/resources/inceptum_de.properties index d5d7417..ff1d694 100644 --- a/launcher-gtk/src/main/resources/inceptum_de.properties +++ b/launcher-gtk/src/main/resources/inceptum_de.properties @@ -19,6 +19,7 @@ ok=OK cancel=Abbrechen show=Anzeigen save=Speichern +select=Auswählen menu.hamburger.support=Unterstützung menu.hamburger.preferences=Einstellungen menu.hamburger.about=Über @@ -87,4 +88,6 @@ settings.author-name.subtitle=Der Name, der bei Modpack-Exporten, deren Metadate instance.settings.general.game.fabric.enabled=Fabric instance.settings.general.game.fabric.enabled.subtitle=Ob Fabric-Loader für diese Instanz aktiviert werden soll instance.settings.general.game.fabric.version=Fabric-Version -instance.settings.general.game.fabric.version.subtitle=Zu verwendende Version des Fabric-Loaders \ No newline at end of file +instance.settings.general.game.fabric.version.subtitle=Zu verwendende Version des Fabric-Loaders +instance.settings.general.game.java=Java +instance.settings.general.game.java.subtitle=Pfad der Java-Binärdatei, die diese Instanz verwenden soll. Leer lassen um die Standard-Binärdatei zu nutzen. \ No newline at end of file