diff options
author | Jan-Michael Brummer <jan.brummer@tabos.org> | 2018-12-17 11:16:36 +0100 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@posteo.net> | 2019-01-07 20:40:54 +0000 |
commit | 91508a2be9d830343300763889a27f4feb8612b7 (patch) | |
tree | f76208308330ce6b54270582f0f6860b59af8318 /embed/ephy-download.c | |
parent | 672cffa5ec652a5d5f7d98d0e0664408d58dcf8c (diff) | |
download | epiphany-91508a2be9d830343300763889a27f4feb8612b7.tar.gz |
Add internal pdf viewer using evince
Based on an initial patch by: Carlos Garcia Campos
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/264
Diffstat (limited to 'embed/ephy-download.c')
-rw-r--r-- | embed/ephy-download.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/embed/ephy-download.c b/embed/ephy-download.c index e10dabf05..d3118822f 100644 --- a/embed/ephy-download.c +++ b/embed/ephy-download.c @@ -25,6 +25,7 @@ #include "ephy-embed.h" #include "ephy-embed-shell.h" #include "ephy-embed-type-builtins.h" +#include "ephy-evince-document-view.h" #include "ephy-file-helpers.h" #include "ephy-prefs.h" #include "ephy-settings.h" @@ -42,6 +43,7 @@ struct _EphyDownload { char *content_type; gboolean show_notification; + gboolean in_document_mode; EphyDownloadActionType action; guint32 start_time; @@ -630,6 +632,16 @@ download_decide_destination_cb (WebKitDownload *wk_download, const gchar *suggested_filename, EphyDownload *download) { + if (download->in_document_mode) { + g_autofree gchar *tmp_file = g_strdup_printf ("%s/%s", g_get_user_cache_dir (), suggested_filename); + g_autofree gchar *file_uri = g_filename_to_uri (tmp_file, NULL, NULL); + + webkit_download_set_allow_overwrite (wk_download, TRUE); + webkit_download_set_destination (wk_download, file_uri); + + return TRUE; + } + if (webkit_download_get_destination (wk_download)) return TRUE; @@ -812,3 +824,9 @@ ephy_download_disable_desktop_notification (EphyDownload *download) download->show_notification = FALSE; } + +void +ephy_download_enable_evince_document_mode (EphyDownload *download) +{ + download->in_document_mode = TRUE; +} |