Skip to content

Commit 712fc8e

Browse files
committed
Refactor HostEditor and HostList UI components to enhance user interaction and input validation. Changed port and server alive settings from EntryRow to SpinRow for numeric input, added button actions for SSH command copying and connection testing, and improved error handling for input values. Removed unused count label from HostList to streamline the interface.
1 parent de5b5ba commit 712fc8e

File tree

5 files changed

+133
-148
lines changed

5 files changed

+133
-148
lines changed

data/ui/host_editor.blp

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,16 @@ template $HostEditor: Gtk.Box {
128128
title: _("Username");
129129
}
130130

131-
Adw.EntryRow port_entry {
131+
Adw.SpinRow port_entry {
132132
title: _("Port");
133+
numeric: true;
134+
adjustment: Gtk.Adjustment {
135+
value: 22;
136+
lower: 1;
137+
upper: 65535;
138+
step-increment: 1;
139+
page-increment: 10;
140+
};
133141
}
134142

135143
Label port_error_label {
@@ -156,6 +164,9 @@ template $HostEditor: Gtk.Box {
156164
margin-bottom: 8;
157165
icon-name: "document-open-symbolic";
158166
tooltip-text: _("Choose Identity File");
167+
styles [
168+
"flat",
169+
]
159170
}
160171

161172
[suffix]
@@ -164,6 +175,9 @@ template $HostEditor: Gtk.Box {
164175
margin-bottom: 8;
165176
icon-name: "dialog-password-symbolic";
166177
tooltip-text: _("Pick from existing SSH keys");
178+
styles [
179+
"flat",
180+
]
167181
}
168182
}
169183

@@ -181,16 +195,28 @@ template $HostEditor: Gtk.Box {
181195
Adw.PreferencesGroup {
182196
title: _("Actions");
183197

184-
Adw.ActionRow copy_row {
185-
title: _("Copy SSH command");
186-
activatable: true;
187-
subtitle: _("Copies the resolved SSH command to the clipboard");
188-
}
198+
Box {
199+
orientation: horizontal;
200+
spacing: 12;
201+
margin-top: 12;
202+
margin-bottom: 12;
203+
204+
Button copy_button {
205+
label: _("Copy SSH command");
206+
hexpand: true;
207+
styles [
208+
"pill",
209+
"suggested-action",
210+
]
211+
}
189212

190-
Adw.ActionRow test_row {
191-
title: _("Test connection");
192-
activatable: true;
193-
subtitle: _("Runs a quick non-interactive SSH check");
213+
Button test_button {
214+
label: _("Test connection");
215+
hexpand: true;
216+
styles [
217+
"pill",
218+
]
219+
}
194220
}
195221
}
196222
};
@@ -247,16 +273,28 @@ template $HostEditor: Gtk.Box {
247273
}
248274
}
249275

250-
Adw.EntryRow serveralive_interval_entry {
276+
Adw.SpinRow serveralive_interval_entry {
251277
title: _("ServerAliveInterval (s)");
252-
show-apply-button: false;
253-
input-purpose: number;
278+
numeric: true;
279+
adjustment: Gtk.Adjustment {
280+
value: 0;
281+
lower: 0;
282+
upper: 300;
283+
step-increment: 1;
284+
page-increment: 10;
285+
};
254286
}
255287

256-
Adw.EntryRow serveralive_count_entry {
288+
Adw.SpinRow serveralive_count_entry {
257289
title: _("ServerAliveCountMax");
258-
show-apply-button: false;
259-
input-purpose: number;
290+
numeric: true;
291+
adjustment: Gtk.Adjustment {
292+
value: 3;
293+
lower: 1;
294+
upper: 100;
295+
step-increment: 1;
296+
page-increment: 5;
297+
};
260298
}
261299

262300
Adw.ActionRow {

data/ui/host_list.blp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ template $HostList: Box {
3737
label: _("SSH Studio");
3838
halign: center;
3939
hexpand: true;
40-
margin-start: 24;
4140
styles [
4241
"title-4",
4342
]
@@ -116,13 +115,6 @@ template $HostList: Box {
116115
}
117116
}
118117

119-
Label count_label {
120-
label: _("0 hosts");
121-
halign: end;
122-
styles [
123-
"dim-label",
124-
]
125-
}
126118

127119
}
128120
}

src/main.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,6 @@ def update_ui():
189189
self.main_window.host_list.load_hosts(
190190
self.parser.config.hosts
191191
)
192-
try:
193-
self.main_window._update_status(
194-
_("Configuration loaded successfully")
195-
)
196-
except Exception:
197-
pass
198192
except Exception:
199193
pass
200194
return False

0 commit comments

Comments
 (0)