elementary / granite

Library that extends GTK with common widgets and utilities
https://elementary.io
GNU Lesser General Public License v3.0
280 stars 61 forks source link

Toast: add dismiss signal with dismissal reason #677

Closed danirabbit closed 4 months ago

danirabbit commented 8 months ago

Always send the closed signal when Toasts are closed manually or automatically, except when the default action is triggered. Also, add a close reason in case we want to respond differently based on whether we closed manually, expired, or withdrawn.

Not sure if we need the close reason actually. afaict nothing is connecting to this signal anywhere. The motivation for this PR is that Desktop settings was watching for the toast revealer to be closed https://github.com/elementary/switchboard-plug-pantheon-shell/pull/377/commits/c031ada33df0d64adda8ec6a90e2518dc13160e5. Happy to exclude that if it seems unnecessary

tintou commented 7 months ago

Note that adding a parameter to the "close" signal is an API break (meaning that all the code using it will break without being recompiled)

davidmhewitt commented 7 months ago

Note that adding a parameter to the "close" signal is an API break (meaning that all the code using it will break without being recompiled)

Yeah, in this case, it may be better to add a new signal (vanished maybe), and mark closed as deprecated. Because not only does it break the API contract, it's also a change in behaviour with the closed signal now being fired for other reasons when it wasn't previously.

danirabbit commented 4 months ago

Added a new signal dismissed, after https://valadoc.org/libadwaita-1/Adw.Toast.dismissed.html and deprecated the old signal