aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-10-25 23:47:17 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2013-01-04 17:58:12 +0800
commitcf825ce1926ffb3890ebfd4f0094a97b2158f314 (patch)
tree38badf54861dd8c21c4930d26e0681fa189c6cfc
parent8ed26c6a506feec75e37cf285450a23ac7c8a689 (diff)
downloadgsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar.gz
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar.bz2
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar.lz
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar.xz
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.tar.zst
gsoc2013-epiphany-cf825ce1926ffb3890ebfd4f0094a97b2158f314.zip
downloads: Create the download with the window of the web view that initiated the download
Using webkit_download_get_web_view() and falling back to the active window if the download was not initiated by a web view. https://bugzilla.gnome.org/show_bug.cgi?id=686467
-rw-r--r--src/ephy-shell.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 6afb29886..1ae07ac6a 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -596,7 +596,9 @@ download_started_cb (WebKitWebContext *web_context,
EphyShell *shell)
{
EphyDownload *ed;
- EphyWindow *window;
+ GtkWindow *window = NULL;
+ WebKitWebView *web_view;
+ GtkWidget *toplevel;
/* Is download locked down? */
if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
@@ -605,8 +607,19 @@ download_started_cb (WebKitWebContext *web_context,
return;
}
- window = gtk_application_get_active_window (GTK_APPLICATION (shell));
- ed = ephy_download_new_for_download (download, GTK_WINDOW (window));
+ web_view = webkit_download_get_web_view (download);
+ if (web_view) {
+ GtkWidget *toplevel;
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
+ if (GTK_IS_WINDOW (toplevel))
+ window = GTK_WINDOW (toplevel);
+ }
+
+ if (!window)
+ window = gtk_application_get_active_window (GTK_APPLICATION (shell));
+
+ ed = ephy_download_new_for_download (download, window);
}
#endif