Skip to content

Commit 62449b0

Browse files
committed
xdg-portal: Distinguish empty multi-item responses from cancellations
1 parent d8c3e0b commit 62449b0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/backend/xdg_desktop_portal.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ impl FilePickerDialogImpl for FileDialog {
129129
.map(portal::uris_to_paths);
130130

131131
if let Some(res) = res {
132-
Some(res)
132+
if res.is_empty() {
133+
None
134+
} else {
135+
Some(res)
136+
}
133137
} else {
134138
warn!("Using zenity fallback");
135139
match block_on(zenity::pick_files(&self)) {
@@ -213,7 +217,11 @@ impl FolderPickerDialogImpl for FileDialog {
213217
.map(portal::uris_to_paths);
214218

215219
if let Some(res) = res {
216-
Some(res)
220+
if res.is_empty() {
221+
None
222+
} else {
223+
Some(res)
224+
}
217225
} else {
218226
warn!("Using zenity fallback");
219227
match block_on(zenity::pick_folders(&self)) {

0 commit comments

Comments
 (0)