Hi, everyone! I’ve been trying to contribute with GNOME Boxes by adding the screenshots that are taken via its UI to the “Recents” section of the file explorer. I looked it up and found RecentManager in the Vala documentation, as well as a few examples of it being used in other projects. Following these examples, I wrote the code below:
Context: the issue I’m trying to solve is #895, and you can checkout my fork of Boxes with the changes I mentioned here .
get_screenshot_filename returns a new name for a screenshot file every time you call it.
So the filenname you pass to add_item is not the file just saved, but something else and it doesn’t exist. add_item tries to add some fileinfo to its argument before actually registering it, but fails. This is done asynchronously, hence add_itemalways returns true.
The solution is to pass the same filename passed to pixbuf.save also to add_item.
get_screenshot_filename returns a new name for a screenshot file every time you call it.
Oh,
Good call, thank you! I updated my fork with your suggestion (storing and using the same output of get_screenshot_filename for the same screenshot), but it is still not working. I wonder if this has something to do with flatpak and GNOME Builder sandboxing.