summaryrefslogtreecommitdiff
path: root/lib/ephy-file-helpers.h
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2019-01-07 20:27:34 -0600
committerJan-Michael Brummer <jan.brummer@tabos.org>2019-01-08 19:42:49 +0000
commitcd0e4ef19ca652289bc61ef4ed207a196c1cfdd0 (patch)
tree5659a7be78aa8b19406c80c12c38cd4189262331 /lib/ephy-file-helpers.h
parentd79d53aa1b4e31264f34c0cdbc6f723941e43b84 (diff)
downloadepiphany-cd0e4ef19ca652289bc61ef4ed207a196c1cfdd0.tar.gz
Simplify and fix opening files
Opening files regressed in 7c8f19af448d42cb498bd729f498f49ebcd554c6. 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.
Diffstat (limited to 'lib/ephy-file-helpers.h')
-rw-r--r--lib/ephy-file-helpers.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
index eff671d89..641273dba 100644
--- a/lib/ephy-file-helpers.h
+++ b/lib/ephy-file-helpers.h
@@ -71,12 +71,7 @@ gboolean ephy_file_launch_desktop_file (const char
const char *parameter,
guint32 user_time,
GtkWidget *widget);
-gboolean ephy_file_launch_application (GAppInfo *app,
- GList *files,
- guint32 user_time,
- GtkWidget *widget);
-gboolean ephy_file_launch_handler (const char *mime_type,
- GFile *file,
+gboolean ephy_file_launch_handler (GFile *file,
guint32 user_time);
gboolean ephy_file_open_uri_in_default_browser (const char *uri,
guint32 timestamp,
@@ -91,11 +86,7 @@ gboolean ephy_file_move_uri (const char
char * ephy_file_create_data_uri_for_filename (const char *filename,
const char *mime_type);
char * ephy_sanitize_filename (char *filename);
-GAppInfo * ephy_file_launcher_get_app_info_for_file (GFile *file,
- const char *mime_type);
void ephy_open_default_instance_window (void);
void ephy_open_incognito_window (const char *uri);
-gboolean ephy_file_launch_via_uri_handler (const char *uri);
-gboolean ephy_file_launch_file_via_uri_handler (GFile *file);
G_END_DECLS