[evolution/evolution-3-12] EMailDisplay: Install HTML click event handlers on images in all frames



commit ab955f205453f98b9276a7c267dfb452114faa9d
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Apr 4 10:37:25 2014 +0200

    EMailDisplay: Install HTML click event handlers on images in all frames
    
    The handlers were installed just on main frame. Thus if subframe
    contained +/- images to show/hide i.e. CC'ed people it was not working.

 mail/e-mail-display.c |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 82dd8e9..837c9b3 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -887,26 +887,14 @@ initialize_web_view_colors (EMailDisplay *display)
 }
 
 static void
-setup_dom_bindings (GObject *object,
-                    GParamSpec *pspec,
-                    gpointer user_data)
+setup_image_click_event_listeners_on_document (WebKitDOMDocument *document,
+                                                WebKitWebView *web_view)
 {
-       WebKitWebView *web_view;
-       WebKitWebFrame *frame;
-       WebKitLoadStatus load_status;
-       WebKitDOMDocument *document;
+       gint length, ii = 0;
        WebKitDOMElement *button;
        WebKitDOMNodeList *list;
-       gint length, ii = 0;
-
-       frame = WEBKIT_WEB_FRAME (object);
-       load_status = webkit_web_frame_get_load_status (frame);
-       if (load_status != WEBKIT_LOAD_FINISHED)
-               return;
-
-       web_view = webkit_web_frame_get_web_view (frame);
-       document = webkit_web_view_get_dom_document (web_view);
 
+       /* Install event listeners on document */
        button = webkit_dom_document_get_element_by_id (
                document, "__evo-collapse-headers-img");
        if (button != NULL)
@@ -930,6 +918,18 @@ setup_dom_bindings (GObject *object,
 }
 
 static void
+setup_dom_bindings (WebKitWebView *web_view,
+                    WebKitWebFrame *frame,
+                    gpointer user_data)
+{
+       WebKitDOMDocument *document;
+
+       document = webkit_web_frame_get_dom_document (frame);
+
+       setup_image_click_event_listeners_on_document (document, web_view);
+}
+
+static void
 mail_parts_bind_dom (GObject *object,
                      GParamSpec *pspec,
                      gpointer user_data)
@@ -1526,6 +1526,12 @@ e_mail_display_init (EMailDisplay *display)
        g_signal_connect (
                display, "notify::uri",
                G_CALLBACK (mail_display_uri_changed), NULL);
+       g_signal_connect (
+               display, "document-load-finished",
+               G_CALLBACK (setup_dom_bindings), NULL);
+       g_signal_connect (
+               display, "document-load-finished",
+               G_CALLBACK (initialize_web_view_colors), NULL);
 
        display->priv->settings = g_settings_new ("org.gnome.evolution.mail");
        g_signal_connect_swapped (
@@ -1543,13 +1549,7 @@ e_mail_display_init (EMailDisplay *display)
        main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (display));
        g_signal_connect (
                main_frame, "notify::load-status",
-               G_CALLBACK (setup_dom_bindings), NULL);
-       g_signal_connect (
-               main_frame, "notify::load-status",
                G_CALLBACK (mail_parts_bind_dom), NULL);
-       g_signal_connect (
-               display, "document-load-finished",
-               G_CALLBACK (initialize_web_view_colors), NULL);
 
        actions = e_web_view_get_action_group (E_WEB_VIEW (display), "mailto");
        gtk_action_group_add_actions (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]