gpui: Add support for custom prompt text in PathPromptOptions (#36410)

This will be used to improve the clarity of the git clone UI

### MacOS
<img width="1322" height="128" alt="image"
src="https://github.com/user-attachments/assets/3e511143-12c1-4440-89dd-841b21b2e98e"
/>

### Windows 
<img width="338" height="80" alt="image"
src="https://github.com/user-attachments/assets/766d08d6-0c72-4175-ad24-59dc6188d5f1"
/>

### Linux

<img width="387" height="72" alt="Screenshot From 2025-08-18 15-32-06"
src="https://github.com/user-attachments/assets/3125a7c4-3975-462a-a547-d5d4fac48f22"
/>



Release Notes:

- N/A
This commit is contained in:
Anthony Eid
2025-08-18 19:48:02 +00:00
committed by GitHub
parent fa61c3e24d
commit 3a3df5c011
9 changed files with 28 additions and 1 deletions
@@ -294,6 +294,7 @@ impl<P: LinuxClient + 'static> Platform for P {
let request = match ashpd::desktop::file_chooser::OpenFileRequest::default()
.modal(true)
.title(title)
.accept_label(options.prompt.as_ref().map(crate::SharedString::as_str))
.multiple(options.multiple)
.directory(options.directories)
.send()
+6
View File
@@ -705,6 +705,7 @@ impl Platform for MacPlatform {
panel.setCanChooseDirectories_(options.directories.to_objc());
panel.setCanChooseFiles_(options.files.to_objc());
panel.setAllowsMultipleSelection_(options.multiple.to_objc());
panel.setCanCreateDirectories(true.to_objc());
panel.setResolvesAliases_(false.to_objc());
let done_tx = Cell::new(Some(done_tx));
@@ -730,6 +731,11 @@ impl Platform for MacPlatform {
}
});
let block = block.copy();
if let Some(prompt) = options.prompt {
let _: () = msg_send![panel, setPrompt: ns_string(&prompt)];
}
let _: () = msg_send![panel, beginWithCompletionHandler: block];
}
})
@@ -787,6 +787,12 @@ fn file_open_dialog(
unsafe {
folder_dialog.SetOptions(dialog_options)?;
if let Some(prompt) = options.prompt {
let prompt: &str = &prompt;
folder_dialog.SetOkButtonLabel(&HSTRING::from(prompt))?;
}
if folder_dialog.Show(window).is_err() {
// User cancelled
return Ok(None);