[evolution/gnome-3-18] Bug 761166 - Control widgets are not hidden after collapsing email message attachment



commit 4332290a7c499f231cdee6e21180e203d2ebc15e
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Jan 27 10:22:20 2016 +0100

    Bug 761166 - Control widgets are not hidden after collapsing email message attachment
    
    Hide/Show all the GtkWidgets inside an attachment, otherwise they could be
    visible even if the wrapper is hidden.

 mail/e-mail-display.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 4b1bd6f..b874afe 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -541,7 +541,7 @@ attachment_button_expanded (GObject *object,
        EAttachmentButton *button = E_ATTACHMENT_BUTTON (object);
        EMailDisplay *display = user_data;
        WebKitDOMDocument *document;
-       WebKitDOMElement *element;
+       WebKitDOMElement *element, *iframe;
        WebKitDOMCSSStyleDeclaration *css;
        const gchar *attachment_part_id;
        gchar *element_id;
@@ -587,6 +587,37 @@ attachment_button_expanded (GObject *object,
                g_free (inner_html_data);
        }
 
+       /* Hide/Show all the GtkWidgets inside an attachment, otherwise they could
+        * be visible even if the wrapper is hidden. */
+       if ((iframe = webkit_dom_element_query_selector (element, "iframe", NULL))) {
+               WebKitDOMDocument *content_document;
+
+               content_document = webkit_dom_html_iframe_element_get_content_document
+                       (WEBKIT_DOM_HTML_IFRAME_ELEMENT (iframe));
+
+               if (content_document) {
+                       gint length, ii;
+                       WebKitDOMNodeList *list;
+
+                       list = webkit_dom_document_get_elements_by_tag_name (content_document, "object");
+                       length = webkit_dom_node_list_get_length (list);
+
+                       for (ii = 0; ii < length; ii++) {
+                               WebKitDOMNode *item;
+
+                               item = webkit_dom_node_list_item (list, ii);
+
+                               css = webkit_dom_element_get_style (WEBKIT_DOM_ELEMENT (item));
+                               if (expanded)
+                                       g_free (webkit_dom_css_style_declaration_remove_property (css, 
"display", NULL));
+                               else
+                                       webkit_dom_css_style_declaration_set_property (css, "display", 
"none", "", NULL);
+                               g_clear_object (&css);
+                       }
+                       g_object_unref (list);
+               }
+       }
+
        /* Show or hide the DIV which contains
         * the attachment (iframe, image...). */
        css = webkit_dom_element_get_style (element);


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