fix: setup nicht in AGS 3.1, zurück zu onChanged + closure variablen
This commit is contained in:
@@ -1131,15 +1131,13 @@ function startRefreshTimer() {
|
||||
}
|
||||
|
||||
function SetupView() {
|
||||
let hostEntry: Gtk.Entry | null = null;
|
||||
let userEntry: Gtk.Entry | null = null;
|
||||
let portEntry: Gtk.Entry | null = null;
|
||||
let host = "";
|
||||
let user = "root";
|
||||
let port = "22";
|
||||
|
||||
function doSave() {
|
||||
if (!hostEntry || !userEntry || !portEntry) return;
|
||||
const host = hostEntry.get_text();
|
||||
if (!host) return;
|
||||
saveConfig(host, userEntry.get_text() || "root", portEntry.get_text() || "22");
|
||||
saveConfig(host, user || "root", port || "22");
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -1149,24 +1147,24 @@ function SetupView() {
|
||||
<label class="subtitle" xalign={0} label="Ersteinrichtung — Serververbindung konfigurieren" />
|
||||
</box>
|
||||
<entry
|
||||
setup={self => { hostEntry = self; }}
|
||||
onChanged={self => { host = self.text || self.get_text(); }}
|
||||
onActivate={doSave}
|
||||
placeholderText="Server-Adresse (IP oder Domain)"
|
||||
hexpand
|
||||
onActivate={doSave}
|
||||
/>
|
||||
<entry
|
||||
setup={self => { userEntry = self; }}
|
||||
onChanged={self => { user = self.text || self.get_text(); }}
|
||||
onActivate={doSave}
|
||||
placeholderText="SSH-Benutzer"
|
||||
text="root"
|
||||
hexpand
|
||||
onActivate={doSave}
|
||||
/>
|
||||
<entry
|
||||
setup={self => { portEntry = self; }}
|
||||
onChanged={self => { port = self.text || self.get_text(); }}
|
||||
onActivate={doSave}
|
||||
placeholderText="SSH-Port"
|
||||
text="22"
|
||||
hexpand
|
||||
onActivate={doSave}
|
||||
/>
|
||||
<button
|
||||
class="button primary"
|
||||
|
||||
Reference in New Issue
Block a user