summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2016-01-27 10:22:20 +0100
committerTomas Popela <tpopela@redhat.com>2016-01-27 10:24:16 +0100
commit4332290a7c499f231cdee6e21180e203d2ebc15e (patch)
tree77c568bac5d4eeac5910b60794f34ba72f9426ee
parentb3f7f83cfa9f09dbc9115db7239d31f616139ffe (diff)
downloadevolution-4332290a7c499f231cdee6e21180e203d2ebc15e.tar.gz
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.
-rw-r--r--mail/e-mail-display.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 4b1bd6ff7b..b874afe093 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);