gtk: use close button in show_child_exited banner

This commit is contained in:
Jeffrey C. Ollie
2025-07-08 12:19:41 -05:00
parent 8cea111329
commit 9ee25e8a69

View File

@ -2511,12 +2511,21 @@ pub fn showChildExited(self: *Surface, info: apprt.surface.Message.ChildExited)
if (!adw_version.supportsBanner()) return false;
const warning_text = if (info.exit_code == 0)
i18n._("Process exited normally. Press any key to close the terminal.")
i18n._("Process exited normally.")
else
i18n._("Process exited abnormally. Press any key to close the terminal.");
i18n._("Process exited abnormally.");
const banner = adw.Banner.new(warning_text);
banner.setRevealed(1);
banner.setButtonLabel(i18n._("Close"));
_ = adw.Banner.signals.button_clicked.connect(
banner,
*Surface,
showChildExitedButtonClosed,
self,
.{},
);
const banner_widget = banner.as(gtk.Widget);
banner_widget.setHalign(.fill);
@ -2531,3 +2540,7 @@ pub fn showChildExited(self: *Surface, info: apprt.surface.Message.ChildExited)
return true;
}
fn showChildExitedButtonClosed(_: *adw.Banner, self: *Surface) callconv(.c) void {
self.close(false);
}