aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-06-22 17:03:36 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-27 20:16:00 +0800
commit7e1964acdacd4bdf4e23e85ec733fe9e92688ca6 (patch)
tree6acf7bf26c7b8ddf0e4a5161122fccc3c2cd46c2 /src/ephy-shell.c
parent39931fc51a3a668d04f938fa555bdf9a4abf3056 (diff)
downloadgsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.gz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.bz2
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.lz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.xz
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.tar.zst
gsoc2013-epiphany-7e1964acdacd4bdf4e23e85ec733fe9e92688ca6.zip
Port downloads to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678612
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 07a646eb3..56c524dd3 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -544,6 +544,31 @@ impl_get_embed_single (EphyEmbedShell *embed_shell)
return embed_single;
}
+#ifdef HAVE_WEBKIT2
+static void
+download_started_cb (WebKitWebContext *web_context,
+ WebKitDownload *download,
+ EphyShell *shell)
+{
+ EphyDownload *ed;
+ EphySession *session;
+ EphyWindow *window;
+
+ /* Is download locked down? */
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK)) {
+ webkit_download_cancel (download);
+ return;
+ }
+
+ session = EPHY_SESSION (ephy_shell_get_session (shell));
+ window = ephy_session_get_active_window (session);
+
+ ed = ephy_download_new_for_download (download);
+ ephy_download_set_window (ed, GTK_WIDGET (window));
+}
+#endif
+
static void
ephy_shell_init (EphyShell *shell)
{
@@ -556,6 +581,12 @@ ephy_shell_init (EphyShell *shell)
ephy_shell = shell;
g_object_add_weak_pointer (G_OBJECT (ephy_shell),
(gpointer *)ptr);
+
+#ifdef HAVE_WEBKIT2
+ g_signal_connect (webkit_web_context_get_default (), "download-started",
+ G_CALLBACK (download_started_cb),
+ shell);
+#endif
}
static void