Skip to content

Commit 1493a31

Browse files
committed
Refactor macOS DMG workflow: export BREW_PREFIX, update Info.plist and bundle paths, and replace deprecated resource tags with data tags.
1 parent 885eda8 commit 1493a31

File tree

8 files changed

+140
-157
lines changed

8 files changed

+140
-157
lines changed

.github/workflows/macos-dmg.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ jobs:
7070
run: |
7171
mkdir -p macos
7272
BREW_PREFIX="$(brew --prefix)"
73+
export BREW_PREFIX
7374
echo "Detected Homebrew prefix: $BREW_PREFIX"
7475
7576
# Write Info.plist required by gtk-mac-bundler
76-
cat > macos/Info.plist << PLIST
77+
cat > macos/Info.plist << 'PLIST'
7778
<?xml version="1.0" encoding="UTF-8"?>
7879
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
7980
<plist version="1.0">
@@ -95,11 +96,11 @@ jobs:
9596
PLIST
9697
9798
# Bundle description for gtk-mac-bundler
98-
cat > macos/ssh-studio.bundle << XML
99+
cat > macos/ssh-studio.bundle << 'XML'
99100
<?xml version="1.0"?>
100101
<app-bundle>
101102
<meta>
102-
<prefix>${BREW_PREFIX}</prefix>
103+
<prefix>${env:BREW_PREFIX}</prefix>
103104
<destination overwrite="yes">${project}/../build/ssh-studio.bundle</destination>
104105
</meta>
105106
@@ -108,16 +109,14 @@ jobs:
108109
<version>1.0.0</version>
109110
<icon>${project}/../data/media/icon_512.png</icon>
110111
111-
<plist>${project}/Info.plist</plist>
112+
<plist>${env:GITHUB_WORKSPACE}/macos/Info.plist</plist>
112113
113114
<main-binary dest="${bundle}/Contents/MacOS/${name}">
114115
<binary>${project}/../stage/bin/ssh-studio</binary>
115116
</main-binary>
116117
117-
<resources>
118-
<file dest="${bundle}/Contents/Resources/share/io.github.BuddySirJava.SSH-Studio/ssh-studio-resources.gresource">${project}/../stage/share/io.github.BuddySirJava.SSH-Studio/ssh-studio-resources.gresource</file>
119-
<dir dest="${bundle}/Contents/Resources/src">${project}/../src</dir>
120-
</resources>
118+
<data dest="${bundle}/Contents/Resources/share/io.github.BuddySirJava.SSH-Studio/ssh-studio-resources.gresource">${project}/../stage/share/io.github.BuddySirJava.SSH-Studio/ssh-studio-resources.gresource</data>
119+
<data dest="${bundle}/Contents/Resources/src">${project}/../src</data>
121120
</app-bundle>
122121
XML
123122

data/ui/host_editor.blp

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ template $HostEditor: Gtk.Box {
5151
vexpand: true;
5252
hexpand: true;
5353

54-
Adw.HeaderBar {
5554

55+
Adw.HeaderBar {
56+
show-back-button: false;
5657
show-title: false;
5758
[center]
5859
Adw.ViewSwitcher viewswitcher {
@@ -68,12 +69,43 @@ template $HostEditor: Gtk.Box {
6869
]
6970
}
7071

71-
[end]
7272
Gtk.WindowControls window_controls {
7373
margin-start: 20;
7474
}
7575
}
76-
76+
Overlay banner_overlay {
77+
child: Adw.Banner unsaved_banner {
78+
revealed: false;
79+
title: _("You have unsaved changes.");
80+
};
81+
82+
[overlay]
83+
Box {
84+
halign: end;
85+
valign: start;
86+
spacing: 8;
87+
margin-top: 6;
88+
margin-end: 12;
89+
90+
Button save_button {
91+
label: _("Save");
92+
visible: false;
93+
styles [
94+
"suggested-action",
95+
]
96+
}
97+
98+
Button revert_button {
99+
label: _("Revert");
100+
visible: false;
101+
styles [
102+
"flat",
103+
"destructive-action",
104+
]
105+
}
106+
}
107+
}
108+
77109
Adw.ViewStack viewstack {
78110
vexpand: true;
79111
margin-start: 4;
@@ -418,13 +450,7 @@ template $HostEditor: Gtk.Box {
418450
}
419451
}
420452

421-
Revealer banner_revealer { visible: false; }
422-
423-
Box {
424-
visible: false;
425-
Button save_button {}
426-
Button revert_button {}
427-
}
453+
428454
}
429455
}
430456

data/ui/host_list.blp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ template $HostList: Box {
1717
Box {
1818
orientation: horizontal;
1919
spacing: 12;
20-
margin-top: 8;
2120
margin-bottom: 8;
2221

2322
Button search_button {

data/ui/main_window.blp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ template $MainWindow: Adw.ApplicationWindow {
1818

1919
child: Box {
2020
orientation: vertical;
21-
margin-start: 15;
22-
margin-end: 15;
21+
margin-start: 8;
22+
margin-end: 8;
2323

2424
$HostList host_list {}
2525
}
@@ -47,28 +47,7 @@ template $MainWindow: Adw.ApplicationWindow {
4747
};
4848
}
4949

50-
[bottom]
51-
ActionBar global_actionbar {
52-
visible: false;
53-
[start]
54-
Label unsaved_label { label: _("You have unsaved changes."); visible: false; }
55-
[end]
56-
Button save_button {
57-
label: _("Save");
58-
styles [
59-
"suggested-action",
60-
]
61-
visible: false;
62-
}
63-
[end]
64-
Button revert_button {
65-
label: _("Revert");
66-
styles [
67-
"destructive-action",
68-
]
69-
visible: false;
70-
}
71-
}
50+
7251
}
7352
}
7453
}

src/main.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
def _ensure_utf8_locale():
1919
import locale
20+
2021
try:
2122
current = locale.setlocale(locale.LC_ALL, "")
2223
if current is None or ("UTF-8" not in current and "utf8" not in current):
@@ -48,7 +49,10 @@ def _configure_renderer_for_x11():
4849

4950
if not has_dri and not os.getenv("LIBGL_ALWAYS_SOFTWARE"):
5051
os.environ["GSK_RENDERER"] = "cairo"
51-
logging.info("GSK_RENDERER=cairo set for X11 without DRM; forcing software rendering")
52+
logging.info(
53+
"GSK_RENDERER=cairo set for X11 without DRM; forcing software rendering"
54+
)
55+
5256

5357
try:
5458
from ssh_studio.ssh_config_parser import SSHConfigParser
@@ -176,21 +180,34 @@ def worker():
176180
try:
177181
if self.parser is not None:
178182
self.parser.parse()
183+
179184
def update_ui():
180185
try:
181-
if self.main_window and getattr(self.main_window, "host_list", None):
182-
self.main_window.host_list.load_hosts(self.parser.config.hosts)
186+
if self.main_window and getattr(
187+
self.main_window, "host_list", None
188+
):
189+
self.main_window.host_list.load_hosts(
190+
self.parser.config.hosts
191+
)
183192
try:
184-
self.main_window._update_status(_("Configuration loaded successfully"))
193+
self.main_window._update_status(
194+
_("Configuration loaded successfully")
195+
)
185196
except Exception:
186197
pass
187198
except Exception:
188199
pass
189200
return False
201+
190202
GLib.idle_add(update_ui)
191203
except Exception as e:
192204
logging.error(f"Failed to initialize SSH config parser: {e}")
193-
GLib.idle_add(lambda: (self._show_error_dialog(_("Failed to load SSH config"), str(e)), False)[1])
205+
GLib.idle_add(
206+
lambda: (
207+
self._show_error_dialog(_("Failed to load SSH config"), str(e)),
208+
False,
209+
)[1]
210+
)
194211

195212
t = threading.Thread(target=worker, daemon=True)
196213
t.start()

0 commit comments

Comments
 (0)