-
Opening files regressed in 7c8f19af. EphyDownload always passes NULL for MIME type, so we skip all the code for launching applications. Oops. Instead of reverting this commit, let's delete all the code! We can simplify file launching in several ways: (1) ephy_embed_shell_launch_handler() is no longer needed at all. It's a a wrapper around ephy_file_launch_handler() that just checks to ensure Epiphany is not launching itself, to avoid recursive launching. This is no longer needed because we no longer open files automatically under any circumstances, so recursive launching is no longer possible (unless the user manually opens the same file again and again for fun or something). Remove this function altogether. EphyDownload can use ephy_file_launch_handler() directly instead. (2) Delete the test for ephy_embed_shell_launch_handler(), since it only tests to ensure we avoid recursive launching, which is, again, no longer a problem. (3) ephy_file_launch_handler() doesn't actually need the MIME type for anything, except for use by ephy_file_browse_to(). So get rid of it from all associated functions. Reimplement ephy_file_browse_to() without it. (The MIME type used to be important for making sure it's safe to automatically open a file, but we never do that anymore.) A mistake regarding the MIME types is what introduced the bug that triggered this investigation, so eliminating it altogether seems worth it, especially when it's only used in the corner case of ephy_file_browse_to(). (4) Make ephy_file_launch_handler() automatically launch via URI handler when running in flatpak. This way, higher-level code no longer needs to decide between using ephy_file_launch_handler() and ephy_file_launch_file_via_uri_handler() based on whether flatpak is in use. (5) ephy_file_launch_file_via_uri_handler() and ephy_file_launch_via_uri_handler() no longer need to be public, and can be compressed into one function. ephy_file_launch_application also no longer needs to be public. (6) Add assertions to ephy_file_browse_to(), ephy_file_launch_desktop_file(), and ephy_file_open_uri_in_default_browser() to ensure they are never called when running in flatpak, since it's impossible to make them work (because the only way to open files in flatpak is via the OpenURI portal, which gives the user, not the application, the choice of which application to open). It's already impossible for any of these functions to be called inside flatpak. (Hopefully! :) I tried to split this up into separate commits, but it got rather complicated, so here it is as an all-in-one. Note this consequently fixes opening downloaded files in flatpak, albeit not in the simplest-possible way.
cd0e4ef1