aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2013-01-04 21:50:37 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-01-04 21:52:31 +0800
commit6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66 (patch)
tree235f2473a501978d386bc0628b9436d0c42b0d8c /src
parent5fd8c27e1de6ddccf9ef14811df865f129cbc461 (diff)
downloadgsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar.gz
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar.bz2
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar.lz
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar.xz
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.tar.zst
gsoc2013-epiphany-6f0ffa44c1bca2927e3e1a337fa1ce7349bd0e66.zip
ephy-shell: There can be two widgets for the same download in WebKit2
In WebKit2 WebKitWebContext::download-started signal is always emitted, even for downloads started manually. We only want to create a new download when the download operation has been started by WebKit. https://bugzilla.gnome.org/show_bug.cgi?id=678993
Diffstat (limited to 'src')
-rw-r--r--src/ephy-shell.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 1ae07ac6a..452ded781 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -595,10 +595,9 @@ download_started_cb (WebKitWebContext *web_context,
WebKitDownload *download,
EphyShell *shell)
{
- EphyDownload *ed;
GtkWindow *window = NULL;
WebKitWebView *web_view;
- GtkWidget *toplevel;
+ gboolean ephy_download_set;
/* Is download locked down? */
if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
@@ -607,6 +606,15 @@ download_started_cb (WebKitWebContext *web_context,
return;
}
+ /* Only create an EphyDownload for the WebKitDownload if it doesn't exist yet.
+ * This can happen when the download has been started automatically by WebKit,
+ * due to a context menu action or policy checker decision. Downloads started
+ * explicitly by Epiphany are marked with ephy-download-set GObject data.
+ */
+ ephy_download_set = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (download), "ephy-download-set"));
+ if (ephy_download_set)
+ return;
+
web_view = webkit_download_get_web_view (download);
if (web_view) {
GtkWidget *toplevel;
@@ -619,7 +627,7 @@ download_started_cb (WebKitWebContext *web_context,
if (!window)
window = gtk_application_get_active_window (GTK_APPLICATION (shell));
- ed = ephy_download_new_for_download (download, window);
+ ephy_download_new_for_download (download, window);
}
#endif