Date: Monday, November 2, 2009 @ 06:19:16 Author: jgc Revision: 57803
Backport from 2.29: use new webkit api to detect mime types, fixes download window Added: epiphany/trunk/ephy-download-mime.patch Modified: epiphany/trunk/PKGBUILD --------------------------+ PKGBUILD | 11 +++++-- ephy-download-mime.patch | 62 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 4 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2009-11-02 11:18:37 UTC (rev 57802) +++ PKGBUILD 2009-11-02 11:19:16 UTC (rev 57803) @@ -3,27 +3,30 @@ pkgname=epiphany pkgver=2.28.1 -pkgrel=1 +pkgrel=2 install=epiphany.install pkgdesc="A GNOME2 web browser based on the WebKit rendering engine." arch=(i686 x86_64) license=('GPL') -depends=('libwebkit>=1.1.15.1' 'startup-notification>=0.10' 'iso-codes>=3.10.1' 'desktop-file-utils' 'libxslt>=1.1.24' 'libnotify>=0.4.5' 'avahi>=0.6.25' 'libsoup-gnome>=2.28.0') +depends=('libwebkit>=1.1.15.3-2' 'startup-notification>=0.10' 'iso-codes>=3.10.1' 'desktop-file-utils' 'libxslt>=1.1.24' 'libnotify>=0.4.5' 'avahi>=0.6.25' 'libsoup-gnome>=2.28.0') makedepends=('gnome-doc-utils>=0.18.0' 'pkgconfig' 'networkmanager' 'intltool') options=('!libtool' '!emptydirs') groups=('gnome') url="http://www.gnome.org/projects/epiphany/" source=(http://ftp.gnome.org/pub/GNOME/sources/${pkgname}/2.28/${pkgname}-${pkgver}.tar.bz2 execute-javascript.patch - mailto-fix.patch) + mailto-fix.patch + ephy-download-mime.patch) sha256sums=('95ccdd36bc7fdf95c6085da3b76cee6467f3c9a8745541cfb09fdd8d33a1f04d' 'b9e47e1fb6a38d76f529bc7ae8f754adea05eee4f8c024d302a0e84dd6147ef3' - '0ba4e4b6708fd2394ff2868a6f793627906f45230d0ef80d268c10b69502fe73') + '0ba4e4b6708fd2394ff2868a6f793627906f45230d0ef80d268c10b69502fe73' + '3e8a13d14afd5fb16486fffbafdd8bc47b117d948e13870712bd067586133728') build() { cd "${srcdir}/${pkgname}-${pkgver}" patch -Np1 -i "${srcdir}/execute-javascript.patch" || return 1 patch -Np1 -i "${srcdir}/mailto-fix.patch" || return 1 + patch -Np1 -i "${srcdir}/ephy-download-mime.patch" || return 1 ./configure --prefix=/usr --sysconfdir=/etc \ --localstatedir=/var \ --disable-scrollkeeper \ Added: ephy-download-mime.patch =================================================================== --- ephy-download-mime.patch (rev 0) +++ ephy-download-mime.patch 2009-11-02 11:19:16 UTC (rev 57803) @@ -0,0 +1,62 @@ +diff -ruN epiphany-2.28.1/embed/ephy-embed.c epiphany-2.28.1.new/embed/ephy-embed.c +--- epiphany-2.28.1/embed/ephy-embed.c 2009-10-17 23:11:58.000000000 +0200 ++++ epiphany-2.28.1.new/embed/ephy-embed.c 2009-11-02 12:08:12.000000000 +0100 +@@ -645,27 +645,38 @@ + GAppInfo *helper_app; + const char *suggested_filename; + int default_response; ++ WebKitNetworkResponse *response; ++ SoupMessage *message; + + parent_window = gtk_widget_get_toplevel (GTK_WIDGET(web_view)); + if (!GTK_WIDGET_TOPLEVEL (parent_window)) + parent_window = NULL; + +- /* FIXME: we still have no way of getting the content type from +- * webkit yet; we need to have a proper WebKitNetworkRequest +- * implementation to do this here; see +- * https://bugs.webkit.org/show_bug.cgi?id=18608 +- */ + helper_app = NULL; + mime_description = NULL; + mime_permission = EPHY_MIME_PERMISSION_SAFE; ++ ++ response = webkit_download_get_network_response (download); ++ message = webkit_network_response_get_message (response); ++ ++ if (message) { ++ const char *content_type = soup_message_headers_get_content_type (message->response_headers, NULL); ++ ++ if (content_type) { ++ mime_description = g_content_type_get_description (content_type); ++ helper_app = g_app_info_get_default_for_type (content_type, FALSE); ++ ++ if (helper_app) { ++ action = DOWNLOAD_ACTION_OPEN; ++ } ++ } ++ } ++ + if (mime_description == NULL) { + mime_description = g_strdup (C_("file type", "Unknown")); + action = DOWNLOAD_ACTION_OPEN_LOCATION; + } + +- /* OPEN will never happen here, for now; see comment about +- * WebKitNetworkRequest above! +- */ + action_label = (action == DOWNLOAD_ACTION_OPEN) ? GTK_STOCK_OPEN : STOCK_DOWNLOAD; + suggested_filename = webkit_download_get_suggested_filename (download); + +@@ -757,11 +768,6 @@ + return; + } + +- /* FIXME: when we are able to obtain the MIME information from +- * WebKit, we will want to decide earlier whether we want to open or +- * open the location to where the file was downloaded. See +- * perform_auto_download, too. +- */ + g_object_ref (download); /* balanced in confirm_action_response_cb */ + confirm_action_from_mime (web_view, download, DOWNLOAD_ACTION_DOWNLOAD); + }