[evolution/wip-webkit2] Move file URI handling to EWebView
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip-webkit2] Move file URI handling to EWebView
- Date: Mon, 18 Nov 2013 09:08:39 +0000 (UTC)
commit fde88c57b9908a36c59e99a1203d83172974c915
Author: Tomas Popela <tpopela redhat com>
Date: Fri Nov 15 13:12:01 2013 +0100
Move file URI handling to EWebView
e-util/e-web-view.c | 29 +++++++++++++++++++++++++++++
mail/e-mail-display.c | 48 ++++++------------------------------------------
2 files changed, 35 insertions(+), 42 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 0095b43..7d23f7b 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1707,6 +1707,35 @@ static void
web_view_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
EWebView *web_view)
{
+ GInputStream *stream;
+ const gchar *uri;
+ gchar *content = NULL;
+ gchar *content_type;
+ gchar *filename;
+ gsize length = 0;
+
+ g_warning ("%s", __FUNCTION__);
+ uri = webkit_uri_scheme_request_get_uri (request);
+
+ filename = g_filename_from_uri (strstr (uri, "file"), NULL, NULL);
+ if (!filename)
+ return;
+
+ if (!g_file_get_contents (filename, &content, &length, NULL)) {
+ g_free (filename);
+ return;
+ }
+
+ content_type = g_content_type_guess (filename, NULL, 0, NULL);
+
+ stream = g_memory_input_stream_new_from_data (content, length, g_free);
+
+ webkit_uri_scheme_request_finish (request, stream, length, content_type);
+
+ g_free (content_type);
+ g_free (content);
+ g_free (filename);
+/* g_object_unref (stream); */
}
static void
web_view_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 26d67a6..7770c21 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1409,40 +1409,6 @@ mail_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
}
static void
-mail_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EMailDisplay *display)
-{
- GInputStream *stream;
- const gchar *uri;
- gchar *content = NULL;
- gchar *content_type;
- gchar *filename;
- gsize length = 0;
-
- uri = webkit_uri_scheme_request_get_uri (request);
-
- filename = g_filename_from_uri (strstr (uri, "file"), NULL, NULL);
- if (!filename)
- return;
-
- if (!g_file_get_contents (filename, &content, &length, NULL)) {
- g_free (filename);
- return;
- }
-
- content_type = g_content_type_guess (filename, NULL, 0, NULL);
-
- stream = g_memory_input_stream_new_from_data (content, length, g_free);
-
- webkit_uri_scheme_request_finish (request, stream, length, content_type);
-
- g_free (content_type);
- g_free (content);
- g_free (filename);
-/* g_object_unref (stream); */
-}
-
-static void
mail_http_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
EMailDisplay *display)
{
@@ -1692,18 +1658,16 @@ e_mail_display_init (EMailDisplay *display)
ui_manager = e_web_view_get_ui_manager (E_WEB_VIEW (display));
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
- e_web_view_register_uri_scheme (
- E_WEB_VIEW (display), CID_URI_SCHEME,
- mail_cid_uri_scheme_appeared_cb, display);
- e_web_view_register_uri_scheme (
- E_WEB_VIEW (display), FILE_URI_SCHEME,
- mail_file_uri_scheme_appeared_cb, display);
- e_web_view_register_uri_scheme (
+/* e_web_view_register_uri_scheme (
E_WEB_VIEW (display), EVO_HTTP_URI_SCHEME,
mail_http_uri_scheme_appeared_cb, display);
e_web_view_register_uri_scheme (
E_WEB_VIEW (display), EVO_HTTPS_URI_SCHEME,
- mail_http_uri_scheme_appeared_cb, display);
+ mail_http_uri_scheme_appeared_cb, display);*/
+
+ e_web_view_register_uri_scheme (
+ E_WEB_VIEW (display), CID_URI_SCHEME,
+ mail_cid_uri_scheme_appeared_cb, display);
e_web_view_register_uri_scheme (
E_WEB_VIEW (display), MAIL_URI_SCHEME,
mail_mail_uri_scheme_appeared_cb, display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]