diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed.c | 20 | ||||
-rw-r--r-- | embed/ephy-embed.h | 1 | ||||
-rw-r--r-- | embed/ephy-web-view.c | 4 |
3 files changed, 23 insertions, 2 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 95b630c63..3b1e7c03a 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -563,7 +563,7 @@ define_destination_uri (WebKitDownload *download, return TRUE; } -static void +static gboolean perform_auto_download (WebKitDownload *download) { DownloaderView *dview; @@ -571,13 +571,29 @@ perform_auto_download (WebKitDownload *download) if (!define_destination_uri (download, FALSE)) { webkit_download_cancel (download); ephy_file_delete_uri (webkit_download_get_destination_uri (download)); - return; + return FALSE; } dview = EPHY_DOWNLOADER_VIEW (ephy_embed_shell_get_downloader_view (embed_shell)); g_object_set_data (G_OBJECT(download), "download-action", GINT_TO_POINTER(DOWNLOAD_ACTION_OPEN)); downloader_view_add_download (dview, download); + + return TRUE; +} + +void +ephy_embed_auto_download_url (EphyEmbed *embed, const char *url) +{ + WebKitNetworkRequest *request; + WebKitDownload *download; + + request = webkit_network_request_new (url); + download = webkit_download_new (request); + g_object_unref (request); + + if (perform_auto_download (download)) + webkit_download_start (download); } static void diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h index 939cfa7f8..e6b4e77f0 100644 --- a/embed/ephy-embed.h +++ b/embed/ephy-embed.h @@ -55,6 +55,7 @@ GType ephy_embed_get_type (void); EphyWebView* ephy_embed_get_web_view (EphyEmbed *embed); void ephy_embed_add_top_widget (EphyEmbed *embed, GtkWidget *widget, gboolean destroy_on_transition); void ephy_embed_remove_top_widget (EphyEmbed *embed, GtkWidget *widget); +void ephy_embed_auto_download_url (EphyEmbed *embed, const char *url); G_END_DECLS diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 4871fc965..2935ed2ad 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -520,6 +520,10 @@ ephy_web_view_button_press_event (GtkWidget *widget, GdkEventButton *event) if (event->button == 3 && event->state & GDK_CONTROL_MASK) return FALSE; + /* We use this for downloading */ + if (event->button == 1 && event->state & GDK_SHIFT_MASK) + return FALSE; + return GTK_WIDGET_CLASS (ephy_web_view_parent_class)->button_press_event (widget, event); } |