tauri icon indicating copy to clipboard operation
tauri copied to clipboard

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

Open tr3ysmith opened this issue 2 years ago • 3 comments

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 avatar Sep 19 '23 01:09 tr3ysmith

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 avatar Sep 19 '23 01:09 tr3ysmith

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

tr3ysmith avatar Sep 19 '23 01:09 tr3ysmith

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

MHebes avatar Aug 22 '24 20:08 MHebes

Hello! I do not believe this has been introduced in tauri-plugin-dialog. I can't find anything in the doc or the source code. Worth re-opening IMO since this use case is quite common.

reind33r avatar Mar 31 '25 19:03 reind33r

Hello, I also searched everywhere for a solution to this, but it does not seem to be implemented yet. Please re-open this issue.

HumanWannabe avatar Apr 16 '25 14:04 HumanWannabe