Skip to content

Commit c9144a1

Browse files
committed
Refactor SSH-Studio configuration and UI components
- Fixed Build System - Added adaptive layout - Fixed Connections not working
1 parent 51b3b78 commit c9144a1

16 files changed

+423
-336
lines changed

data/ssh-studio.in

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
#!/usr/bin/env bash
2-
exec python3 -m ssh_studio.main "$@"
1+
#!@PYTHON@
2+
3+
import os
4+
import sys
5+
6+
pkgdatadir = '@pkgdatadir@'
7+
8+
if pkgdatadir not in sys.path:
9+
sys.path.insert(0, pkgdatadir)
10+
11+
if __name__ == '__main__':
12+
from ssh_studio import main
13+
sys.exit(main.main())

data/ui/host_editor.blp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ template $HostEditor: Gtk.Box {
5353

5454
WindowHandle {
5555
Adw.HeaderBar {
56-
show-back-button: false;
5756
show-title: false;
5857
[center]
5958
Adw.ViewSwitcher viewswitcher {

data/ui/host_list.blp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ template $HostList: Box {
5858
]
5959
}
6060

61+
[end]
62+
Gtk.WindowControls window_controls {
63+
side: end;
64+
visible: false;
65+
}
66+
6167
}
6268
}
6369

data/ui/main_window.blp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ using Adw 1;
44
template $MainWindow: Adw.ApplicationWindow {
55
default-width: 1300;
66
default-height: 720;
7+
8+
Adw.Breakpoint {
9+
condition ("max-width: 1100sp")
10+
11+
setters {
12+
host_editor.viewswitcher-policy: narrow;
13+
}
14+
}
15+
16+
Adw.Breakpoint {
17+
condition ("max-width: 800sp")
18+
19+
setters {
20+
split_view.collapsed: true;
21+
host_list.show-window-controls: true;
22+
}
23+
}
24+
725
Adw.ToastOverlay toast_overlay {
826
Adw.ToolbarView main_box {
927
hexpand: true;

data/ui/ssh_key_manager_dialog.blp

Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,104 @@ using Gtk 4.0;
22
using Adw 1;
33

44
template $SSHKeyManagerDialog: Adw.Dialog {
5+
Adw.Breakpoint {
6+
condition ("max-width: 900sp")
7+
8+
setters {
9+
header_actions.hexpand: true;
10+
header_actions.halign: fill;
11+
generate_button.hexpand: true;
12+
import_button.hexpand: true;
13+
}
14+
}
15+
16+
Adw.Breakpoint {
17+
condition ("max-width: 640sp")
18+
19+
setters {
20+
header_actions.orientation: vertical;
21+
22+
header_actions.spacing: 8;
23+
footer_actions.orientation: vertical;
24+
footer_actions.halign: fill;
25+
copy_pub_button.hexpand: true;
26+
reveal_button.hexpand: true;
27+
delete_button.hexpand: true;
28+
}
29+
}
30+
31+
532
Adw.ToastOverlay toast_overlay {
633
Adw.ToolbarView {
7-
width-request: 860;
8-
height-request: 620;
34+
width-request: 360;
35+
height-request: 360;
936

1037
[top]
1138
Adw.HeaderBar {
1239
[title]
13-
Adw.ViewSwitcher { policy: wide; stack: stack; }
40+
Adw.ViewSwitcherTitle switcher_title {
41+
stack: stack;
42+
title: _("SSH Key Manager");
43+
}
1444

1545
[end]
16-
Box {
46+
Box header_actions {
1747
spacing: 6;
18-
Button generate_button { label: _("Generate…"); css-classes: ["suggested-action"]; }
19-
Button import_button { label: _("Import…"); }
48+
Button generate_button { label: _("Generate…"); css-classes: ["suggested-action"]; hexpand: false; }
49+
Button import_button { label: _("Import…"); hexpand: false; }
2050
}
2151
}
2252

23-
content: Box {
24-
orientation: vertical;
25-
margin-start: 12; margin-end: 12; margin-top: 12; margin-bottom: 12; spacing: 12;
26-
27-
Adw.ViewStack stack {
28-
vexpand: true;
29-
30-
Adw.ViewStackPage {
31-
name: "private";
32-
title: _("Private Keys");
33-
icon-name: "dialog-password-symbolic";
34-
child: Adw.Clamp {
35-
maximum-size: 900; tightening-threshold: 600;
36-
child: ScrolledWindow { vexpand: true; hexpand: true; has-frame: false;
37-
ListBox private_list { selection-mode: single; vexpand: true; hexpand: true; css-classes: ["boxed-list"]; }
53+
content: Adw.Clamp {
54+
maximum-size: 960;
55+
tightening-threshold: 720;
56+
child: Box {
57+
orientation: vertical;
58+
margin-start: 12;
59+
margin-end: 12;
60+
margin-top: 12;
61+
margin-bottom: 12;
62+
spacing: 12;
63+
64+
Adw.ViewStack stack {
65+
vexpand: true;
66+
67+
Adw.ViewStackPage {
68+
name: "private";
69+
title: _("Private Keys");
70+
icon-name: "dialog-password-symbolic";
71+
child: Adw.Clamp {
72+
maximum-size: 900; tightening-threshold: 640;
73+
child: ScrolledWindow { vexpand: true; hexpand: true; has-frame: false;
74+
ListBox private_list { selection-mode: single; vexpand: true; hexpand: true; css-classes: ["boxed-list"]; }
75+
};
3876
};
39-
};
40-
}
77+
}
4178

42-
Adw.ViewStackPage {
43-
name: "public";
44-
title: _("Public Keys");
45-
icon-name: "user-info-symbolic";
46-
child: Adw.Clamp {
47-
maximum-size: 900; tightening-threshold: 600;
48-
child: ScrolledWindow { vexpand: true; hexpand: true; has-frame: false;
49-
ListBox public_list { selection-mode: single; vexpand: true; hexpand: true; css-classes: ["boxed-list"]; }
79+
Adw.ViewStackPage {
80+
name: "public";
81+
title: _("Public Keys");
82+
icon-name: "user-info-symbolic";
83+
child: Adw.Clamp {
84+
maximum-size: 900; tightening-threshold: 640;
85+
child: ScrolledWindow { vexpand: true; hexpand: true; has-frame: false;
86+
ListBox public_list { selection-mode: single; vexpand: true; hexpand: true; css-classes: ["boxed-list"]; }
87+
};
5088
};
51-
};
89+
}
5290
}
53-
}
5491

55-
Box { orientation: horizontal; halign: end; spacing: 6;
56-
Button copy_pub_button { label: _("Copy Public Key"); }
57-
Button reveal_button { label: _("Reveal in Files"); }
58-
Button delete_button { label: _("Delete"); css-classes: ["destructive-action"]; }
59-
}
92+
Adw.ViewSwitcherBar switcher_bar {
93+
stack: stack;
94+
reveal: bind switcher_title.title-visible;
95+
}
96+
97+
Box footer_actions { orientation: horizontal; halign: end; spacing: 6;
98+
Button copy_pub_button { label: _("Copy Public Key"); }
99+
Button reveal_button { label: _("Reveal in Files"); }
100+
Button delete_button { label: _("Delete"); css-classes: ["destructive-action"]; }
101+
}
102+
};
60103
};
61104
}
62105
}

io.github.BuddySirJava.SSH-Studio.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"--socket=wayland",
1111
"--share=network",
1212
"--filesystem=~/.ssh:rw",
13-
"--socket=ssh-auth"
13+
"--socket=ssh-auth",
14+
"--talk-name=org.freedesktop.Flatpak"
1415
],
1516
"cleanup" : [
1617
"/include",

meson.build

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ project('ssh-studio', 'c',
55
default_options: [
66
'warning_level=2',
77
'buildtype=debugoptimized',
8-
'python.install_env=auto',
9-
'python.platlibdir='
108
])
119

1210
python = import('python')
@@ -18,6 +16,9 @@ gtksource_dep = dependency('gtksourceview-5', version: '>= 5.0.0')
1816

1917
application_id = 'io.github.BuddySirJava.SSH-Studio'
2018

19+
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
20+
moduledir = join_paths(pkgdatadir, 'ssh_studio')
21+
2122
i18n = import('i18n')
2223
subdir('po')
2324

@@ -32,11 +33,17 @@ if get_option('install_desktop_file')
3233
)
3334
endif
3435

35-
install_data(
36-
join_paths(meson.current_source_dir(), 'data', 'ssh-studio.in'),
37-
rename: 'ssh-studio',
38-
install_mode: 'rwxr-xr-x',
39-
install_dir: join_paths(get_option('bindir'))
36+
conf = configuration_data()
37+
conf.set('PYTHON', python_installation.path())
38+
conf.set('pkgdatadir', pkgdatadir)
39+
40+
configure_file(
41+
input: 'data/ssh-studio.in',
42+
output: 'ssh-studio',
43+
configuration: conf,
44+
install: true,
45+
install_dir: get_option('bindir'),
46+
install_mode: 'rwxr-xr-x'
4047
)
4148

4249
if get_option('install_icons')

0 commit comments

Comments
 (0)