New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor file_picker_linux to use the XDG FileChooser portal #1275
base: master
Are you sure you want to change the base?
Refactor file_picker_linux to use the XDG FileChooser portal #1275
Conversation
@philenius could you review this? |
I am moving this as ready for review. A few notes: Only the method for saving files on the FileChooser portal support setting an initial directory right now, they plan on enabling it for the opening files method in the future, see flatpak/xdg-desktop-portal#796. It seems the FileChooser API supports choosing whether dialogs modal, however since on my testing I couldn't see it working, I didn't implement support for that. I added a small converter from the Also, tests are broken. Since I rewrote completely how the linux side works, I would have to re-do them from scratch, that is assuming I can figure out how. |
Thank you very much for your contribution, @MateusRodCosta. I'll look into your PR within the next few days. |
@MateusRodCosta thanks for your implementation.
The conversion works fine 👍
No problem, we can fix the test later. Let's rather focus on two issues here:
This would be a downgrade because our current solution does support setting the initial directory.
I would consider this a blocker as long as we cannot figure our how to make it behave like a modal. Our current implementation provides already a limited usability since the file picker dialog sometimes opens in the background. However, I tested the FileChooser Portal implementation on Ubuntu 23 and the file picker dialog is always spawned behind the actual Flutter app. 2023-05-09-22-18-26_uyjUnumj_cropped.mp4In contrast, our current implementation: 2023-05-09.22-34-07_trimmed_cropped.mp4I'm sorry, I definitely see advantages in your implementation but I don't want to merge this PR until we can solve the modal issue. |
I posted a question in canonical/xdg_desktop_portal.dart#87. Maybe we'll figure it out this way. |
Yeah, makes sense, can't do much besides waiting for the upstream to actually do it =/. From reading the related issue, it seems to be related to how the following three values are filled : current_directory, current_name and current_file. I am using right now a combination of both current_name and current_directory. Maybe the bug could be fixed if when using both at the same time we used current_file instead? I will experiment with that.
Ok, so this I think I know why. First, the default for modals seem to be true:
But it also can take the info of the parent window:
On my system (Fedora + GNOME Wayland) it pops up in front, it might behave a bit diferently in X11. |
Co-authored-by: philenius <philenius@users.noreply.github.com>
I retried implementing the initialDirectory support to saveFile, this time by also including the "current_file" value. It still didn't work =/. I starting to think the issue might either be upstream on the xdg portal Flutter plugin or on the GNOME/GTK portal. |
This PR moves from using zenit, qarma and kdialog to use the FileChooser portal instead.
This issue is related to #1270.
Also, currently setting as a draft due to not implementing unit tests yet and due to having to check how to deal with the uris.