aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-05-29 20:30:49 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-14 19:41:42 +0800
commit2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc (patch)
tree774eb65bf0e127118de737852843967d5e3d01f7 /embed/ephy-web-view.c
parent8e096384a3e15ba1b68235045c6148a8af29cedb (diff)
downloadgsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar.gz
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar.bz2
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar.lz
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar.xz
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.tar.zst
gsoc2013-epiphany-2b5cfe828cef29dd20225540fdd2bf5fcbf6b8fc.zip
e-file-helpers: Add ephy_file_create_data_uri_for_filename()
It creates a data URI for the given filename. Use the new function when building error and applications pages. https://bugzilla.gnome.org/show_bug.cgi?id=677025
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index f0b3d8f94..e4ae30f09 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2052,37 +2052,6 @@ load_status_cb (WebKitWebView *web_view,
g_object_thaw_notify (object);
}
-static char *
-get_file_content_as_base64 (const char *path)
-{
- GFile *file;
- GFileInfo *file_info;
- const char *image_type;
- char *image_raw;
- gsize len;
- char *image_data;
- char *image64;
-
- file = g_file_new_for_path (path);
- file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- G_FILE_QUERY_INFO_NONE,
- NULL, NULL);
- image_type = g_file_info_get_content_type (file_info);
-
- g_file_get_contents (path, &image_raw, &len, NULL);
- image_data = g_base64_encode ((guchar *) image_raw, len);
- image64 = g_strdup_printf ("data:%s;base64,%s", image_type, image_data);
-
- g_free (image_raw);
- g_free (image_data);
-
- g_object_unref (file);
- g_object_unref (file_info);
-
- return image64;
-}
-
/**
* ephy_web_view_load_error_page:
* @view: an #EphyWebView
@@ -2175,7 +2144,7 @@ ephy_web_view_load_error_page (EphyWebView *view,
48,
GTK_ICON_LOOKUP_GENERIC_FALLBACK);
- image_data = icon_info ? get_file_content_as_base64 (gtk_icon_info_get_filename (icon_info)) : NULL;
+ image_data = icon_info ? ephy_file_create_data_uri_for_filename (gtk_icon_info_get_filename (icon_info), NULL) : NULL;
g_file_get_contents (html_file, &template, NULL, NULL);