PSA to #GTK and #GNOME app developers: if your application deals with saving files, it is extra nice to show an in-app notification with an "Open Folder" action button so the user can directly open the containing folder in their file manager afterwards!

Convenience API function in #GTK4 here: https://docs.gtk.org/gtk4/method.FileLauncher.open_containing_folder.html

Example feature requests here:
* https://github.com/GeopJr/Tuba/issues/1585
* https://gitlab.gnome.org/GNOME/evolution/-/issues/3166
* https://dev.gajim.org/gajim/gajim/-/issues/12511
* https://gitlab.gnome.org/GNOME/epiphany/-/issues/2793
* https://github.com/ryonakano/reco/issues/238

Ran out of characters limit in the toot above, so here's another recently added example of a #GNOME app that would benefit from an in-app error/success notification with "Open Folder" action button: Simple Scan, the GNOME paper document scanner. https://gitlab.gnome.org/GNOME/simple-scan/-/issues/525

#SimpleScan #SANE #paperwork #productivity

Show an in-app notification overlay for error messages or after successfully saving/exporting a file, with "Open Containing Folder" action button (#525) · Issues · GNOME / Document Scanner · GitLab

Usecase / user story As of version 49.1 (and older), the app doesn't tell you that it successfully saved/exported an...

GitLab
Gio.AppInfo.launch_default_for_uri_async

Reference for Gio.AppInfo.launch_default_for_uri_async

@valos this "launches the default application registered to handle the specified uri", which to me means that it is either used to open the file itself (which is not what I want) or it opens a folder URI but wouldn't preselect the relevant files in the resulting file browser (unlike the "open_containing_folder" function, if I understand correctly).

@nekohayo I just tested both in the case of a folder URI.

Gtk.FileLauncher.open_containing_folder opens the parent folder. Folder is selected.

Gio.AppInfo.launch_default_for_uri_async opens the folder.

@nekohayo TIL. I've now replaced a terrible fork/exec hack with this function.
@nekohayo this seems so misguided... doesn't the file get put into "recently used" by the chooser even without per-app intervention and an annoying notification?

@migratory Completion confirmations are good practice anywhere.

Assuming the app writes to recently-used.xbel (which is not a given), you're asking me to:

1. Tell the OS to navigate to (and possibly launch) a file manager app
2. Tell the file manager to go to the "Recent" view (if it has one) or use the Search feature
3. Right-click the file, "Open Item Location" (surprise!)

…and _then_ see it in its actual surrounding context? Instead of:

1. Click the "Open Folder" button immediately; done.