[evolution/wip/webkit2] Adapt the code the lastest changes in wip-webkit2 branch
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Adapt the code the lastest changes in wip-webkit2 branch
- Date: Tue, 16 Sep 2014 14:10:18 +0000 (UTC)
commit cd0f81969024970f1ae070026ac4fb41b71ff396
Author: Tomas Popela <tpopela redhat com>
Date: Tue Sep 16 16:09:47 2014 +0200
Adapt the code the lastest changes in wip-webkit2 branch
e-util/e-web-view.c | 499 ++++++++++++++++++++-----------------------------
mail/e-mail-display.c | 235 +++++++++++++----------
2 files changed, 338 insertions(+), 396 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 14f083f..9f0c885 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1597,193 +1597,6 @@ e_web_view_test_change_and_update_fonts_cb (EWebView *web_view,
}
static void
-e_web_view_class_init (EWebViewClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- g_type_class_add_private (class, sizeof (EWebViewPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->constructor = web_view_constructor;
- object_class->set_property = web_view_set_property;
- object_class->get_property = web_view_get_property;
- object_class->dispose = web_view_dispose;
- object_class->finalize = web_view_finalize;
- object_class->constructed = web_view_constructed;
-
- widget_class = GTK_WIDGET_CLASS (class);
- widget_class->scroll_event = web_view_scroll_event;
- widget_class->drag_motion = web_view_drag_motion;
-
- class->create_plugin_widget = web_view_create_plugin_widget;
- class->hovering_over_link = web_view_hovering_over_link;
- class->link_clicked = web_view_link_clicked;
- class->load_string = web_view_load_string;
- class->load_uri = web_view_load_uri;
- class->redirect_uri = web_view_redirect_uri;
- class->suggest_filename = web_view_suggest_filename;
- class->popup_event = web_view_popup_event;
- class->stop_loading = web_view_stop_loading;
- class->update_actions = web_view_update_actions;
-
- g_object_class_install_property (
- object_class,
- PROP_CARET_MODE,
- g_param_spec_boolean (
- "caret-mode",
- "Caret Mode",
- NULL,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_CURSOR_IMAGE_SRC,
- g_param_spec_string (
- "cursor-image-src",
- "Image source uri at the mouse cursor",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_DISABLE_PRINTING,
- g_param_spec_boolean (
- "disable-printing",
- "Disable Printing",
- NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (
- object_class,
- PROP_DISABLE_SAVE_TO_DISK,
- g_param_spec_boolean (
- "disable-save-to-disk",
- "Disable Save-to-Disk",
- NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (
- object_class,
- PROP_OPEN_PROXY,
- g_param_spec_object (
- "open-proxy",
- "Open Proxy",
- NULL,
- GTK_TYPE_ACTION,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_PRINT_PROXY,
- g_param_spec_object (
- "print-proxy",
- "Print Proxy",
- NULL,
- GTK_TYPE_ACTION,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_SAVE_AS_PROXY,
- g_param_spec_object (
- "save-as-proxy",
- "Save As Proxy",
- NULL,
- GTK_TYPE_ACTION,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class,
- PROP_SELECTED_URI,
- g_param_spec_string (
- "selected-uri",
- "Selected URI",
- NULL,
- NULL,
- G_PARAM_READWRITE));
-
- signals[NEW_ACTIVITY] = g_signal_new (
- "new-activity",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, new_activity),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- E_TYPE_ACTIVITY);
-
- signals[POPUP_EVENT] = g_signal_new (
- "popup-event",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, popup_event),
- g_signal_accumulator_true_handled, NULL,
- e_marshal_BOOLEAN__STRING,
- G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
-
- signals[STATUS_MESSAGE] = g_signal_new (
- "status-message",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, status_message),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
-
- signals[STOP_LOADING] = g_signal_new (
- "stop-loading",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, stop_loading),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- signals[UPDATE_ACTIONS] = g_signal_new (
- "update-actions",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, update_actions),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /* return TRUE when a signal handler processed the mailto URI */
- signals[PROCESS_MAILTO] = g_signal_new (
- "process-mailto",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EWebViewClass, process_mailto),
- NULL, NULL,
- e_marshal_BOOLEAN__STRING,
- G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
-}
-
-static void
-e_web_view_alert_sink_init (EAlertSinkInterface *iface)
-{
- iface->submit_alert = web_view_submit_alert;
-}
-
-static void
-e_web_view_selectable_init (ESelectableInterface *iface)
-{
- iface->update_actions = web_view_selectable_update_actions;
- iface->cut_clipboard = web_view_selectable_cut_clipboard;
- iface->copy_clipboard = web_view_selectable_copy_clipboard;
- iface->paste_clipboard = web_view_selectable_paste_clipboard;
- iface->select_all = web_view_selectable_select_all;
-}
-
-static void
web_view_process_uri_scheme_finished_cb (EWebView *web_view,
GAsyncResult *result,
WebKitURISchemeRequest *request)
@@ -1803,12 +1616,6 @@ web_view_process_uri_scheme_finished_cb (EWebView *web_view,
}
static void
-web_view_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EWebView *web_view)
-{
-}
-
-static void
web_view_process_file_uri_scheme_request (GTask *task,
gpointer source_object,
gpointer task_data,
@@ -1855,12 +1662,12 @@ web_view_process_file_uri_scheme_request (GTask *task,
}
static void
-web_view_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EWebView *web_view)
+web_view_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
{
+ EWebView *web_view;
GTask *task;
- g_return_if_fail (E_IS_WEB_VIEW (web_view));
+ web_view = E_WEB_VIEW (webkit_uri_scheme_request_get_web_view (request));
task = g_task_new (
web_view, NULL,
@@ -1874,14 +1681,7 @@ web_view_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
}
static void
-web_view_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EWebView *web_view)
-{
-}
-
-static void
-web_view_gtk_stock_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EWebView *web_view)
+web_view_gtk_stock_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
{
SoupURI *uri;
GHashTable *query = NULL;
@@ -1982,72 +1782,216 @@ web_view_gtk_stock_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
g_free (content_type);
}
-void
-e_web_view_register_uri_scheme (EWebView *web_view,
- EURIScheme scheme,
- gpointer user_callback,
- gpointer user_data)
+static void
+web_view_initialize_web_context (void)
{
- WebKitWebContext *context;
- gpointer callback = NULL;
- const gchar *uri_scheme;
+ WebKitWebContext *web_context = webkit_web_context_get_default ();
- static GHashTable *hash_table = NULL;
+ webkit_web_context_set_cache_model (
+ web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
- if (!hash_table)
- hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "evo-file",
+ (WebKitURISchemeRequestCallback) web_view_file_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
- context = webkit_web_context_get_default ();
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "gtk-stock",
+ (WebKitURISchemeRequestCallback) web_view_gtk_stock_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
+}
- callback = user_callback;
+static void
+e_web_view_class_init (EWebViewClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
- switch (scheme) {
- case CID_URI_SCHEME:
- uri_scheme = "cid";
- if (!callback)
- callback = web_view_cid_uri_scheme_appeared_cb;
- break;
- case FILE_URI_SCHEME:
- uri_scheme = "evo-file";
- if (!callback)
- callback = web_view_file_uri_scheme_appeared_cb;
- break;
- case MAIL_URI_SCHEME:
- uri_scheme = "mail";
- if (!callback)
- callback = web_view_mail_uri_scheme_appeared_cb;
- break;
- case EVO_HTTP_URI_SCHEME:
- uri_scheme = "evo-http";
- if (!callback)
- callback = web_view_http_uri_scheme_appeared_cb;
- break;
- case EVO_HTTPS_URI_SCHEME:
- uri_scheme = "evo-https";
- if (!callback)
- callback = web_view_http_uri_scheme_appeared_cb;
- break;
- case GTK_STOCK_URI_SCHEME:
- uri_scheme = "gtk-stock";
- if (!callback)
- callback = web_view_gtk_stock_uri_scheme_appeared_cb;
- break;
- default:
- return;
- }
+ g_type_class_add_private (class, sizeof (EWebViewPrivate));
- if (g_hash_table_lookup (hash_table, uri_scheme))
- return;
+ web_view_initialize_web_context ();
- g_hash_table_insert (hash_table, (gpointer) uri_scheme, callback);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructor = web_view_constructor;
+ object_class->set_property = web_view_set_property;
+ object_class->get_property = web_view_get_property;
+ object_class->dispose = web_view_dispose;
+ object_class->finalize = web_view_finalize;
+ object_class->constructed = web_view_constructed;
- webkit_web_context_register_uri_scheme (
- context,
- uri_scheme,
- (WebKitURISchemeRequestCallback) callback,
- user_data ? user_data : web_view,
- NULL);
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->scroll_event = web_view_scroll_event;
+ widget_class->drag_motion = web_view_drag_motion;
+
+ class->create_plugin_widget = web_view_create_plugin_widget;
+ class->hovering_over_link = web_view_hovering_over_link;
+ class->link_clicked = web_view_link_clicked;
+ class->load_string = web_view_load_string;
+ class->load_uri = web_view_load_uri;
+ class->redirect_uri = web_view_redirect_uri;
+ class->suggest_filename = web_view_suggest_filename;
+ class->popup_event = web_view_popup_event;
+ class->stop_loading = web_view_stop_loading;
+ class->update_actions = web_view_update_actions;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CARET_MODE,
+ g_param_spec_boolean (
+ "caret-mode",
+ "Caret Mode",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURSOR_IMAGE_SRC,
+ g_param_spec_string (
+ "cursor-image-src",
+ "Image source uri at the mouse cursor",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_DISABLE_PRINTING,
+ g_param_spec_boolean (
+ "disable-printing",
+ "Disable Printing",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_DISABLE_SAVE_TO_DISK,
+ g_param_spec_boolean (
+ "disable-save-to-disk",
+ "Disable Save-to-Disk",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_OPEN_PROXY,
+ g_param_spec_object (
+ "open-proxy",
+ "Open Proxy",
+ NULL,
+ GTK_TYPE_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PRINT_PROXY,
+ g_param_spec_object (
+ "print-proxy",
+ "Print Proxy",
+ NULL,
+ GTK_TYPE_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SAVE_AS_PROXY,
+ g_param_spec_object (
+ "save-as-proxy",
+ "Save As Proxy",
+ NULL,
+ GTK_TYPE_ACTION,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SELECTED_URI,
+ g_param_spec_string (
+ "selected-uri",
+ "Selected URI",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ signals[NEW_ACTIVITY] = g_signal_new (
+ "new-activity",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, new_activity),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ E_TYPE_ACTIVITY);
+
+ signals[POPUP_EVENT] = g_signal_new (
+ "popup-event",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, popup_event),
+ g_signal_accumulator_true_handled, NULL,
+ e_marshal_BOOLEAN__STRING,
+ G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
+
+ signals[STATUS_MESSAGE] = g_signal_new (
+ "status-message",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, status_message),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ signals[STOP_LOADING] = g_signal_new (
+ "stop-loading",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, stop_loading),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[UPDATE_ACTIONS] = g_signal_new (
+ "update-actions",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, update_actions),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ /* return TRUE when a signal handler processed the mailto URI */
+ signals[PROCESS_MAILTO] = g_signal_new (
+ "process-mailto",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EWebViewClass, process_mailto),
+ NULL, NULL,
+ e_marshal_BOOLEAN__STRING,
+ G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
+}
+
+static void
+e_web_view_alert_sink_init (EAlertSinkInterface *iface)
+{
+ iface->submit_alert = web_view_submit_alert;
+}
+
+static void
+e_web_view_selectable_init (ESelectableInterface *iface)
+{
+ iface->update_actions = web_view_selectable_update_actions;
+ iface->cut_clipboard = web_view_selectable_cut_clipboard;
+ iface->copy_clipboard = web_view_selectable_copy_clipboard;
+ iface->paste_clipboard = web_view_selectable_paste_clipboard;
+ iface->select_all = web_view_selectable_select_all;
}
static void
@@ -2143,9 +2087,6 @@ e_web_view_init (EWebView *web_view)
web_view_watch_web_extension (web_view);
- e_web_view_register_uri_scheme (web_view, FILE_URI_SCHEME, NULL, NULL);
- e_web_view_register_uri_scheme (web_view, GTK_STOCK_URI_SCHEME, NULL, NULL);
-
settings = g_settings_new ("org.gnome.desktop.interface");
web_view->priv->font_settings = g_object_ref (settings);
handler_id = g_signal_connect_swapped (
@@ -3477,7 +3418,6 @@ e_web_view_get_default_webkit_settings (void)
"enable-offline-web-application-cache", FALSE,
"enable-page-cache", FALSE,
"enable-plugins", FALSE,
- "enable-private-browsing", TRUE,
"enable-smooth-scrolling", TRUE,
"media-playback-allows-inline", FALSE,
"respect-image-orientation", TRUE,
@@ -3485,15 +3425,11 @@ e_web_view_get_default_webkit_settings (void)
}
static void
-initialize_web_extensions_cb (WebKitWebContext *web_context,
- gpointer user_data)
+initialize_web_extensions_cb (WebKitWebContext *web_context)
{
/* Set the web extensions dir before the process is launched */
webkit_web_context_set_web_extensions_directory (
web_context, EVOLUTION_WEB_EXTENSIONS_DIR);
-
- webkit_web_context_set_cache_model (
- web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
}
void
@@ -3517,20 +3453,6 @@ e_web_view_update_fonts (EWebView *web_view)
pango_font_description_free (vw);
}
-void
-e_web_view_initialize_webkit (void)
-{
- WebKitWebContext *web_context;
-
- web_context = webkit_web_context_get_default ();
-
- /* Set the web extensions dir before the process is launched */
- webkit_web_context_set_web_extensions_directory (
- web_context, EVOLUTION_WEB_EXTENSIONS_DIR);
-
- webkit_web_context_set_cache_model (web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
-}
-
/* Helper for e_web_view_cursor_image_copy() */
static void
web_view_cursor_image_copy_pixbuf_cb (GObject *source_object,
@@ -4017,18 +3939,7 @@ e_web_view_request_finish (EWebView *web_view,
return g_object_ref (async_context->input_stream);
}
-/*
-void
-e_web_view_install_request_handler (EWebView *web_view,
- GType handler_type)
-{
- SoupSession *session;
-// session = webkit_get_default_session ();
- session = NULL;
- soup_session_add_feature_by_type (session, handler_type);
-}
-*/
/**
* e_web_view_create_and_add_css_style_sheet:
* @web_view: an #EWebView
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 7bcf72b..4d888dd 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1514,89 +1514,6 @@ mail_display_drag_data_get (GtkWidget *widget,
}
static void
-e_mail_display_class_init (EMailDisplayClass *class)
-{
- GObjectClass *object_class;
- EWebViewClass *web_view_class;
- GtkWidgetClass *widget_class;
-
- g_type_class_add_private (class, sizeof (EMailDisplayPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->constructed = mail_display_constructed;
- object_class->set_property = mail_display_set_property;
- object_class->get_property = mail_display_get_property;
- object_class->dispose = mail_display_dispose;
- object_class->finalize = mail_display_finalize;
-
- widget_class = GTK_WIDGET_CLASS (class);
- widget_class->realize = mail_display_realize;
- widget_class->style_updated = mail_display_style_updated;
- widget_class->button_press_event = mail_display_button_press_event;
-
- web_view_class = E_WEB_VIEW_CLASS (class);
-#if 0
- web_view_class->redirect_uri = mail_display_redirect_uri;
- web_view_class->suggest_filename = mail_display_suggest_filename;
-#endif
- web_view_class->set_fonts = mail_display_set_fonts;
-
- g_object_class_install_property (
- object_class,
- PROP_FORMATTER,
- g_param_spec_pointer (
- "formatter",
- "Mail Formatter",
- NULL,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
- PROP_HEADERS_COLLAPSABLE,
- g_param_spec_boolean (
- "headers-collapsable",
- "Headers Collapsable",
- NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
- PROP_HEADERS_COLLAPSED,
- g_param_spec_boolean (
- "headers-collapsed",
- "Headers Collapsed",
- NULL,
- FALSE,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
- PROP_MODE,
- g_param_spec_enum (
- "mode",
- "Mode",
- NULL,
- E_TYPE_MAIL_FORMATTER_MODE,
- E_MAIL_FORMATTER_MODE_NORMAL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (
- object_class,
- PROP_PART_LIST,
- g_param_spec_pointer (
- "part-list",
- "Part List",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
-}
-
-static void
mail_display_process_uri_scheme_finished_cb (EMailDisplay *display,
GAsyncResult *result,
WebKitURISchemeRequest *request)
@@ -1616,9 +1533,9 @@ mail_display_process_uri_scheme_finished_cb (EMailDisplay *display,
}
static void
-mail_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EMailDisplay *display)
+mail_display_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
{
+ EMailDisplay *display;
EMailPartList *part_list;
EMailPart *part;
GInputStream *stream;
@@ -1630,6 +1547,10 @@ mail_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
CamelDataWrapper *dw;
CamelMimePart *mime_part;
+ display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
+
+ g_return_if_fail (E_IS_MAIL_DISPLAY (display));
+
part_list = e_mail_display_get_part_list (display);
uri = webkit_uri_scheme_request_get_uri (request);
part = e_mail_part_list_ref_part (part_list, uri);
@@ -2027,12 +1948,14 @@ web_view_process_http_uri_scheme_request (GTask *task,
}
static void
-mail_http_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EMailDisplay *display)
+mail_display_http_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
{
+ EMailDisplay *display;
GTask *task;
GCancellable *cancellable;
+ display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
+
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
cancellable = g_cancellable_new ();
@@ -2306,13 +2229,15 @@ exit:
}
static void
-mail_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
- EMailDisplay *display)
+mail_display_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
{
+ EMailDisplay *display;
GTask *task;
GCancellable *cancellable;
const gchar *uri;
+ display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
+
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
cancellable = g_cancellable_new ();
@@ -2336,6 +2261,125 @@ mail_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request,
}
static void
+mail_display_initialize_web_context (void)
+{
+ WebKitWebContext *web_context = webkit_web_context_get_default ();
+
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "evo-http",
+ (WebKitURISchemeRequestCallback) mail_display_http_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
+
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "evo-https",
+ (WebKitURISchemeRequestCallback) mail_display_http_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
+
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "mail",
+ (WebKitURISchemeRequestCallback) mail_display_mail_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
+
+ webkit_web_context_register_uri_scheme (
+ web_context,
+ "cid",
+ (WebKitURISchemeRequestCallback) mail_display_cid_uri_scheme_appeared_cb,
+ NULL,
+ NULL);
+}
+
+static void
+e_mail_display_class_init (EMailDisplayClass *class)
+{
+ GObjectClass *object_class;
+ EWebViewClass *web_view_class;
+ GtkWidgetClass *widget_class;
+
+ g_type_class_add_private (class, sizeof (EMailDisplayPrivate));
+
+ mail_display_initialize_web_context ();
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_display_constructed;
+ object_class->set_property = mail_display_set_property;
+ object_class->get_property = mail_display_get_property;
+ object_class->dispose = mail_display_dispose;
+ object_class->finalize = mail_display_finalize;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = mail_display_realize;
+ widget_class->style_updated = mail_display_style_updated;
+ widget_class->button_press_event = mail_display_button_press_event;
+
+ web_view_class = E_WEB_VIEW_CLASS (class);
+#if 0
+ web_view_class->redirect_uri = mail_display_redirect_uri;
+ web_view_class->suggest_filename = mail_display_suggest_filename;
+#endif
+ web_view_class->set_fonts = mail_display_set_fonts;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FORMATTER,
+ g_param_spec_pointer (
+ "formatter",
+ "Mail Formatter",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEADERS_COLLAPSABLE,
+ g_param_spec_boolean (
+ "headers-collapsable",
+ "Headers Collapsable",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_HEADERS_COLLAPSED,
+ g_param_spec_boolean (
+ "headers-collapsed",
+ "Headers Collapsed",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODE,
+ g_param_spec_enum (
+ "mode",
+ "Mode",
+ NULL,
+ E_TYPE_MAIL_FORMATTER_MODE,
+ E_MAIL_FORMATTER_MODE_NORMAL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PART_LIST,
+ g_param_spec_pointer (
+ "part-list",
+ "Part List",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+}
+
+static void
mail_display_update_fonts (EMailDisplay *display)
{
e_web_view_update_fonts (E_WEB_VIEW (display));
@@ -2413,19 +2457,6 @@ e_mail_display_init (EMailDisplay *display)
G_N_ELEMENTS (mailto_entries), 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), 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);
- 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);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]