aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-download-widget.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2011-10-11 08:46:17 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2011-12-21 02:22:20 +0800
commit89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2 (patch)
tree33edc5ea2ef7b60b2119f064ec913bc0d9bd9344 /lib/widgets/ephy-download-widget.c
parent05f455ac484e75dd8596425276ccf190acfc1578 (diff)
downloadgsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar.gz
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar.bz2
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar.lz
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar.xz
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.tar.zst
gsoc2013-epiphany-89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2.zip
e-download: add ephy_download_get_content_type
This new API gets the content-type of a download using GIO, or Soup if GIO is still not available for the download. GIO is our first option since its local guesses are more reliable. Soup can be cheated by servers or confused by still too incomplete downloads. Bug #662059
Diffstat (limited to 'lib/widgets/ephy-download-widget.c')
-rw-r--r--lib/widgets/ephy-download-widget.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index 084116804..a8d3403d0 100644
--- a/lib/widgets/ephy-download-widget.c
+++ b/lib/widgets/ephy-download-widget.c
@@ -54,21 +54,17 @@ enum
};
static GdkPixbuf *
-get_icon_from_download (WebKitDownload *download)
+get_icon_from_download (EphyDownload *ephy_download)
{
- WebKitNetworkResponse *response;
- SoupMessage *message;
- const char *content_type;
-
+ char *content_type = NULL;
GIcon *gicon;
GtkIconInfo *icon_info;
- response = webkit_download_get_network_response (download);
- message = webkit_network_response_get_message (response);
- content_type = soup_message_headers_get_content_type (message->response_headers, NULL);
+ content_type = ephy_download_get_content_type (ephy_download);
if (content_type != NULL) {
gicon = g_content_type_get_icon (content_type);
+ g_free (content_type);
} else {
gicon = g_icon_new_for_string ("package-x-generic", NULL);
}
@@ -450,7 +446,7 @@ ephy_download_widget_new (EphyDownload *ephy_download)
"download", ephy_download, NULL);
download = ephy_download_get_webkit_download (ephy_download);
- pixbuf = get_icon_from_download (download);
+ pixbuf = get_icon_from_download (ephy_download);
basename = g_filename_display_basename (webkit_download_get_destination_uri (download));
dest = g_uri_unescape_string (basename, NULL);