tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.2k stars 2.42k forks source link

[feat] Add support for YesNoCancel button option on Message Dialog #7855

Open tr3ysmith opened 11 months ago

tr3ysmith commented 11 months ago

Describe the problem

Would love to see YesNoCancel option added to the Message Dialog API. This would allow for File Save Alerts on exiting the program.

Describe the solution you'd like

Upgrade dependencies for RFD since they now support this in their crate: https://github.com/PolyMeilex/rfd/blob/master/examples/message-custom-buttons/src/main.rs

Add two variants to MessageDialogButtons

MessageDialogButtons::YesNoCancel,
MessageDialogButtons::YesNoCancelWithLabels(yes_text, no_text, cancel_text)

Support this through the API just like the other button options

Alternatives considered

No response

Additional context

Unfortunately it looks like RFD is using gtk-sys 0.18 which currently conflicts with Tauri, so this isn't just a simple version bump of that and then adding this code. I've looked into this, at high level, it looks like the webkit2gtk crate needs to get version bumped on its various gtk deps to v0.18. And then Tauri's dependency for webkit2gtk gets upgraded.

Starting this issue to track this, hopefully someone can lend a hand, I'll do what I can to assist!

tr3ysmith commented 11 months ago

I have created a fork of webkit2gtk and modified the deps, but I have no clue what this will break, I did this on MacOS, need to do further testing on Linux, unless someone can help with that, much thanks!

https://github.com/tr3ysmith/webkit2gtk-rs/tree/gtk-v0.18

tr3ysmith commented 11 months ago

Here's my fork with some edits thus far, haven't opened a pull request due to webkit2gtk and it basically won't work without that from what I can tell:

https://github.com/tr3ysmith/tauri/tree/yes-no-cancel-dialogbuttons

MHebes commented 3 days ago

For future readers: apparently introduced in tauri 2.0 with https://github.com/tauri-apps/tauri-plugin-dialog, more info in #7888