[evolution] Show Security Information for signed/encrypted mails in the preview panel



commit 517d8227141abe3a35960a48cc84809ff603abc7
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 10 15:50:53 2019 +0200

    Show Security Information for signed/encrypted mails in the preview panel
    
    It used to be a dialog, which was unnecessary. Let it be shown inline,
    in the message preview instead. As a side effect, it's easier to copy
    information out of it.

 data/webkit/e-web-view.js                      |  36 +-
 src/e-util/e-misc-utils.c                      |  32 ++
 src/e-util/e-misc-utils.h                      |   3 +
 src/e-util/test-web-view-jsc.c                 | 308 +++++++++---------
 src/em-format/e-mail-formatter-secure-button.c | 188 ++++++++++-
 src/em-format/e-mail-part-secure-button.c      | 433 +++++++++++--------------
 src/mail/mail-dialogs.ui                       | 191 -----------
 7 files changed, 577 insertions(+), 614 deletions(-)
---
diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js
index cd01ed870d..4957a59f99 100644
--- a/data/webkit/e-web-view.js
+++ b/data/webkit/e-web-view.js
@@ -106,7 +106,7 @@ Evo.findElementInDocumentById = function(doc, element_id)
        return doc.getElementById(element_id);
 }
 
-Evo.findElement = function(iframe_id, element_id)
+Evo.FindElement = function(iframe_id, element_id)
 {
        var traversar = {
                element_id : element_id,
@@ -126,7 +126,7 @@ Evo.findElement = function(iframe_id, element_id)
 
 Evo.SetElementHidden = function(iframe_id, element_id, value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem)
                elem.hidden = value;
@@ -134,7 +134,7 @@ Evo.SetElementHidden = function(iframe_id, element_id, value)
 
 Evo.SetElementDisabled = function(iframe_id, element_id, value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem)
                elem.disabled = value;
@@ -142,7 +142,7 @@ Evo.SetElementDisabled = function(iframe_id, element_id, value)
 
 Evo.SetElementChecked = function(iframe_id, element_id, value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem)
                elem.checked = value;
@@ -150,7 +150,7 @@ Evo.SetElementChecked = function(iframe_id, element_id, value)
 
 Evo.SetElementStyleProperty = function(iframe_id, element_id, property_name, value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                if (value != null && value != "")
@@ -162,7 +162,7 @@ Evo.SetElementStyleProperty = function(iframe_id, element_id, property_name, val
 
 Evo.SetElementAttribute = function(iframe_id, element_id, namespace_uri, qualified_name, value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                if (value != null && value != "")
@@ -493,7 +493,7 @@ Evo.GetDocumentContent = function(iframe_id, format)
 
 Evo.GetElementContent = function(iframe_id, element_id, format, use_outer_html)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (!elem)
                return null;
@@ -1039,7 +1039,7 @@ Evo.MailDisplayShowAttachment = function(element_id, show)
 {
        var elem;
 
-       elem = Evo.findElement("*", element_id);
+       elem = Evo.FindElement("*", element_id);
 
        if (!elem) {
                return;
@@ -1164,7 +1164,7 @@ EvoItip.Initialize = function(iframe_id)
 
 EvoItip.SetElementInnerHTML = function(iframe_id, element_id, html_content)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem)
                elem.innerHTML = html_content;
@@ -1172,7 +1172,7 @@ EvoItip.SetElementInnerHTML = function(iframe_id, element_id, html_content)
 
 EvoItip.SetShowCheckbox = function(iframe_id, element_id, show, update_second)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                elem.hidden = !show;
@@ -1198,7 +1198,7 @@ EvoItip.SetShowCheckbox = function(iframe_id, element_id, show, update_second)
 
 EvoItip.SetAreaText = function(iframe_id, element_id, text)
 {
-       var row = Evo.findElement(iframe_id, element_id);
+       var row = Evo.FindElement(iframe_id, element_id);
 
        if (row) {
                row.hidden = text == "";
@@ -1211,7 +1211,7 @@ EvoItip.SetAreaText = function(iframe_id, element_id, text)
 
 EvoItip.UpdateTimes = function(iframe_id, element_id, header, label)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                elem.hidden = false;
@@ -1228,7 +1228,7 @@ EvoItip.UpdateTimes = function(iframe_id, element_id, header, label)
 
 EvoItip.AppendInfoRow = function(iframe_id, table_id, row_id, icon_name, message)
 {
-       var cell, row, table = Evo.findElement(iframe_id, table_id);
+       var cell, row, table = Evo.FindElement(iframe_id, table_id);
 
        if (!table) {
                return;
@@ -1254,7 +1254,7 @@ EvoItip.AppendInfoRow = function(iframe_id, table_id, row_id, icon_name, message
 
 EvoItip.RemoveInfoRow = function(iframe_id, row_id)
 {
-       var row = Evo.findElement(iframe_id, row_id);
+       var row = Evo.FindElement(iframe_id, row_id);
 
        if (row && row.parentNode) {
                row.parentNode.removeChild(row);
@@ -1263,7 +1263,7 @@ EvoItip.RemoveInfoRow = function(iframe_id, row_id)
 
 EvoItip.RemoveChildNodes = function(iframe_id, element_id)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                while (elem.lastChild) {
@@ -1310,7 +1310,7 @@ EvoItip.AddToSourceList = function(iframe_id, optgroup_id, optgroup_label, optio
 
 EvoItip.HideButtons = function(iframe_id, element_id)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                var child;
@@ -1326,7 +1326,7 @@ EvoItip.HideButtons = function(iframe_id, element_id)
 
 EvoItip.SetElementAccessKey = function(iframe_id, element_id, access_key)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                elem.accessKey = access_key;
@@ -1335,7 +1335,7 @@ EvoItip.SetElementAccessKey = function(iframe_id, element_id, access_key)
 
 EvoItip.SetSelectSelected = function(iframe_id, element_id, option_value)
 {
-       var elem = Evo.findElement(iframe_id, element_id);
+       var elem = Evo.FindElement(iframe_id, element_id);
 
        if (elem) {
                var ii;
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index 62ce8f9378..679d118d66 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -4712,3 +4712,35 @@ e_util_can_preview_filename (const gchar *filename)
                #endif
                ;
 }
+
+/**
+ * e_util_markup_append_escaped:
+ * @buffer: a #GString buffer to append escaped text to
+ * @format: printf-like format of the string to append
+ * @...: arguments for the format
+ *
+ * Appends escaped markup text into @buffer. This function is
+ * similar to g_markup_printf_escaped(), except it appends
+ * the escaped text into a #GString.
+ *
+ * Since: 3.36
+ **/
+void
+e_util_markup_append_escaped (GString *buffer,
+                             const gchar *format,
+                             ...)
+{
+       va_list va;
+       gchar *escaped;
+
+       g_return_if_fail (buffer != NULL);
+       g_return_if_fail (format != NULL);
+
+       va_start (va, format);
+       escaped = g_markup_vprintf_escaped (format, va);
+       va_end (va);
+
+       g_string_append (buffer, escaped);
+
+       g_free (escaped);
+}
diff --git a/src/e-util/e-misc-utils.h b/src/e-util/e-misc-utils.h
index b10bdf5adf..d91b6708da 100644
--- a/src/e-util/e-misc-utils.h
+++ b/src/e-util/e-misc-utils.h
@@ -360,6 +360,9 @@ gboolean    e_util_get_language_info        (const gchar *language_tag,
                                                 gchar **out_country_name);
 void           e_misc_util_free_global_memory  (void);
 gboolean       e_util_can_preview_filename     (const gchar *filename);
+void           e_util_markup_append_escaped    (GString *buffer,
+                                                const gchar *format,
+                                                ...) G_GNUC_PRINTF (2, 3);
 
 G_END_DECLS
 
diff --git a/src/e-util/test-web-view-jsc.c b/src/e-util/test-web-view-jsc.c
index f5dbdc43ca..0856984df9 100644
--- a/src/e-util/test-web-view-jsc.c
+++ b/src/e-util/test-web-view-jsc.c
@@ -587,72 +587,72 @@ test_set_element_hidden (TestFixture *fixture)
 {
        test_utils_load_body (fixture, LOAD_ALL);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "", "btn1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "frm1_1", "btn1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "frm2", "btn2", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "frm2", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 
        e_web_view_jsc_set_element_hidden (fixture->web_view, "frm1_1", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").hidden"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").hidden"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").hidden"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").hidden"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").hidden"));
 }
 
 static void
@@ -660,72 +660,72 @@ test_set_element_disabled (TestFixture *fixture)
 {
        test_utils_load_body (fixture, LOAD_ALL);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "", "btn1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "frm1_1", "btn1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "frm2", "btn2", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "frm2", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 
        e_web_view_jsc_set_element_disabled (fixture->web_view, "frm1_1", "btn1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"btn3\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"btn1\").disabled"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn1\").disabled"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"btn2\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"btn3\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"btn1\").disabled"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn1\").disabled"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"btn2\").disabled"));
 }
 
 static void
@@ -733,52 +733,52 @@ test_set_element_checked (TestFixture *fixture)
 {
        test_utils_load_body (fixture, LOAD_ALL);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "", "chk1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "frm1_1", "chk1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "", "chk1", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "frm2", "chk2", FALSE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "", "chk1", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 
        e_web_view_jsc_set_element_checked (fixture->web_view, "frm1_1", "chk1", FALSE, NULL);
        e_web_view_jsc_set_element_checked (fixture->web_view, "frm2", "chk2", TRUE, NULL);
        test_utils_wait_noop (fixture);
 
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"\", \"chk1\").checked"));
-       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm1_1\", \"chk1\").checked"));
-       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.findElement(\"frm2\", \"chk2\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"\", \"chk1\").checked"));
+       g_assert (!test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm1_1\", \"chk1\").checked"));
+       g_assert (test_utils_jsc_call_bool_sync (fixture, "Evo.FindElement(\"frm2\", \"chk2\").checked"));
 }
 
 static void
@@ -786,42 +786,42 @@ test_set_element_style_property (TestFixture *fixture)
 {
        test_utils_load_body (fixture, LOAD_ALL);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
 
        e_web_view_jsc_set_element_style_property (fixture->web_view, "", "btn1", "color", "blue", NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
 
        e_web_view_jsc_set_element_style_property (fixture->web_view, "frm2", "btn1", "color", "green", NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "green");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "green");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
 
        e_web_view_jsc_set_element_style_property (fixture->web_view, "frm2", "btn1", "color", NULL, NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn1\").style.getPropertyValue(\"color\")", "blue");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", 
\"btn3\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").style.getPropertyValue(\"color\")", "");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").style.getPropertyValue(\"color\")", "");
 }
 
 static void
@@ -829,42 +829,42 @@ test_set_element_attribute (TestFixture *fixture)
 {
        test_utils_load_body (fixture, LOAD_ALL);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
 
        e_web_view_jsc_set_element_attribute (fixture->web_view, "", "btn1", NULL, "myattr", "val1", NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
 
        e_web_view_jsc_set_element_attribute (fixture->web_view, "frm2", "btn1", NULL, "myattr", "val2", 
NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", "val2");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", "val2");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
 
        e_web_view_jsc_set_element_attribute (fixture->web_view, "frm2", "btn1", NULL, "myattr", NULL, NULL);
        test_utils_wait_noop (fixture);
 
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
-       test_utils_jsc_call_string_and_verify (fixture, "Evo.findElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn1\").getAttributeNS(\"\", 
\"myattr\")", "val1");
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"\", \"btn3\").getAttributeNS(\"\", 
\"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm1_1\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn1\").getAttributeNS(\"\", \"myattr\")", NULL);
+       test_utils_jsc_call_string_and_verify (fixture, "Evo.FindElement(\"frm2\", 
\"btn2\").getAttributeNS(\"\", \"myattr\")", NULL);
 }
 
 static void
@@ -1785,7 +1785,7 @@ test_get_element_from_point (TestFixture *fixture)
        ii = test_utils_jsc_call_int32_sync (fixture,
                "function TestGetPosition(iframe_id, elem_id)\n"
                "{\n"
-               "       var elem = Evo.findElement(iframe_id, elem_id);\n"
+               "       var elem = Evo.FindElement(iframe_id, elem_id);\n"
                "       var xx = 0, yy = 0, off_elem, check_elem;\n"
                "       for (check_elem = elem; check_elem; check_elem = 
check_elem.ownerDocument.defaultView.frameElement) {\n"
                "               for (ii = check_elem; ii; ii = ii.parentOffset) {\n"
diff --git a/src/em-format/e-mail-formatter-secure-button.c b/src/em-format/e-mail-formatter-secure-button.c
index 2715566030..c7e1c1d0f7 100644
--- a/src/em-format/e-mail-formatter-secure-button.c
+++ b/src/em-format/e-mail-formatter-secure-button.c
@@ -21,6 +21,11 @@
 
 #include <e-util/e-util.h>
 
+#if defined (ENABLE_SMIME)
+#include "certificate-manager.h"
+#include "e-cert-db.h"
+#endif
+
 #include "e-mail-formatter-extension.h"
 
 typedef EMailFormatterExtension EMailFormatterSecureButton;
@@ -84,21 +89,16 @@ static const GdkRGBA smime_sign_colour[6] = {
        { 0.0, 0.0, 0.0, 1.0 }
 };
 
-/* This is awkward, but there is no header file for it. On the other hand,
-   the functions are meant private, where they really are, being defined this way. */
-const gchar *e_mail_formatter_secure_button_get_encrypt_description (CamelCipherValidityEncrypt status);
-const gchar *e_mail_formatter_secure_button_get_sign_description (CamelCipherValiditySign status);
-
-const gchar *
-e_mail_formatter_secure_button_get_sign_description (CamelCipherValiditySign status)
+static const gchar *
+secure_button_get_sign_description (CamelCipherValiditySign status)
 {
        g_return_val_if_fail (status >= 0 && status < G_N_ELEMENTS (smime_sign_table), NULL);
 
        return _(smime_sign_table[status].description);
 }
 
-const gchar *
-e_mail_formatter_secure_button_get_encrypt_description (CamelCipherValidityEncrypt status)
+static const gchar *
+secure_button_get_encrypt_description (CamelCipherValidityEncrypt status)
 {
        g_return_val_if_fail (status >= 0 && ((gint) status) < G_N_ELEMENTS (smime_encrypt_table), NULL);
 
@@ -191,6 +191,137 @@ add_photo_cb (gpointer data,
        g_free (uri);
 }
 
+#if defined (ENABLE_SMIME)
+static gboolean
+secure_button_smime_cert_exists (const gchar *email,
+                                ECert *ec)
+{
+       CERTCertificate *found_cert;
+       ECert *found_ec;
+       gboolean found = FALSE;
+
+       if (!email || !*email)
+               return FALSE;
+
+       g_return_val_if_fail (E_IS_CERT (ec), FALSE);
+
+       found_cert = CERT_FindCertByNicknameOrEmailAddr (CERT_GetDefaultCertDB (), email);
+       if (!found_cert)
+               return FALSE;
+
+       found_ec = e_cert_new (found_cert);
+       if (!found_ec)
+               return FALSE;
+
+       #define compare_nonnull(_func) (!_func (ec) || g_strcmp0 (_func (ec), _func (found_ec)) == 0)
+
+       if (compare_nonnull (e_cert_get_serial_number) &&
+           compare_nonnull (e_cert_get_sha1_fingerprint) &&
+           compare_nonnull (e_cert_get_md5_fingerprint)) {
+               found = TRUE;
+       }
+
+       #undef compare_nonnull
+
+       g_object_unref (found_ec);
+
+       return found;
+}
+#endif /* defined (ENABLE_SMIME) */
+
+static void
+add_cert_table (GString *html,
+               const gchar *label,
+               GQueue *certlist,
+               guint length,
+               EMailPart *part,
+               CamelCipherValidity *validity)
+{
+       GList *link;
+
+       if (length == 1)
+               e_util_markup_append_escaped (html, "%s&nbsp;", label);
+       else
+               e_util_markup_append_escaped (html, "%s<br><div style=\"margin-left:12px;\">", label);
+
+       for (link = g_queue_peek_head_link (certlist); link; link = g_list_next (link)) {
+               CamelCipherCertInfo *info = link->data;
+               gchar *tmp = NULL;
+               const gchar *desc = NULL;
+
+               if (info->name) {
+                       if (info->email && strcmp (info->name, info->email) != 0)
+                               desc = tmp = g_strdup_printf ("%s <%s>", info->name, info->email);
+                       else
+                               desc = info->name;
+               } else {
+                       if (info->email)
+                               desc = info->email;
+               }
+
+               if (desc) {
+                       e_util_markup_append_escaped (html, "%s&nbsp;", desc);
+
+#if defined (ENABLE_SMIME)
+                       if (info->cert_data) {
+                               ECert *ec;
+
+                               e_util_markup_append_escaped (html,
+                                       "<button type=\"button\" class=\"secure-button-view-certificate\" 
id=\"%s\" value=\"%p:%p:%p\">%s</button>",
+                                       e_mail_part_get_id (part), part, validity, info->cert_data, _("View 
Certificate"));
+
+                               ec = e_cert_new (CERT_DupCertificate (info->cert_data));
+
+                               if (!secure_button_smime_cert_exists (info->email, ec)) {
+                                       e_util_markup_append_escaped (html,
+                                               "&nbsp;<button type=\"button\" 
class=\"secure-button-import-certificate\" id=\"%s.%p\" value=\"%p:%p:%p\">%s</button>",
+                                               e_mail_part_get_id (part), info->cert_data, part, validity, 
info->cert_data, _("Import Certificate"));
+                               }
+
+                               g_clear_object (&ec);
+                       }
+#endif
+
+                       g_string_append (html, "<br>");
+               }
+
+               g_free (tmp);
+       }
+
+       if (length != 1)
+               g_string_append (html, "</div>");
+}
+
+static void
+add_details_part (GString *html,
+                 EMailPart *part,
+                 CamelCipherValidity *validity,
+                 const gchar *details,
+                 const gchar *ident)
+{
+       gint icon_width, icon_height;
+
+       if (!part || !validity || !details || !*details || !ident)
+               return;
+
+       if (!gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, &icon_height)) {
+               icon_width = 16;
+               icon_height = 16;
+       }
+
+       e_util_markup_append_escaped (html,
+               "<span class=\"secure-button-details\" id=\"%p:spn\" value=\"secure-button-details-%p-%s\" 
style=\"vertical-align:bottom;\">"
+               "<img id=\"secure-button-details-%p-%s-img\" style=\"vertical-align:middle;\" width=\"%dpx\" 
height=\"%dpx\""
+               " src=\"gtk-stock://pan-end-symbolic?size=%d\" 
othersrc=\"gtk-stock://pan-down-symbolic?size=%d\">&nbsp;"
+               "%s</span><br>"
+               "<div id=\"secure-button-details-%p-%s\" style=\"white-space:pre; margin-left:12px; 
font-size:smaller;\" hidden>%s</div>",
+               part, validity, ident, validity, ident,
+               icon_width, icon_height, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_MENU,
+               _("Details"),
+               validity, ident,
+               details);
+}
+
 static void
 secure_button_format_validity (EMailPart *part,
                               gboolean sender_signer_mismatch,
@@ -201,6 +332,7 @@ secure_button_format_validity (EMailPart *part,
        gchar *description;
        gint icon_width, icon_height;
        gint info_index;
+       guint length;
        GString *buffer;
 
        g_return_if_fail (validity != NULL);
@@ -268,7 +400,43 @@ secure_button_format_validity (EMailPart *part,
        g_queue_foreach (&validity->sign.signers, add_photo_cb, html);
        g_queue_foreach (&validity->encrypt.encrypters, add_photo_cb, html);
 
-       g_string_append_printf (html, "%s</span></td></tr></table>\n", description);
+       g_string_append_printf (html, "%s</span></td></tr>", description);
+
+       e_util_markup_append_escaped (html,
+               "<tr id=\"secure-button-details-%p\" class=\"secure-button-details\" 
hidden><td></td><td><small>"
+               "<b>%s</b><br>"
+               "%s<br>",
+               validity,
+               _("Digital Signature"),
+               secure_button_get_sign_description (validity->sign.status));
+
+       length = g_queue_get_length (&validity->sign.signers);
+       if (length) {
+               add_cert_table (html,
+                       g_dngettext (GETTEXT_PACKAGE, "Signer:", "Signers:", length),
+                       &validity->sign.signers,
+                       length, part, validity);
+       }
+
+       add_details_part (html, part, validity, validity->sign.description, "sign");
+
+       e_util_markup_append_escaped (html,
+               "<br>"
+               "<b>%s</b><br>"
+               "%s<br>",
+               _("Encryption"),
+               secure_button_get_encrypt_description (validity->encrypt.status));
+
+       length = g_queue_get_length (&validity->encrypt.encrypters);
+       if (length) {
+               add_cert_table (html, _("Encrypted by:"),
+                       &validity->encrypt.encrypters,
+                       length, part, validity);
+       }
+
+       add_details_part (html, part, validity, validity->encrypt.description, "encr");
+
+       g_string_append (html, "</small></td></tr></table>\n");
 
        g_free (description);
 }
diff --git a/src/em-format/e-mail-part-secure-button.c b/src/em-format/e-mail-part-secure-button.c
index a224376257..dc3cdb621b 100644
--- a/src/em-format/e-mail-part-secure-button.c
+++ b/src/em-format/e-mail-part-secure-button.c
@@ -28,300 +28,203 @@
 
 G_DEFINE_TYPE (EMailPartSecureButton, e_mail_part_secure_button, E_TYPE_MAIL_PART)
 
-const gchar *e_mail_formatter_secure_button_get_encrypt_description (CamelCipherValidityEncrypt status);
-const gchar *e_mail_formatter_secure_button_get_sign_description (CamelCipherValiditySign status);
-
-
 #if defined (ENABLE_SMIME)
+
 static void
-viewcert_clicked (GtkWidget *button,
-                  GtkWidget *grid)
+secure_button_view_certificate (GtkWindow *parent,
+                               CamelCipherCertInfo *info)
 {
-       CamelCipherCertInfo *info = g_object_get_data ((GObject *) button, "e-cert-info");
        ECert *ec = NULL;
 
+       g_return_if_fail (info != NULL);
+
        if (info->cert_data)
                ec = e_cert_new (CERT_DupCertificate (info->cert_data));
 
        if (ec != NULL) {
-               GtkWidget *dialog, *parent;
-
-               parent = gtk_widget_get_toplevel (grid);
-               if (!parent || !GTK_IS_WINDOW (parent))
-                       parent = NULL;
+               GtkWidget *dialog;
 
-               dialog = e_cert_manager_new_certificate_viewer ((GtkWindow *) parent, ec);
+               dialog = e_cert_manager_new_certificate_viewer (parent, ec);
 
-               gtk_widget_show (dialog);
                g_signal_connect (
                        dialog, "response",
                        G_CALLBACK (gtk_widget_destroy), NULL);
 
+               gtk_widget_show (dialog);
+
                g_object_unref (ec);
        } else {
-               g_warning (
-                       "can't find certificate for %s <%s>",
+               g_warning ("%s: Can't find certificate for %s <%s>", G_STRFUNC,
                        info->name ? info->name : "",
                        info->email ? info->email : "");
        }
 }
 
+static gboolean
+secure_button_get_raw_der (CERTCertificate *cert,
+                          gchar **data,
+                          guint32 *len)
+{
+       g_return_val_if_fail (data != NULL, FALSE);
+       g_return_val_if_fail (len != NULL, FALSE);
+
+       if (!cert || !cert->derCert.data || !cert->derCert.len)
+               return FALSE;
+
+       *data = (gchar *) cert->derCert.data;
+       *len = cert->derCert.len;
+
+       return TRUE;
+}
+
 static void
-importcert_clicked (GtkWidget *button,
-                   GtkWidget *grid)
+secure_button_import_certificate (GtkWindow *parent,
+                                 CamelCipherCertInfo *info,
+                                 EWebView *web_view,
+                                 const gchar *iframe_id,
+                                 const gchar *element_id)
 {
-       ECert *ec;
-       gchar *data = NULL;
        guint32 len = 0;
+       gchar *data = NULL;
        GError *error = NULL;
 
-       g_return_if_fail (GTK_IS_BUTTON (button));
+       g_return_if_fail (info != NULL);
 
-       ec = g_object_get_data (G_OBJECT (button), "e-cert-info");
-       g_return_if_fail (E_IS_CERT (ec));
-
-       g_warn_if_fail (e_cert_get_raw_der (ec, &data, &len));
+       g_warn_if_fail (secure_button_get_raw_der (info->cert_data, &data, &len));
 
        if (!e_cert_db_import_email_cert (e_cert_db_peek (), data, len, NULL, &error)) {
-               GtkWidget *parent;
-
-               parent = gtk_widget_get_toplevel (grid);
-               if (!GTK_IS_WINDOW (parent))
-                       parent = NULL;
-
                e_notice (parent, GTK_MESSAGE_ERROR, _("Failed to import certificate: %s"),
                        error ? error->message : _("Unknown error"));
 
                g_clear_error (&error);
        } else {
-               gtk_widget_set_sensitive (button, FALSE);
+               e_web_view_jsc_set_element_disabled (WEBKIT_WEB_VIEW (web_view),
+                       iframe_id, element_id, TRUE,
+                       e_web_view_get_cancellable (web_view));
        }
 }
 
-static gboolean
-secure_button_smime_cert_exists (const gchar *email,
-                                ECert *ec)
+static CamelCipherCertInfo *
+secure_button_find_cert_info (EMailPart *part,
+                             const gchar *element_value)
 {
-       CERTCertificate *found_cert;
-       ECert *found_ec;
-       gboolean found = FALSE;
+       CamelCipherCertInfo *info = NULL;
+       GList *vlink;
+       gchar tmp[128];
 
-       if (!email || !*email)
-               return FALSE;
+       if (!element_value)
+               return NULL;
 
-       g_return_val_if_fail (E_IS_CERT (ec), FALSE);
+       /* element_value = part : validity : cert_data */
+       g_return_val_if_fail (g_snprintf (tmp, sizeof (tmp), "%p:", part) < sizeof (tmp), NULL);
 
-       found_cert = CERT_FindCertByNicknameOrEmailAddr (CERT_GetDefaultCertDB (), email);
-       if (!found_cert)
-               return FALSE;
+       if (!g_str_has_prefix (element_value, tmp))
+               return NULL;
 
-       found_ec = e_cert_new (found_cert);
-       if (!found_ec)
-               return FALSE;
+       element_value += strlen (tmp);
 
-       #define compare_nonnull(_func) (!_func (ec) || g_strcmp0 (_func (ec), _func (found_ec)) == 0)
+       for (vlink = g_queue_peek_head_link (&part->validities); vlink; vlink = g_list_next (vlink)) {
+               EMailPartValidityPair *pair = vlink->data;
 
-       if (compare_nonnull (e_cert_get_serial_number) &&
-           compare_nonnull (e_cert_get_sha1_fingerprint) &&
-           compare_nonnull (e_cert_get_md5_fingerprint)) {
-               found = TRUE;
-       }
+               if (pair) {
+                       g_return_val_if_fail (g_snprintf (tmp, sizeof (tmp), "%p:", pair->validity) < sizeof 
(tmp), NULL);
 
-       #undef compare_nonnull
+                       if (g_str_has_prefix (element_value, tmp)) {
+                               GList *ilink;
 
-       g_object_unref (found_ec);
+                               element_value += strlen (tmp);
 
-       return found;
-}
+                               for (ilink = g_queue_peek_head_link (&pair->validity->sign.signers); ilink && 
!info; ilink = g_list_next (ilink)) {
+                                       CamelCipherCertInfo *adept = ilink->data;
 
-#endif
+                                       if (adept && adept->cert_data) {
+                                               g_return_val_if_fail (g_snprintf (tmp, sizeof (tmp), "%p", 
adept->cert_data) < sizeof (tmp), NULL);
 
-static void
-info_response (GtkWidget *widget,
-               guint button,
-               gpointer user_data)
-{
-       gtk_widget_destroy (widget);
-}
+                                               if (g_strcmp0 (element_value, tmp) == 0) {
+                                                       info = adept;
+                                                       break;
+                                               }
+                                       }
+                               }
 
-static void
-add_cert_table (GtkWidget *grid,
-                GQueue *certlist,
-                gpointer user_data)
-{
-       GList *head, *link;
-       GtkTable *table;
-       gint n = 0;
-
-       table = (GtkTable *) gtk_table_new (certlist->length, 2, FALSE);
-
-       head = g_queue_peek_head_link (certlist);
-
-       for (link = head; link != NULL; link = g_list_next (link)) {
-               CamelCipherCertInfo *info = link->data;
-               gchar *la = NULL;
-               const gchar *l = NULL;
-
-               if (info->name) {
-                       if (info->email && strcmp (info->name, info->email) != 0)
-                               l = la = g_strdup_printf ("%s <%s>", info->name, info->email);
-                       else
-                               l = info->name;
-               } else {
-                       if (info->email)
-                               l = info->email;
-               }
+                               for (ilink = g_queue_peek_head_link (&pair->validity->encrypt.encrypters); 
ilink && !info; ilink = g_list_next (ilink)) {
+                                       CamelCipherCertInfo *adept = ilink->data;
 
-               if (l) {
-                       GtkWidget *w;
-#if defined (ENABLE_SMIME)
-                       ECert *ec = NULL;
-#endif
-                       w = gtk_label_new (l);
-                       gtk_misc_set_alignment ((GtkMisc *) w, 0.0, 0.5);
-                       g_free (la);
-                       gtk_table_attach (table, w, 0, 1, n, n + 1, GTK_FILL, GTK_FILL, 3, 3);
-#if defined (ENABLE_SMIME)
-                       w = gtk_button_new_with_mnemonic (_("_View Certificate"));
-                       gtk_table_attach (table, w, 1, 2, n, n + 1, 0, 0, 3, 3);
-                       g_object_set_data ((GObject *) w, "e-cert-info", info);
-                       g_signal_connect (
-                               w, "clicked",
-                               G_CALLBACK (viewcert_clicked), grid);
-
-                       if (info->cert_data)
-                               ec = e_cert_new (CERT_DupCertificate (info->cert_data));
-
-                       if (ec == NULL) {
-                               gtk_widget_set_sensitive (w, FALSE);
-                       } else {
-                               w = gtk_button_new_with_mnemonic (_("_Import Certificate"));
-                               gtk_table_attach (table, w, 2, 3, n, n + 1, 0, 0, 3, 3);
-                               g_object_set_data_full (G_OBJECT (w), "e-cert-info", ec, g_object_unref);
-                               g_signal_connect (
-                                       w, "clicked",
-                                       G_CALLBACK (importcert_clicked), grid);
-                               gtk_widget_set_sensitive (w, !secure_button_smime_cert_exists (info->email, 
ec));
+                                       if (adept && adept->cert_data) {
+                                               g_return_val_if_fail (g_snprintf (tmp, sizeof (tmp), "%p", 
adept->cert_data) < sizeof (tmp), NULL);
+
+                                               if (g_strcmp0 (element_value, tmp) == 0) {
+                                                       info = adept;
+                                                       break;
+                                               }
+                                       }
+                               }
+                               break;
                        }
-#else
-                       w = gtk_label_new (_("This certificate is not viewable"));
-                       gtk_table_attach (table, w, 1, 2, n, n + 1, 0, 0, 3, 3);
-#endif
-                       n++;
                }
        }
 
-       gtk_container_add (GTK_CONTAINER (grid), GTK_WIDGET (table));
+       return info;
 }
 
 static void
-secure_button_show_validity_dialog (EWebView *web_view,
-                                   CamelCipherValidity *validity)
+secure_button_view_certificate_clicked_cb (EWebView *web_view,
+                                          const gchar *iframe_id,
+                                          const gchar *element_id,
+                                          const gchar *element_class,
+                                          const gchar *element_value,
+                                          const GtkAllocation *element_position,
+                                          gpointer user_data)
 {
-       GtkBuilder *builder;
-       GtkWidget *grid, *w;
-       GtkWidget *dialog;
-
-       g_return_if_fail (validity != NULL);
-
-       /* Make sure our custom widget classes are registered with
-        * GType before we load the GtkBuilder definition file. */
-       g_type_ensure (E_TYPE_DATE_EDIT);
-
-       builder = gtk_builder_new ();
-       e_load_ui_builder_definition (builder, "mail-dialogs.ui");
-
-       dialog = e_builder_get_widget (builder, "message_security_dialog");
-
-       w = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
-       if (GTK_IS_WINDOW (w))
-               gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (w));
-
-       grid = e_builder_get_widget (builder, "signature_grid");
-       w = gtk_label_new (e_mail_formatter_secure_button_get_sign_description (validity->sign.status));
-       gtk_misc_set_alignment ((GtkMisc *) w, 0.0, 0.5);
-       gtk_label_set_line_wrap ((GtkLabel *) w, TRUE);
-       gtk_label_set_width_chars (GTK_LABEL (w), 80);
-       gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
-       gtk_container_add (GTK_CONTAINER (grid), w);
-       if (validity->sign.description) {
-               GtkTextBuffer *buffer;
-
-               buffer = gtk_text_buffer_new (NULL);
-               gtk_text_buffer_set_text (
-                       buffer, validity->sign.description,
-                       strlen (validity->sign.description));
-               w = g_object_new (
-                       gtk_scrolled_window_get_type (),
-                       "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                       "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                       "shadow_type", GTK_SHADOW_IN,
-                       "expand", TRUE,
-                       "child", g_object_new (gtk_text_view_get_type (),
-                       "buffer", buffer,
-                       "cursor_visible", FALSE,
-                       "editable", FALSE,
-                       NULL),
-                       "width_request", 500,
-                       "height_request", 80,
-                       NULL);
-               g_object_unref (buffer);
-
-               gtk_container_add (GTK_CONTAINER (grid), w);
-       }
+       EMailPart *mail_part = user_data;
+       CamelCipherCertInfo *info;
+
+       g_return_if_fail (E_IS_MAIL_PART_SECURE_BUTTON (mail_part));
+
+       if (!element_value)
+               return;
+
+       info = secure_button_find_cert_info (mail_part, element_value);
+
+       if (info) {
+               GtkWidget *toplevel;
 
-       if (!g_queue_is_empty (&validity->sign.signers))
-               add_cert_table (grid, &validity->sign.signers, NULL);
-
-       gtk_widget_show_all (grid);
-
-       grid = e_builder_get_widget (builder, "encryption_grid");
-       w = gtk_label_new (e_mail_formatter_secure_button_get_encrypt_description (validity->encrypt.status));
-       gtk_misc_set_alignment ((GtkMisc *) w, 0.0, 0.5);
-       gtk_label_set_line_wrap ((GtkLabel *) w, TRUE);
-       gtk_label_set_width_chars (GTK_LABEL (w), 80);
-       gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
-       gtk_container_add (GTK_CONTAINER (grid), w);
-       if (validity->encrypt.description) {
-               GtkTextBuffer *buffer;
-
-               buffer = gtk_text_buffer_new (NULL);
-               gtk_text_buffer_set_text (
-                       buffer, validity->encrypt.description,
-                       strlen (validity->encrypt.description));
-               w = g_object_new (
-                       gtk_scrolled_window_get_type (),
-                       "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                       "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                       "shadow_type", GTK_SHADOW_IN,
-                       "expand", TRUE,
-                       "child", g_object_new (gtk_text_view_get_type (),
-                       "buffer", buffer,
-                       "cursor_visible", FALSE,
-                       "editable", FALSE,
-                       NULL),
-                       "width_request", 500,
-                       "height_request", 80,
-                       NULL);
-               g_object_unref (buffer);
-
-               gtk_container_add (GTK_CONTAINER (grid), w);
+               toplevel = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
+
+               secure_button_view_certificate (GTK_IS_WINDOW (toplevel) ? GTK_WINDOW (toplevel) : NULL, 
info);
        }
+}
 
-       if (!g_queue_is_empty (&validity->encrypt.encrypters))
-               add_cert_table (grid, &validity->encrypt.encrypters, NULL);
+static void
+secure_button_import_certificate_clicked_cb (EWebView *web_view,
+                                            const gchar *iframe_id,
+                                            const gchar *element_id,
+                                            const gchar *element_class,
+                                            const gchar *element_value,
+                                            const GtkAllocation *element_position,
+                                            gpointer user_data)
+{
+       EMailPart *mail_part = user_data;
+       CamelCipherCertInfo *info;
 
-       gtk_widget_show_all (grid);
+       g_return_if_fail (E_IS_MAIL_PART_SECURE_BUTTON (mail_part));
 
-       g_object_unref (builder);
+       if (!element_value)
+               return;
 
-       g_signal_connect (
-               dialog, "response",
-               G_CALLBACK (info_response), NULL);
+       info = secure_button_find_cert_info (mail_part, element_value);
 
-       gtk_widget_show (dialog);
+       if (info) {
+               GtkWidget *toplevel;
+
+               toplevel = gtk_widget_get_toplevel (GTK_WIDGET (web_view));
+
+               secure_button_import_certificate (GTK_IS_WINDOW (toplevel) ? GTK_WINDOW (toplevel) : NULL, 
info, web_view, iframe_id, element_id);
+       }
 }
 
+#endif
+
 static void
 secure_button_clicked_cb (EWebView *web_view,
                          const gchar *iframe_id,
@@ -332,39 +235,81 @@ secure_button_clicked_cb (EWebView *web_view,
                          gpointer user_data)
 {
        EMailPart *mail_part = user_data;
-       GList *head, *link;
-       gboolean can_use;
-       gchar *tmp;
+       GList *link;
+       gchar tmp[128];
 
        g_return_if_fail (E_IS_MAIL_PART_SECURE_BUTTON (mail_part));
 
-       tmp = g_strdup_printf ("%p:", mail_part);
-       can_use = element_value && g_str_has_prefix (element_value, tmp);
-       if (can_use)
-               element_value += strlen (tmp);
-       g_free (tmp);
+       if (!element_value)
+               return;
+
+       g_return_if_fail (g_snprintf (tmp, sizeof (tmp), "%p:", mail_part) < sizeof (tmp));
 
-       if (!can_use)
+       if (!g_str_has_prefix (element_value, tmp))
                return;
 
-       head = g_queue_peek_head_link (&mail_part->validities);
-       for (link = head; link != NULL; link = g_list_next (link)) {
+       element_value += strlen (tmp);
+
+       for (link = g_queue_peek_head_link (&mail_part->validities); link != NULL; link = g_list_next (link)) 
{
                EMailPartValidityPair *pair = link->data;
 
                if (!pair)
                        continue;
 
-               tmp = g_strdup_printf ("%p", pair->validity);
-               can_use = g_strcmp0 (element_value, tmp) == 0;
-               g_free (tmp);
+               g_return_if_fail (g_snprintf (tmp, sizeof (tmp), "%p", pair->validity) < sizeof (tmp));
+
+               if (g_strcmp0 (element_value, tmp) == 0) {
+                       g_return_if_fail (g_snprintf (tmp, sizeof (tmp), "secure-button-details-%p", 
pair->validity) < sizeof (tmp));
 
-               if (can_use) {
-                       secure_button_show_validity_dialog (web_view, pair->validity);
+                       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable 
(web_view),
+                               "var elem = Evo.FindElement(%s, %s);\n"
+                               "if (elem) {\n"
+                               "       elem.hidden = !elem.hidden;\n"
+                               "}\n",
+                               iframe_id, tmp);
                        break;
                }
        }
 }
 
+static void
+secure_button_details_clicked_cb (EWebView *web_view,
+                                 const gchar *iframe_id,
+                                 const gchar *element_id,
+                                 const gchar *element_class,
+                                 const gchar *element_value,
+                                 const GtkAllocation *element_position,
+                                 gpointer user_data)
+{
+       EMailPart *mail_part = user_data;
+       gchar tmp[128];
+
+       g_return_if_fail (E_IS_MAIL_PART_SECURE_BUTTON (mail_part));
+
+       if (!element_id || !element_value)
+               return;
+
+       g_return_if_fail (g_snprintf (tmp, sizeof (tmp), "%p:", mail_part) < sizeof (tmp));
+
+       if (g_str_has_prefix (element_id, tmp)) {
+               g_return_if_fail (g_snprintf (tmp, sizeof (tmp), "%s-img", element_value) < sizeof (tmp));
+
+               e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+                       "var elem = Evo.FindElement(%s, %s);\n"
+                       "if (elem) {\n"
+                       "       elem.hidden = !elem.hidden;\n"
+                       "}\n"
+                       "elem = Evo.FindElement(%s, %s);\n"
+                       "if (elem) {\n"
+                       "       var tmp = elem.src;\n"
+                       "       elem.src = elem.getAttribute(\"othersrc\");\n"
+                       "       elem.setAttribute(\"othersrc\", tmp);\n"
+                       "}\n",
+                       iframe_id, element_value,
+                       iframe_id, tmp);
+       }
+}
+
 static void
 mail_part_secure_button_content_loaded (EMailPart *mail_part,
                                        EWebView *web_view)
@@ -373,6 +318,12 @@ mail_part_secure_button_content_loaded (EMailPart *mail_part,
        g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
        e_web_view_register_element_clicked (web_view, "secure-button", secure_button_clicked_cb, mail_part);
+       e_web_view_register_element_clicked (web_view, "secure-button-details", 
secure_button_details_clicked_cb, mail_part);
+
+#if defined (ENABLE_SMIME)
+       e_web_view_register_element_clicked (web_view, "secure-button-view-certificate", 
secure_button_view_certificate_clicked_cb, mail_part);
+       e_web_view_register_element_clicked (web_view, "secure-button-import-certificate", 
secure_button_import_certificate_clicked_cb, mail_part);
+#endif
 }
 
 static void
diff --git a/src/mail/mail-dialogs.ui b/src/mail/mail-dialogs.ui
index 2753424f06..57776a1e04 100644
--- a/src/mail/mail-dialogs.ui
+++ b/src/mail/mail-dialogs.ui
@@ -318,195 +318,4 @@ Please select a follow up action from the “Flag” menu.</property>
       <action-widget response="-3">lic_yes_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkDialog" id="message_security_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">6</property>
-    <property name="title" translatable="yes">Security Information</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="okbutton1">
-                <property name="label" translatable="yes">_OK</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkVBox" id="vbox161">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">12</property>
-            <property name="spacing">18</property>
-            <child>
-              <object class="GtkVBox" id="frame5">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label464">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Digital Signature</property>
-                    <property name="xalign">0</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkGrid" id="signature_grid">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVBox" id="frame6">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label477">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Encryption</property>
-                    <property name="xalign">0</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkGrid" id="encryption_grid">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-5">okbutton1</action-widget>
-    </action-widgets>
-  </object>
 </interface>


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