[evolution/wip/mcrha/webkit-jsc-api: 254/292] Implement HRule dialog code and add related stuff for the editor dialogs



commit 28e10d7ae2f3fed5bb64de046a1815c0ba2719b9
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 9 17:58:51 2019 +0100

    Implement HRule dialog code and add related stuff for the editor dialogs

 data/webkit/e-editor.js                       | 194 +++++++++-
 data/webkit/e-undo-redo.js                    |   2 +-
 src/e-util/CMakeLists.txt                     |   1 +
 src/e-util/e-content-editor.c                 | 264 ++------------
 src/e-util/e-content-editor.h                 | 113 ++----
 src/e-util/e-html-editor-actions.c            |   2 +-
 src/e-util/e-html-editor-cell-dialog.c        |   4 +-
 src/e-util/e-html-editor-find-dialog.c        |   4 +-
 src/e-util/e-html-editor-hrule-dialog.c       |  34 +-
 src/e-util/e-html-editor-image-dialog.c       |   4 +-
 src/e-util/e-html-editor-link-dialog.c        |  17 +-
 src/e-util/e-html-editor-page-dialog.c        |   6 +-
 src/e-util/e-html-editor-private.h            |   2 +-
 src/e-util/e-html-editor-replace-dialog.c     |   4 +-
 src/e-util/e-html-editor-spell-check-dialog.c |   4 +-
 src/e-util/e-html-editor-table-dialog.c       |   9 +-
 src/e-util/e-html-editor.c                    |   4 +-
 src/e-util/test-html-editor-units.c           |   2 +
 src/e-util/test-html-editor.c                 |   2 +
 src/modules/webkit-editor/e-webkit-editor.c   | 487 +++++++++-----------------
 20 files changed, 438 insertions(+), 721 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 693adb0927..8dd30e4331 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -88,6 +88,7 @@ var EvoEditor = {
        mode : 1, // one of the MODE constants
        storedSelection : null,
        propertiesSelection : null, // dedicated to Properties dialogs
+       contextMenuNode : null, // the last target node for context menu
        inheritThemeColors : false,
        checkInheritFontsOnChange : false,
        forceFormatStateUpdate : false,
@@ -2277,6 +2278,8 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
                                        EvoSelection.Restore(document, selection);
                                } finally {
                                        EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "magicLink");
+                                       EvoEditor.maybeUpdateFormattingState(EvoEditor.FORCE_MAYBE);
+                                       EvoEditor.EmitContentChanged();
                                }
                        }
                }
@@ -2325,17 +2328,186 @@ EvoEditor.restorePropertiesSelection = function()
        }
 }
 
-EvoEditor.OnPropertiesOpen = function()
+EvoEditor.OnDialogOpen = function(name)
 {
-       EvoEditor.storePropertiesSelection();
+       EvoEditor.propertiesSelection = null;
+
+       var node = document.getElementById("x-evo-dialog-current-element");
+       while (node) {
+               node.removeAttribute("id");
+               node = document.getElementById("x-evo-dialog-current-element");
+       }
+
+       if (name == "link" || name == "cell" || name == "page") {
+               EvoEditor.storePropertiesSelection();
+
+               if (name == "cell") {
+                       var tdnode, tdnode;
+
+                       tdnode = (EvoEditor.contextMenuNode && EvoEditor.contextMenuNode.tagName == "TD") ? 
EvoEditor.contextMenuNode : EvoEditor.getCaretElement("TD");
+                       thnode = (EvoEditor.contextMenuNode && EvoEditor.contextMenuNode.tagName == "TH") ? 
EvoEditor.contextMenuNode : EvoEditor.getCaretElement("TH");
+
+                       if (tdnode === EvoEditor.contextMenuNode) {
+                               node = tdnode;
+                       } else if (thnode === EvoEditor.contextMenuNode) {
+                               node = thnode;
+                       } else if (tdnode && thnode) {
+                               for (node = thnode; node; node = node.parentElement) {
+                                       if (node === tdnode) {
+                                               // TH is a child of TD
+                                               node = thnode;
+                                               break;
+                                       }
+                               }
+
+                               if (!node)
+                                       node = tdnode;
+                       } else {
+                               node = tdnode ? tdnode : thnode;
+                       }
+
+                       if (node)
+                               node.id = "x-evo-dialog-current-element";
+               }
+
+               if (name == "cell" || name == "page")
+                       EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_GROUP, "Dialog::" + name);
+       } else if (name == "hrule" || name == "image" || name == "table") {
+               node = null;
+
+               EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_GROUP, "Dialog::" + name);
+
+               if (name == "hrule") {
+                       node = (EvoEditor.contextMenuNode && EvoEditor.contextMenuNode.tagName == "HR") ? 
EvoEditor.contextMenuNode : EvoEditor.getCaretElement("HR");
+               } else if (name == "image") {
+                       node = (EvoEditor.contextMenuNode && EvoEditor.contextMenuNode.tagName == "IMG") ? 
EvoEditor.contextMenuNode : EvoEditor.getCaretElement("IMG");
+               } else if (name == "table") {
+                       node = (EvoEditor.contextMenuNode && EvoEditor.contextMenuNode.tagName == "TABLE") ? 
EvoEditor.contextMenuNode : EvoEditor.getCaretElement("TABLE");
+               }
+
+               if (node) {
+                       node.id = "x-evo-dialog-current-element";
+               } else {
+                       if (name == "hrule")
+                               EvoEditor.InsertHTML("CreateHRule", "<HR 
id=\"x-evo-dialog-current-element\">");
+                       else if (name == "image")
+                               EvoEditor.InsertHTML("CreateImage", "<IMG 
id=\"x-evo-dialog-current-element\">");
+                       else if (name == "table")
+                               EvoEditor.InsertHTML("CreateTable", "<TABLE 
id=\"x-evo-dialog-current-element\"></TABLE>");
+               }
+       }
+
+       node = document.getElementById("x-evo-dialog-current-element");
+
+       if (node) {
+               node.removeAttribute("id"); // to not store it in the Undo/Redo record
+
+               EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_EVENT, "Dialog::" + name + "::event", node, 
node,
+                       EvoEditor.CLAIM_CONTENT_FLAG_SAVE_HTML);
+               EvoUndoRedo.Disable();
+
+               node.id = "x-evo-dialog-current-element";
+       }
 }
 
-EvoEditor.OnPropertiesClose = function()
+EvoEditor.OnDialogClose = function(name)
 {
-       EvoEditor.restorePropertiesSelection();
+       if (name == "link" || name == "cell")
+               EvoEditor.restorePropertiesSelection();
+       else
+               EvoEditor.propertiesSelection = null;
+
+       EvoEditor.contextMenuNode = null;
+
+       var node = document.getElementById("x-evo-dialog-current-element");
+
+       if (node) {
+               node.removeAttribute("id"); // to not store it in the Undo/Redo record
+
+               EvoUndoRedo.Enable();
+               EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_EVENT, "Dialog::" + name + "::event");
+       }
+
+       if (name == "hrule" || name == "image" || name == "table" || name == "cell" || name == "page")
+               EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_GROUP, "Dialog::" + name);
+
+       node = document.getElementById("x-evo-dialog-current-element");
+       while (node) {
+               node.removeAttribute("id");
+               node = document.getElementById("x-evo-dialog-current-element");
+       }
+}
+
+EvoEditor.applyDialogUtilsSetAttribute = function(record, isUndo)
+{
+       var element = EvoSelection.FindElementByPath(document.body, record.path);
+
+       if (!element)
+               throw "EvoEditor.applyDialogUtilsSetAttribute: Path not found";
+
+       var value;
+
+       if (isUndo)
+               value = record.beforeValue;
+       else
+               value = record.afterValue;
+
+       if (value == null)
+               element.removeAttribute(record.attrName);
+       else
+               element.setAttribute(record.attrName, value);
+}
+
+// 'value' can be 'null', to remove the attribute
+EvoEditor.DialogUtilsSetAttribute = function(name, value)
+{
+       var element = document.getElementById("x-evo-dialog-current-element");
+
+       if (element) {
+               var record = EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "DlgUtilSetAttribute::" 
+ name, element, element, EvoEditor.CLAIM_CONTENT_FLAG_NONE);
+
+               try {
+                       if (record) {
+                               record.path = EvoSelection.GetChildPath(document.body, element);
+                               record.attrName = name;
+                               record.beforeValue = element.hasAttribute(name) ? element.getAttribute(name) 
: null;
+                               record.afterValue = value;
+                               record.apply = EvoEditor.applyDialogUtilsSetAttribute;
+                       }
+
+                       if (value != null) {
+                               element.setAttribute(name, value);
+                       } else {
+                               element.removeAttribute(name);
+                       }
+
+                       if (record && record.beforeValue == record.afterValue) {
+                               record.ignore = true;
+                       }
+               } finally {
+                       EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "DlgUtilSetAttribute::" + 
name);
+               }
+       }
+}
+
+EvoEditor.DialogUtilsGetAttribute = function(name)
+{
+       var element = document.getElementById("x-evo-dialog-current-element");
+
+       if (element && element.hasAttribute(name))
+               return element.getAttribute(name);
+
+       return null;
+}
+
+EvoEditor.DialogUtilsHasAttribute = function(name)
+{
+       var element = document.getElementById("x-evo-dialog-current-element");
+
+       return element && element.hasAttribute(name);
 }
 
-EvoEditor.GetLinkValues = function()
+EvoEditor.LinkGetProperties = function()
 {
        var res = null, anchor = EvoEditor.getCaretElement("A");
 
@@ -2357,7 +2529,7 @@ EvoEditor.GetLinkValues = function()
        return res;
 }
 
-EvoEditor.SetLinkValues = function(href, text)
+EvoEditor.LinkSetProperties = function(href, text)
 {
        // The properties dialog can discard selection, thus restore it before doing changes
        EvoEditor.restorePropertiesSelection();
@@ -2376,6 +2548,8 @@ EvoEditor.SetLinkValues = function(href, text)
                        }
                } finally {
                        EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "SetLinkValues");
+                       EvoEditor.maybeUpdateFormattingState(EvoEditor.FORCE_MAYBE);
+                       EvoEditor.EmitContentChanged();
                }
        } else if (!anchor && href != "" && text != "") {
                text = text.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -2410,6 +2584,8 @@ EvoEditor.Unlink = function()
                        selectionUpdater.restore();
                } finally {
                        EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "Unlink");
+                       EvoEditor.maybeUpdateFormattingState(EvoEditor.FORCE_MAYBE);
+                       EvoEditor.EmitContentChanged();
                }
        }
 }
@@ -2439,7 +2615,9 @@ EvoEditor.onContextMenu = function(event)
        if (!node)
                node = document.getSelection().baseNode;
 
-       var nodeFlags = EvoEditor.E_CONTENT_EDITOR_NODE_UNKNOWN, hasNode = node, res;
+       EvoEditor.contextMenuNode = node;
+
+       var nodeFlags = EvoEditor.E_CONTENT_EDITOR_NODE_UNKNOWN, res;
 
        while (node) {
                if (node.tagName == "A")
@@ -2456,7 +2634,7 @@ EvoEditor.onContextMenu = function(event)
                node = node.parentElement;
        }
 
-       if (!nodeFlags && hasNode)
+       if (!nodeFlags && EvoEditor.contextMenuNode)
                nodeFlags |= EvoEditor.E_CONTENT_EDITOR_NODE_IS_TEXT;
 
        if (document.getSelection().isCollapsed)
diff --git a/data/webkit/e-undo-redo.js b/data/webkit/e-undo-redo.js
index e277e69cb0..d3cb238a9e 100644
--- a/data/webkit/e-undo-redo.js
+++ b/data/webkit/e-undo-redo.js
@@ -588,7 +588,7 @@ EvoUndoRedo.StopRecord = function(kind, opType)
        }
 
        if (!EvoUndoRedo.ongoingRecordings.length) {
-               throw "EvoUndoRedo:StopRecord: Nothing is recorded";
+               throw "EvoUndoRedo:StopRecord: Nothing is recorded for kind:" + kind + " opType:'" + opType + 
"'";
        }
 
        var record = EvoUndoRedo.ongoingRecordings[EvoUndoRedo.ongoingRecordings.length - 1];
diff --git a/src/e-util/CMakeLists.txt b/src/e-util/CMakeLists.txt
index 62d8f48ed5..6551eb26a7 100644
--- a/src/e-util/CMakeLists.txt
+++ b/src/e-util/CMakeLists.txt
@@ -748,6 +748,7 @@ macro(add_private_program _name _sources)
 
        target_compile_definitions(${_name} PRIVATE
                -DG_LOG_DOMAIN=\"${_name}\"
+               -DEVOLUTION_ICONDIR=\"${icondir}\"
                -DEVOLUTION_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
                -DEVOLUTION_MODULEDIR=\"${moduledir}\"
                -DEVOLUTION_TESTGIOMODULESDIR=\"${CMAKE_CURRENT_BINARY_DIR}/test-gio-modules\"
diff --git a/src/e-util/e-content-editor.c b/src/e-util/e-content-editor.c
index 08706662a9..698f39b39b 100644
--- a/src/e-util/e-content-editor.c
+++ b/src/e-util/e-content-editor.c
@@ -2579,22 +2579,24 @@ e_content_editor_insert_row_below (EContentEditor *editor)
        iface->insert_row_below (editor);
 }
 
-gboolean
-e_content_editor_on_h_rule_dialog_open (EContentEditor *editor)
+void
+e_content_editor_on_dialog_open (EContentEditor *editor,
+                                const gchar *name)
 {
        EContentEditorInterface *iface;
 
-       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
+       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
 
        iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_val_if_fail (iface != NULL, FALSE);
-       g_return_val_if_fail (iface->on_h_rule_dialog_open != NULL, FALSE);
+       g_return_if_fail (iface != NULL);
+       g_return_if_fail (iface->on_dialog_open != NULL);
 
-       return iface->on_h_rule_dialog_open (editor);
+       iface->on_dialog_open (editor, name);
 }
 
 void
-e_content_editor_on_h_rule_dialog_close (EContentEditor *editor)
+e_content_editor_on_dialog_close (EContentEditor *editor,
+                                 const gchar *name)
 {
        EContentEditorInterface *iface;
 
@@ -2602,9 +2604,9 @@ e_content_editor_on_h_rule_dialog_close (EContentEditor *editor)
 
        iface = E_CONTENT_EDITOR_GET_IFACE (editor);
        g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_h_rule_dialog_close != NULL);
+       g_return_if_fail (iface->on_dialog_close != NULL);
 
-       iface->on_h_rule_dialog_close (editor);
+       iface->on_dialog_close (editor, name);
 }
 
 void
@@ -2726,34 +2728,6 @@ e_content_editor_h_rule_get_no_shade (EContentEditor *editor)
        return iface->h_rule_get_no_shade (editor);
 }
 
-void
-e_content_editor_on_image_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_image_dialog_open != NULL);
-
-       iface->on_image_dialog_open (editor);
-}
-
-void
-e_content_editor_on_image_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_image_dialog_close != NULL);
-
-       iface->on_image_dialog_close (editor);
-}
-
 void
 e_content_editor_image_set_width_follow (EContentEditor *editor,
                                          gboolean value)
@@ -3076,7 +3050,9 @@ e_content_editor_image_set_height_follow (EContentEditor *editor,
 }
 
 void
-e_content_editor_on_link_dialog_open (EContentEditor *editor)
+e_content_editor_link_get_properties (EContentEditor *editor,
+                                     gchar **href,
+                                     gchar **text)
 {
        EContentEditorInterface *iface;
 
@@ -3084,13 +3060,15 @@ e_content_editor_on_link_dialog_open (EContentEditor *editor)
 
        iface = E_CONTENT_EDITOR_GET_IFACE (editor);
        g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_link_dialog_open != NULL);
+       g_return_if_fail (iface->link_get_properties != NULL);
 
-       iface->on_link_dialog_open (editor);
+       iface->link_get_properties (editor, href, text);
 }
 
 void
-e_content_editor_on_link_dialog_close (EContentEditor *editor)
+e_content_editor_link_set_properties (EContentEditor *editor,
+                                     const gchar *href,
+                                     const gchar *text)
 {
        EContentEditorInterface *iface;
 
@@ -3098,69 +3076,9 @@ e_content_editor_on_link_dialog_close (EContentEditor *editor)
 
        iface = E_CONTENT_EDITOR_GET_IFACE (editor);
        g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_link_dialog_close != NULL);
+       g_return_if_fail (iface->link_set_properties != NULL);
 
-       iface->on_link_dialog_close (editor);
-}
-
-void
-e_content_editor_link_get_values (EContentEditor *editor,
-                                  gchar **href,
-                                  gchar **text)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->link_get_values != NULL);
-
-       return iface->link_get_values (editor, href, text);
-}
-
-void
-e_content_editor_link_set_values (EContentEditor *editor,
-                                  const gchar *href,
-                                  const gchar *text)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->link_set_values != NULL);
-
-       iface->link_set_values (editor, href, text);
-}
-
-void
-e_content_editor_on_page_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_page_dialog_open != NULL);
-
-       iface->on_page_dialog_open (editor);
-}
-
-void
-e_content_editor_on_page_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_page_dialog_close != NULL);
-
-       iface->on_page_dialog_close (editor);
+       iface->link_set_properties (editor, href, text);
 }
 
 void
@@ -3350,34 +3268,6 @@ e_content_editor_page_get_background_image_uri (EContentEditor *editor)
        return iface->page_get_background_image_uri (editor);
 }
 
-void
-e_content_editor_on_cell_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_cell_dialog_open != NULL);
-
-       iface->on_cell_dialog_open (editor);
-}
-
-void
-e_content_editor_on_cell_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_cell_dialog_close != NULL);
-
-       iface->on_cell_dialog_close (editor);
-}
-
 void
 e_content_editor_cell_set_v_align (EContentEditor *editor,
                                    const gchar *value,
@@ -3919,62 +3809,6 @@ e_content_editor_table_set_background_color (EContentEditor *editor,
        iface->table_set_background_color (editor, value);
 }
 
-gboolean
-e_content_editor_on_table_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_val_if_fail (iface != NULL, FALSE);
-       g_return_val_if_fail (iface->on_table_dialog_open != NULL, FALSE);
-
-       return iface->on_table_dialog_open (editor);
-}
-
-void
-e_content_editor_on_table_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_table_dialog_close != NULL);
-
-       iface->on_table_dialog_close (editor);
-}
-
-void
-e_content_editor_on_spell_check_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_spell_check_dialog_close != NULL);
-
-       iface->on_spell_check_dialog_close (editor);
-}
-
-void
-e_content_editor_on_spell_check_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_spell_check_dialog_close != NULL);
-
-       iface->on_spell_check_dialog_close (editor);
-}
-
 gchar *
 e_content_editor_spell_check_next_word (EContentEditor *editor,
                                         const gchar *word)
@@ -4005,62 +3839,6 @@ e_content_editor_spell_check_prev_word (EContentEditor *editor,
        return iface->spell_check_prev_word (editor, word);
 }
 
-void
-e_content_editor_on_replace_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_replace_dialog_open != NULL);
-
-       iface->on_replace_dialog_open (editor);
-}
-
-void
-e_content_editor_on_replace_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_replace_dialog_close != NULL);
-
-       iface->on_replace_dialog_close (editor);
-}
-
-void
-e_content_editor_on_find_dialog_open (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_find_dialog_open != NULL);
-
-       iface->on_find_dialog_open (editor);
-}
-
-void
-e_content_editor_on_find_dialog_close (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->on_find_dialog_close != NULL);
-
-       iface->on_find_dialog_close (editor);
-}
-
 void
 e_content_editor_resource_loaded (EContentEditor *editor,
                                  const gchar *uri,
diff --git a/src/e-util/e-content-editor.h b/src/e-util/e-content-editor.h
index 548315ed73..ea68ef4ed5 100644
--- a/src/e-util/e-content-editor.h
+++ b/src/e-util/e-content-editor.h
@@ -33,6 +33,16 @@
 
 #define DEFAULT_CONTENT_EDITOR_NAME "WebKit"
 
+#define E_CONTENT_EDITOR_DIALOG_HRULE          "hrule"
+#define E_CONTENT_EDITOR_DIALOG_IMAGE          "image"
+#define E_CONTENT_EDITOR_DIALOG_LINK           "link"
+#define E_CONTENT_EDITOR_DIALOG_PAGE           "page"
+#define E_CONTENT_EDITOR_DIALOG_CELL           "cell"
+#define E_CONTENT_EDITOR_DIALOG_TABLE          "table"
+#define E_CONTENT_EDITOR_DIALOG_SPELLCHECK     "spellcheck"
+#define E_CONTENT_EDITOR_DIALOG_FIND           "find"
+#define E_CONTENT_EDITOR_DIALOG_REPLACE                "replace"
+
 G_BEGIN_DECLS
 
 struct _EHTMLEditor;
@@ -171,9 +181,11 @@ struct _EContentEditorInterface {
 
        void            (*insert_row_below)             (EContentEditor *editor);
 
-       gboolean        (*on_h_rule_dialog_open)        (EContentEditor *editor);
+       void            (*on_dialog_open)               (EContentEditor *editor,
+                                                        const gchar *name);
 
-       void            (*on_h_rule_dialog_close)       (EContentEditor *editor);
+       void            (*on_dialog_close)              (EContentEditor *editor,
+                                                        const gchar *name);
 
        void            (*h_rule_set_align)             (EContentEditor *editor,
                                                         const gchar *value);
@@ -197,10 +209,6 @@ struct _EContentEditorInterface {
 
        gboolean        (*h_rule_get_no_shade)          (EContentEditor *editor);
 
-       void            (*on_image_dialog_open)         (EContentEditor *editor);
-
-       void            (*on_image_dialog_close)        (EContentEditor *editor);
-
        void            (*image_set_src)                (EContentEditor *editor,
                                                         const gchar *value);
 
@@ -256,22 +264,14 @@ struct _EContentEditorInterface {
 
        gchar *         (*image_get_align)              (EContentEditor *editor);
 
-       void            (*on_link_dialog_open)          (EContentEditor *editor);
-
-       void            (*on_link_dialog_close)         (EContentEditor *editor);
-
-       void            (*link_get_values)              (EContentEditor *editor,
+       void            (*link_get_properties)          (EContentEditor *editor,
                                                         gchar **href,
                                                         gchar **text);
 
-       void            (*link_set_values)              (EContentEditor *editor,
+       void            (*link_set_properties)          (EContentEditor *editor,
                                                         const gchar *href,
                                                         const gchar *text);
 
-       void            (*on_page_dialog_open)          (EContentEditor *editor);
-
-       void            (*on_page_dialog_close)         (EContentEditor *editor);
-
        void            (*page_set_text_color)          (EContentEditor *editor,
                                                         const GdkRGBA *value);
 
@@ -306,10 +306,6 @@ struct _EContentEditorInterface {
        gchar *         (*page_get_background_image_uri)
                                                        (EContentEditor *editor);
 
-       void            (*on_cell_dialog_open)          (EContentEditor *editor);
-
-       void            (*on_cell_dialog_close)         (EContentEditor *editor);
-
        void            (*cell_set_v_align)             (EContentEditor *editor,
                                                         const gchar *value,
                                                         EContentEditorScope scope);
@@ -418,28 +414,12 @@ struct _EContentEditorInterface {
        void            (*table_set_background_color)   (EContentEditor *editor,
                                                         const GdkRGBA *value);
 
-       gboolean        (*on_table_dialog_open)         (EContentEditor *editor);
-
-       void            (*on_table_dialog_close)        (EContentEditor *editor);
-
-       void            (*on_spell_check_dialog_open)   (EContentEditor *editor);
-
-       void            (*on_spell_check_dialog_close)  (EContentEditor *editor);
-
        gchar *         (*spell_check_next_word)        (EContentEditor *editor,
                                                         const gchar *word);
 
        gchar *         (*spell_check_prev_word)        (EContentEditor *editor,
                                                         const gchar *word);
 
-       void            (*on_replace_dialog_open)       (EContentEditor *editor);
-
-       void            (*on_replace_dialog_close)      (EContentEditor *editor);
-
-       void            (*on_find_dialog_open)          (EContentEditor *editor);
-
-       void            (*on_find_dialog_close)         (EContentEditor *editor);
-
        void            (*resource_loaded)              (EContentEditor *editor,
                                                         const gchar *uri,
                                                         GInputStream *stream,
@@ -730,11 +710,10 @@ void              e_content_editor_insert_row_above
 void           e_content_editor_insert_row_below
                                                (EContentEditor *editor);
 
-gboolean       e_content_editor_on_h_rule_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_h_rule_dialog_close
-                                               (EContentEditor *editor);
+void           e_content_editor_on_dialog_open (EContentEditor *editor,
+                                                const gchar *name);
+void           e_content_editor_on_dialog_close(EContentEditor *editor,
+                                                const gchar *name);
 
 void           e_content_editor_h_rule_set_align
                                                (EContentEditor *editor,
@@ -766,12 +745,6 @@ void               e_content_editor_h_rule_set_no_shade
 gboolean       e_content_editor_h_rule_get_no_shade
                                                (EContentEditor *editor);
 
-void           e_content_editor_on_image_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_image_dialog_close
-                                               (EContentEditor *editor);
-
 void           e_content_editor_image_set_src  (EContentEditor *editor,
                                                 const gchar *value);
 
@@ -842,18 +815,12 @@ void              e_content_editor_image_set_height_follow
                                                (EContentEditor *editor,
                                                 gboolean value);
 
-void           e_content_editor_on_link_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_link_dialog_close
-                                               (EContentEditor *editor);
-
-void           e_content_editor_link_get_values
+void           e_content_editor_link_get_properties
                                                (EContentEditor *editor,
                                                 gchar **href,
                                                 gchar **text);
 
-void           e_content_editor_link_set_values
+void           e_content_editor_link_set_properties
                                                (EContentEditor *editor,
                                                 const gchar *href,
                                                 const gchar *text);
@@ -862,12 +829,6 @@ void               e_content_editor_page_set_text_color
                                                (EContentEditor *editor,
                                                 const GdkRGBA *value);
 
-void           e_content_editor_on_page_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_page_dialog_close
-                                               (EContentEditor *editor);
-
 void           e_content_editor_page_get_text_color
                                                (EContentEditor *editor,
                                                 GdkRGBA *value);
@@ -909,12 +870,6 @@ void               e_content_editor_page_set_background_image_uri
 gchar *                e_content_editor_page_get_background_image_uri
                                                (EContentEditor *editor);
 
-void           e_content_editor_on_cell_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_cell_dialog_close
-                                               (EContentEditor *editor);
-
 void           e_content_editor_cell_set_v_align
                                                (EContentEditor *editor,
                                                 const gchar *value,
@@ -1048,18 +1003,6 @@ void             e_content_editor_table_set_background_color
                                                (EContentEditor *editor,
                                                 const GdkRGBA *value);
 
-gboolean       e_content_editor_on_table_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_table_dialog_close
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_spell_check_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_spell_check_dialog_close
-                                               (EContentEditor *editor);
-
 gchar *                e_content_editor_spell_check_next_word
                                                (EContentEditor *editor,
                                                 const gchar *word);
@@ -1073,18 +1016,6 @@ void             e_content_editor_spell_check_replace_all
                                                 const gchar *word,
                                                 const gchar *replacement);
 
-void           e_content_editor_on_replace_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_replace_dialog_close
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_find_dialog_open
-                                               (EContentEditor *editor);
-
-void           e_content_editor_on_find_dialog_close
-                                               (EContentEditor *editor);
-
 void           e_content_editor_resource_loaded(EContentEditor *editor,
                                                 const gchar *uri,
                                                 GInputStream *stream,
diff --git a/src/e-util/e-html-editor-actions.c b/src/e-util/e-html-editor-actions.c
index a6628a9905..7153398303 100644
--- a/src/e-util/e-html-editor-actions.c
+++ b/src/e-util/e-html-editor-actions.c
@@ -2229,7 +2229,7 @@ e_html_editor_content_editor_font_name_to_combo_box (GBinding *binding,
 {
        gchar *id = NULL;
 
-       id = e_html_editor_until_dup_font_id (GTK_COMBO_BOX (g_binding_get_target (binding)), 
g_value_get_string (from_value));
+       id = e_html_editor_util_dup_font_id (GTK_COMBO_BOX (g_binding_get_target (binding)), 
g_value_get_string (from_value));
        g_value_take_string (to_value, id ? id : g_strdup (""));
 
        return TRUE;
diff --git a/src/e-util/e-html-editor-cell-dialog.c b/src/e-util/e-html-editor-cell-dialog.c
index 9f218e9b1f..87cad6fa62 100644
--- a/src/e-util/e-html-editor-cell-dialog.c
+++ b/src/e-util/e-html-editor-cell-dialog.c
@@ -304,7 +304,7 @@ html_editor_cell_dialog_show (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_cell_dialog_open (cnt_editor);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_CELL);
 
        gtk_toggle_button_set_active (
                GTK_TOGGLE_BUTTON (dialog->priv->scope_cell_button), TRUE);
@@ -374,7 +374,7 @@ html_editor_cell_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_cell_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_CELL);
 
        GTK_WIDGET_CLASS (e_html_editor_cell_dialog_parent_class)->hide (widget);
 }
diff --git a/src/e-util/e-html-editor-find-dialog.c b/src/e-util/e-html-editor-find-dialog.c
index 49def0b946..fe063ccc70 100644
--- a/src/e-util/e-html-editor-find-dialog.c
+++ b/src/e-util/e-html-editor-find-dialog.c
@@ -61,7 +61,7 @@ html_editor_find_dialog_hide (GtkWidget *widget)
 {
        EHTMLEditorFindDialog *dialog = E_HTML_EDITOR_FIND_DIALOG (widget);
 
-       e_content_editor_on_find_dialog_close (dialog->priv->cnt_editor);
+       e_content_editor_on_dialog_close (dialog->priv->cnt_editor, E_CONTENT_EDITOR_DIALOG_FIND);
 
        /* Chain up to parent's implementation */
        GTK_WIDGET_CLASS (e_html_editor_find_dialog_parent_class)->hide (widget);
@@ -75,7 +75,7 @@ html_editor_find_dialog_show (GtkWidget *widget)
        reset_dialog (dialog);
        gtk_widget_grab_focus (dialog->priv->entry);
 
-       e_content_editor_on_find_dialog_open (dialog->priv->cnt_editor);
+       e_content_editor_on_dialog_open (dialog->priv->cnt_editor, E_CONTENT_EDITOR_DIALOG_FIND);
 
        /* Chain up to parent's implementation */
        GTK_WIDGET_CLASS (e_html_editor_find_dialog_parent_class)->show (widget);
diff --git a/src/e-util/e-html-editor-hrule-dialog.c b/src/e-util/e-html-editor-hrule-dialog.c
index 342cdc1522..990196e686 100644
--- a/src/e-util/e-html-editor-hrule-dialog.c
+++ b/src/e-util/e-html-editor-hrule-dialog.c
@@ -187,7 +187,7 @@ html_editor_hrule_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_h_rule_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_HRULE);
 
        GTK_WIDGET_CLASS (e_html_editor_hrule_dialog_parent_class)->hide (widget);
 }
@@ -198,39 +198,17 @@ html_editor_hrule_dialog_show (GtkWidget *widget)
        EHTMLEditorHRuleDialog *dialog;
        EHTMLEditor *editor;
        EContentEditor *cnt_editor;
-       gboolean created_new_h_rule = FALSE;
 
        dialog = E_HTML_EDITOR_HRULE_DIALOG (widget);
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       created_new_h_rule = e_content_editor_on_h_rule_dialog_open (cnt_editor);
-
-       if (!created_new_h_rule) {
-               html_editor_hrule_dialog_get_alignment (dialog);
-               html_editor_hrule_dialog_get_size (dialog);
-               html_editor_hrule_dialog_get_width (dialog);
-               html_editor_hrule_dialog_get_shading (dialog);
-       } else {
-               /* For new rule reset the values to default */
-               gtk_spin_button_set_value (
-                       GTK_SPIN_BUTTON (dialog->priv->width_edit), 100.0);
-               gtk_combo_box_set_active_id (
-                       GTK_COMBO_BOX (dialog->priv->unit_combo), "units-percent");
-               gtk_spin_button_set_value (
-                       GTK_SPIN_BUTTON (dialog->priv->size_edit), 2.0);
-               gtk_combo_box_set_active_id (
-                       GTK_COMBO_BOX (dialog->priv->alignment_combo), "left");
-               gtk_toggle_button_set_active (
-                       GTK_TOGGLE_BUTTON (dialog->priv->shaded_check), FALSE);
-
-               html_editor_hrule_dialog_set_alignment (dialog);
-               html_editor_hrule_dialog_set_size (dialog);
-               html_editor_hrule_dialog_set_alignment (dialog);
-               html_editor_hrule_dialog_set_shading (dialog);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_HRULE);
 
-               e_content_editor_set_changed (cnt_editor, TRUE);
-       }
+       html_editor_hrule_dialog_get_alignment (dialog);
+       html_editor_hrule_dialog_get_size (dialog);
+       html_editor_hrule_dialog_get_width (dialog);
+       html_editor_hrule_dialog_get_shading (dialog);
 
        /* Chain up to parent implementation */
        GTK_WIDGET_CLASS (e_html_editor_hrule_dialog_parent_class)->show (widget);
diff --git a/src/e-util/e-html-editor-image-dialog.c b/src/e-util/e-html-editor-image-dialog.c
index aa72f7b13a..7eafa1d302 100644
--- a/src/e-util/e-html-editor-image-dialog.c
+++ b/src/e-util/e-html-editor-image-dialog.c
@@ -359,7 +359,7 @@ html_editor_image_dialog_show (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_image_dialog_open (cnt_editor);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_IMAGE);
 
        value = e_content_editor_image_get_src (cnt_editor);
        if (value && *value) {
@@ -432,7 +432,7 @@ html_editor_image_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_image_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_IMAGE);
 
        GTK_WIDGET_CLASS (e_html_editor_image_dialog_parent_class)->hide (widget);
 }
diff --git a/src/e-util/e-html-editor-link-dialog.c b/src/e-util/e-html-editor-link-dialog.c
index 368dad3c11..ce5337545f 100644
--- a/src/e-util/e-html-editor-link-dialog.c
+++ b/src/e-util/e-html-editor-link-dialog.c
@@ -94,7 +94,7 @@ html_editor_link_dialog_ok (EHTMLEditorLinkDialog *dialog)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_link_set_values (
+       e_content_editor_link_set_properties (
                cnt_editor,
                gtk_entry_get_text (GTK_ENTRY (dialog->priv->url_edit)),
                gtk_entry_get_text (GTK_ENTRY (dialog->priv->label_edit)));
@@ -127,7 +127,7 @@ html_editor_link_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_link_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_LINK);
 
        /* Chain up to parent implementation */
        GTK_WIDGET_CLASS (e_html_editor_link_dialog_parent_class)->hide (widget);
@@ -153,21 +153,18 @@ html_editor_link_dialog_show (GtkWidget *widget)
 
        dialog->priv->label_autofill = TRUE;
 
-       e_content_editor_on_link_dialog_open (cnt_editor);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_LINK);
 
-       e_content_editor_link_get_values (cnt_editor, &href, &text);
+       e_content_editor_link_get_properties (cnt_editor, &href, &text);
        if (href && *href)
-               gtk_entry_set_text (
-                       GTK_ENTRY (dialog->priv->url_edit), href);
+               gtk_entry_set_text (GTK_ENTRY (dialog->priv->url_edit), href);
        else
-               gtk_widget_set_sensitive (
-                       dialog->priv->remove_link_button, FALSE);
+               gtk_widget_set_sensitive (dialog->priv->remove_link_button, FALSE);
 
        g_free (href);
 
        if (text && *text) {
-               gtk_entry_set_text (
-                       GTK_ENTRY (dialog->priv->label_edit), text);
+               gtk_entry_set_text (GTK_ENTRY (dialog->priv->label_edit), text);
                dialog->priv->label_autofill = FALSE;
        }
        g_free (text);
diff --git a/src/e-util/e-html-editor-page-dialog.c b/src/e-util/e-html-editor-page-dialog.c
index a870be1046..f2d5ccc1b7 100644
--- a/src/e-util/e-html-editor-page-dialog.c
+++ b/src/e-util/e-html-editor-page-dialog.c
@@ -307,7 +307,7 @@ html_editor_page_dialog_show (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_page_dialog_open (cnt_editor);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_PAGE);
 
        uri = e_content_editor_page_get_background_image_uri (cnt_editor);
        if (uri && *uri) {
@@ -346,7 +346,7 @@ html_editor_page_dialog_show (GtkWidget *widget)
        e_color_combo_set_current_color (
                E_COLOR_COMBO (dialog->priv->background_color_picker), &rgba);
 
-       font_name = e_html_editor_until_dup_font_id (GTK_COMBO_BOX (dialog->priv->text_font_name_combo),
+       font_name = e_html_editor_util_dup_font_id (GTK_COMBO_BOX (dialog->priv->text_font_name_combo),
                e_content_editor_page_get_font_name (cnt_editor));
        gtk_combo_box_set_active_id (GTK_COMBO_BOX (dialog->priv->text_font_name_combo), font_name ? 
font_name : "");
        g_free (font_name);
@@ -365,7 +365,7 @@ html_editor_page_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_page_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_PAGE);
 
        GTK_WIDGET_CLASS (e_html_editor_page_dialog_parent_class)->hide (widget);
 }
diff --git a/src/e-util/e-html-editor-private.h b/src/e-util/e-html-editor-private.h
index 95bc87ab6e..00020f9e54 100644
--- a/src/e-util/e-html-editor-private.h
+++ b/src/e-util/e-html-editor-private.h
@@ -107,7 +107,7 @@ const gchar *       e_html_editor_get_content_editor_name
                                                (EHTMLEditor *editor);
 GtkWidget *    e_html_editor_util_create_font_name_combo
                                                (void);
-gchar *                e_html_editor_until_dup_font_id (GtkComboBox *combo_box,
+gchar *                e_html_editor_util_dup_font_id  (GtkComboBox *combo_box,
                                                 const gchar *font_name);
 
 G_END_DECLS
diff --git a/src/e-util/e-html-editor-replace-dialog.c b/src/e-util/e-html-editor-replace-dialog.c
index d217b758f0..e33e7dfcbc 100644
--- a/src/e-util/e-html-editor-replace-dialog.c
+++ b/src/e-util/e-html-editor-replace-dialog.c
@@ -169,7 +169,7 @@ html_editor_replace_dialog_show (GtkWidget *widget)
 {
        EHTMLEditorReplaceDialog *dialog = E_HTML_EDITOR_REPLACE_DIALOG (widget);
 
-       e_content_editor_on_replace_dialog_open (dialog->priv->cnt_editor);
+       e_content_editor_on_dialog_open (dialog->priv->cnt_editor, E_CONTENT_EDITOR_DIALOG_REPLACE);
 
        gtk_widget_grab_focus (dialog->priv->search_entry);
        gtk_widget_hide (dialog->priv->result_label);
@@ -183,7 +183,7 @@ html_editor_replace_dialog_hide (GtkWidget *widget)
 {
        EHTMLEditorReplaceDialog *dialog = E_HTML_EDITOR_REPLACE_DIALOG (widget);
 
-       e_content_editor_on_replace_dialog_close (dialog->priv->cnt_editor);
+       e_content_editor_on_dialog_close (dialog->priv->cnt_editor, E_CONTENT_EDITOR_DIALOG_REPLACE);
 
        /* Chain up to parent implementation */
        GTK_WIDGET_CLASS (e_html_editor_replace_dialog_parent_class)->hide (widget);
diff --git a/src/e-util/e-html-editor-spell-check-dialog.c b/src/e-util/e-html-editor-spell-check-dialog.c
index 3d815ce774..4ac5e09fd0 100644
--- a/src/e-util/e-html-editor-spell-check-dialog.c
+++ b/src/e-util/e-html-editor-spell-check-dialog.c
@@ -303,7 +303,7 @@ html_editor_spell_check_dialog_show (GtkWidget *widget)
                editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
                cnt_editor = e_html_editor_get_content_editor (editor);
 
-               e_content_editor_on_spell_check_dialog_open (cnt_editor);
+               e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_SPELLCHECK);
 
                GTK_WIDGET_CLASS (e_html_editor_spell_check_dialog_parent_class)->show (widget);
        }
@@ -319,7 +319,7 @@ html_editor_spell_check_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_spell_check_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_SPELLCHECK);
 
        /* Chain up to parent implementation */
        GTK_WIDGET_CLASS (e_html_editor_spell_check_dialog_parent_class)->hide (widget);
diff --git a/src/e-util/e-html-editor-table-dialog.c b/src/e-util/e-html-editor-table-dialog.c
index d613104856..4f08e9bcd4 100644
--- a/src/e-util/e-html-editor-table-dialog.c
+++ b/src/e-util/e-html-editor-table-dialog.c
@@ -443,10 +443,9 @@ html_editor_table_dialog_show (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       if (e_content_editor_on_table_dialog_open (cnt_editor))
-               html_editor_table_dialog_reset_values (dialog);
-       else
-               html_editor_table_dialog_get_values (dialog);
+       e_content_editor_on_dialog_open (cnt_editor, E_CONTENT_EDITOR_DIALOG_TABLE);
+
+       html_editor_table_dialog_get_values (dialog);
 
        /* Chain up to parent implementation */
        GTK_WIDGET_CLASS (e_html_editor_table_dialog_parent_class)->show (widget);
@@ -480,7 +479,7 @@ html_editor_table_dialog_hide (GtkWidget *widget)
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
 
-       e_content_editor_on_table_dialog_close (cnt_editor);
+       e_content_editor_on_dialog_close (cnt_editor, E_CONTENT_EDITOR_DIALOG_TABLE);
 
        GTK_WIDGET_CLASS (e_html_editor_table_dialog_parent_class)->hide (widget);
 }
diff --git a/src/e-util/e-html-editor.c b/src/e-util/e-html-editor.c
index 7bc374b568..5e74f0de47 100644
--- a/src/e-util/e-html-editor.c
+++ b/src/e-util/e-html-editor.c
@@ -134,8 +134,8 @@ e_html_editor_util_create_font_name_combo (void)
 }
 
 gchar *
-e_html_editor_until_dup_font_id (GtkComboBox *combo_box,
-                                const gchar *font_name)
+e_html_editor_util_dup_font_id (GtkComboBox *combo_box,
+                               const gchar *font_name)
 {
        GtkTreeModel *model;
        GtkTreeIter iter;
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index 905e613ab7..b9eafcaca8 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -5288,6 +5288,8 @@ main (gint argc,
        e_util_init_main_thread (NULL);
        e_passwords_init ();
 
+       gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), EVOLUTION_ICONDIR);
+
        modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
        g_list_free_full (modules, (GDestroyNotify) g_type_module_unuse);
 
diff --git a/src/e-util/test-html-editor.c b/src/e-util/test-html-editor.c
index 91012a815a..7403523ecc 100644
--- a/src/e-util/test-html-editor.c
+++ b/src/e-util/test-html-editor.c
@@ -676,6 +676,8 @@ main (gint argc,
 
        g_setenv ("E_HTML_EDITOR_TEST_SOURCES", "1", FALSE);
 
+       gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), EVOLUTION_ICONDIR);
+
        modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR);
        g_list_free_full (modules, (GDestroyNotify) g_type_module_unuse);
 
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index a0e5570af5..ca3aa6996c 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -337,6 +337,70 @@ webkit_editor_call_jsc_sync (EWebKitEditor *wk_editor,
        return jcd.result;
 }
 
+static gboolean
+webkit_editor_extract_and_free_jsc_boolean (JSCValue *jsc_value,
+                                           gboolean default_value)
+{
+       gboolean value;
+
+       if (jsc_value && jsc_value_is_boolean (jsc_value))
+               value = jsc_value_to_boolean (jsc_value);
+       else
+               value = default_value;
+
+       g_clear_object (&jsc_value);
+
+       return value;
+}
+
+/*static gint32
+webkit_editor_extract_and_free_jsc_int32 (JSCValue *jsc_value,
+                                         gint32 default_value)
+{
+       gint32 value;
+
+       if (jsc_value && jsc_value_is_number (jsc_value))
+               value = jsc_value_to_int32 (jsc_value);
+       else
+               value = default_value;
+
+       g_clear_object (&jsc_value);
+
+       return value;
+}
+
+static gdouble
+webkit_editor_extract_and_free_jsc_double (JSCValue *jsc_value,
+                                          gdouble default_value)
+{
+       gdouble value;
+
+       if (jsc_value && jsc_value_is_number (jsc_value))
+               value = jsc_value_to_double (jsc_value);
+       else
+               value = default_value;
+
+       g_clear_object (&jsc_value);
+
+       return value;
+}*/
+
+static gchar *
+webkit_editor_extract_and_free_jsc_string (JSCValue *jsc_value,
+                                          const gchar *default_value)
+{
+       gchar *value;
+
+       if (jsc_value && jsc_value_is_string (jsc_value))
+               value = jsc_value_to_string (jsc_value);
+       else
+               value = g_strdup (default_value);
+
+       g_clear_object (&jsc_value);
+
+       return value;
+}
+
 static gint16
 e_webkit_editor_three_state_to_int16 (EThreeState value)
 {
@@ -2945,6 +3009,31 @@ webkit_editor_selection_restore (EContentEditor *editor)
                "EvoEditor.RestoreSelection();");
 }
 
+static void
+webkit_editor_on_dialog_open (EContentEditor *editor,
+                             const gchar *name)
+{
+       EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
+
+       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+               "EvoEditor.OnDialogOpen(%s);", name);
+}
+
+static void
+webkit_editor_on_dialog_close (EContentEditor *editor,
+                              const gchar *name)
+{
+       EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
+
+       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+               "EvoEditor.OnDialogClose(%s);", name);
+
+       if (g_strcmp0 (name, E_CONTENT_EDITOR_DIALOG_SPELLCHECK) == 0 ||
+           g_strcmp0 (name, E_CONTENT_EDITOR_DIALOG_FIND) == 0 ||
+           g_strcmp0 (name, E_CONTENT_EDITOR_DIALOG_REPLACE) == 0)
+               webkit_editor_finish_search (E_WEBKIT_EDITOR (editor));
+}
+
 static void
 webkit_editor_delete_cell_contents (EContentEditor *editor)
 {
@@ -3034,70 +3123,70 @@ webkit_editor_insert_row_below (EContentEditor *editor)
                wk_editor, "EEditorDialogInsertRowBelow");
 }
 
-static gboolean
-webkit_editor_on_h_rule_dialog_open (EContentEditor *editor)
+static void
+webkit_editor_dialog_utils_set_attribute (EWebKitEditor *wk_editor,
+                                         const gchar *name,
+                                         const gchar *value)
 {
-       EWebKitEditor *wk_editor;
-       gboolean value = FALSE;
-       GVariant *result;
+       g_return_if_fail (E_IS_WEBKIT_EDITOR (wk_editor));
+       g_return_if_fail (name != NULL);
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
-       if (!wk_editor->priv->web_extension_proxy) {
-               printf ("EHTMLEditorWebExtension not ready at %s!\n", G_STRFUNC);
-               return FALSE;
+       if (value) {
+               e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+                       "EvoEditor.DialogUtilsSetAttribute(%s, %s);",
+                       name, value);
+       } else {
+               e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+                       "EvoEditor.DialogUtilsSetAttribute(%s, null);",
+                       name);
        }
+}
 
-       result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
-               wk_editor->priv->web_extension_proxy,
-               "EEditorHRuleDialogFindHRule",
-               g_variant_new ("(t)", current_page_id (wk_editor)),
-               NULL);
-
-       if (result) {
-               g_variant_get (result, "(b)", &value);
-               g_variant_unref (result);
-       }
+static gchar *
+webkit_editor_dialog_utils_get_attribute (EWebKitEditor *wk_editor,
+                                         const gchar *name)
+{
+       g_return_val_if_fail (E_IS_WEBKIT_EDITOR (wk_editor), NULL);
+       g_return_val_if_fail (name != NULL, NULL);
 
-       return value;
+       return webkit_editor_extract_and_free_jsc_string (
+               webkit_editor_call_jsc_sync (wk_editor,
+                       "EvoEditor.DialogUtilsGetAttribute(%s);",
+                       name),
+               NULL);
 }
 
-static void
-webkit_editor_on_h_rule_dialog_close (EContentEditor *editor)
+static gboolean
+webkit_editor_dialog_utils_has_attribute (EWebKitEditor *wk_editor,
+                                         const gchar *name)
 {
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       g_return_val_if_fail (E_IS_WEBKIT_EDITOR (wk_editor), FALSE);
+       g_return_val_if_fail (name != NULL, FALSE);
 
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorHRuleDialogOnClose");
+       return webkit_editor_extract_and_free_jsc_boolean (
+               webkit_editor_call_jsc_sync (wk_editor,
+                       "EvoEditor.DialogUtilsHasAttribute(%s);",
+                       name),
+               FALSE);
 }
 
 static void
 webkit_editor_h_rule_set_align (EContentEditor *editor,
                                 const gchar *value)
 {
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_set_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "align", value);
+       webkit_editor_dialog_utils_set_attribute (E_WEBKIT_EDITOR (editor), "align", value);
 }
 
 static gchar *
 webkit_editor_h_rule_get_align (EContentEditor *editor)
 {
-       EWebKitEditor *wk_editor;
-       gchar *value = NULL;
-       GVariant *result;
+       gchar *value;
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       value = webkit_editor_dialog_utils_get_attribute (E_WEBKIT_EDITOR (editor), "align");
 
-       result = webkit_editor_get_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "align");
-       if (result) {
-               g_variant_get (result, "(s)", &value);
-               g_variant_unref (result);
+       if (!value || !*value) {
+               g_free (value);
+               value = g_strdup ("center");
        }
 
        return value;
@@ -3107,43 +3196,31 @@ static void
 webkit_editor_h_rule_set_size (EContentEditor *editor,
                                gint value)
 {
-       EWebKitEditor *wk_editor;
-       gchar *size;
+       gchar size[64];
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       g_snprintf (size, sizeof (size), "%d", value);
 
-       size = g_strdup_printf ("%d", value);
-
-       webkit_editor_set_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "size", size);
-
-       g_free (size);
+       webkit_editor_dialog_utils_set_attribute (E_WEBKIT_EDITOR (editor), "size", size);
 }
 
 static gint
 webkit_editor_h_rule_get_size (EContentEditor *editor)
 {
-       EWebKitEditor *wk_editor;
-       gint size = 0;
-       GVariant *result;
+       gint size = 2;
+       gchar *value;
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       value = webkit_editor_dialog_utils_get_attribute (E_WEBKIT_EDITOR (editor), "size");
 
-       result = webkit_editor_get_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "size");
-       if (result) {
-               const gchar *value;
-
-               g_variant_get (result, "(&s)", &value);
-               if (value && *value)
+       if (value) {
+               if (*value)
                        size = atoi (value);
 
-               if (size == 0)
+               if (!size)
                        size = 2;
-
-               g_variant_unref (result);
        }
 
+       g_free (value);
+
        return size;
 }
 
@@ -3152,45 +3229,37 @@ webkit_editor_h_rule_set_width (EContentEditor *editor,
                                 gint value,
                                 EContentEditorUnit unit)
 {
-       EWebKitEditor *wk_editor;
-       gchar *width;
+       gchar width[64];
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       width = g_strdup_printf (
-               "%d%s",
+       g_snprintf (width, sizeof (width), "%d%s",
                value,
                (unit == E_CONTENT_EDITOR_UNIT_PIXEL) ? "px" : "%");
 
-       webkit_editor_set_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "width", width);
-
-       g_free (width);
+       webkit_editor_dialog_utils_set_attribute (E_WEBKIT_EDITOR (editor), "width", width);
 }
 
 static gint
 webkit_editor_h_rule_get_width (EContentEditor *editor,
                                 EContentEditorUnit *unit)
 {
-       EWebKitEditor *wk_editor;
+       gchar *width;
        gint value = 0;
-       GVariant *result;
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       width = webkit_editor_dialog_utils_get_attribute (E_WEBKIT_EDITOR (editor), "width");
 
        *unit = E_CONTENT_EDITOR_UNIT_PIXEL;
 
-       result = webkit_editor_get_element_attribute (
-               wk_editor, "#-x-evo-current-hr", "width");
-       if (result) {
-               const gchar *width;
-               g_variant_get (result, "(&s)", &width);
-               if (width && *width) {
+       if (width) {
+               if (*width) {
                        value = atoi (width);
+
                        if (strstr (width, "%"))
                                *unit = E_CONTENT_EDITOR_UNIT_PERCENTAGE;
                }
-               g_variant_unref (result);
+               g_free (width);
+       } else {
+               *unit = E_CONTENT_EDITOR_UNIT_PERCENTAGE;
+               value = 100;
        }
 
        return value;
@@ -3200,69 +3269,13 @@ static void
 webkit_editor_h_rule_set_no_shade (EContentEditor *editor,
                                    gboolean value)
 {
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-       if (!wk_editor->priv->web_extension_proxy) {
-               printf ("EHTMLEditorWebExtension not ready at %s!\n", G_STRFUNC);
-               return;
-       }
-
-       if (value)
-               webkit_editor_set_element_attribute (
-                       wk_editor, "#-x-evo-current-hr", "noshade", "");
-       else
-               webkit_editor_remove_element_attribute (
-                       wk_editor, "#-x-evo-current-hr", "noshade");
+       webkit_editor_dialog_utils_set_attribute (E_WEBKIT_EDITOR (editor), "noshade", value ? "" : NULL);
 }
 
 static gboolean
 webkit_editor_h_rule_get_no_shade (EContentEditor *editor)
 {
-       EWebKitEditor *wk_editor;
-       GVariant *result;
-       gboolean no_shade = FALSE;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-       if (!wk_editor->priv->web_extension_proxy) {
-               printf ("EHTMLEditorWebExtension not ready at %s!\n", G_STRFUNC);
-               return FALSE;
-       }
-
-       result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
-               wk_editor->priv->web_extension_proxy,
-               "ElementHasAttribute",
-               g_variant_new ("(tss)", current_page_id (wk_editor), "-x-evo-current-hr", "noshade"),
-               NULL);
-
-       if (result) {
-               g_variant_get (result, "(b)", &no_shade);
-               g_variant_unref (result);
-       }
-
-       return no_shade;
-}
-
-static void
-webkit_editor_on_image_dialog_open (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorImageDialogMarkImage");
-}
-
-static void
-webkit_editor_on_image_dialog_close (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorImageDialogSaveHistoryOnExit");
+       return webkit_editor_dialog_utils_has_attribute (E_WEBKIT_EDITOR (editor), "noshade");
 }
 
 static void
@@ -3781,46 +3794,26 @@ webkit_editor_selection_unlink (EContentEditor *editor)
 }
 
 static void
-webkit_editor_on_link_dialog_open (EContentEditor *editor)
+webkit_editor_link_set_properties (EContentEditor *editor,
+                                  const gchar *href,
+                                  const gchar *text)
 {
        EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
 
        e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
-               "EvoEditor.OnPropertiesOpen();");
-}
-
-static void
-webkit_editor_on_link_dialog_close (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
-
-       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
-               "EvoEditor.OnPropertiesClose();");
-}
-
-static void
-webkit_editor_link_set_values (EContentEditor *editor,
-                               const gchar *href,
-                               const gchar *text)
-{
-       EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
-
-       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
-               "EvoEditor.SetLinkValues(%s, %s);",
+               "EvoEditor.LinkSetProperties(%s, %s);",
                href, text);
 }
 
 static void
-webkit_editor_link_get_values (EContentEditor *editor,
-                               gchar **href,
-                               gchar **text)
+webkit_editor_link_get_properties (EContentEditor *editor,
+                                  gchar **href,
+                                  gchar **text)
 {
-       EWebKitEditor *wk_editor;
+       EWebKitEditor *wk_editor = E_WEBKIT_EDITOR (editor);
        JSCValue *result;
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       result = webkit_editor_call_jsc_sync (wk_editor, "EvoEditor.GetLinkValues();");
+       result = webkit_editor_call_jsc_sync (wk_editor, "EvoEditor.LinkGetProperties();");
 
        if (result) {
                *href = e_web_view_jsc_get_object_property_string (result, "href", NULL);
@@ -4038,28 +4031,6 @@ webkit_editor_get_style_flag (EWebKitEditor *wk_editor,
        return (wk_editor->priv->style_flags & flag) != 0;
 }
 
-static void
-webkit_editor_on_page_dialog_open (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorPageDialogSaveHistory");
-}
-
-static void
-webkit_editor_on_page_dialog_close (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorPageDialogSaveHistoryOnExit");
-}
-
 static gchar *
 webkit_editor_page_get_background_image_uri (EContentEditor *editor)
 {
@@ -4104,36 +4075,6 @@ webkit_editor_page_set_background_image_uri (EContentEditor *editor,
        }
 }
 
-static void
-webkit_editor_on_cell_dialog_open (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       if (!wk_editor->priv->web_extension_proxy) {
-               printf ("EHTMLEditorWebExtension not ready at %s!\n", G_STRFUNC);
-               return;
-       }
-
-       e_util_invoke_g_dbus_proxy_call_with_error_check (
-               wk_editor->priv->web_extension_proxy,
-               "EEditorCellDialogMarkCurrentCellElement",
-               g_variant_new ("(ts)", current_page_id (wk_editor), "-x-evo-current-cell"),
-               wk_editor->priv->cancellable);
-}
-
-static void
-webkit_editor_on_cell_dialog_close (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorCellDialogSaveHistoryOnExit");
-}
-
 static void
 webkit_editor_cell_set_v_align (EContentEditor *editor,
                                 const gchar *value,
@@ -5069,58 +5010,6 @@ webkit_editor_table_set_background_image_uri (EContentEditor *editor,
        }
 }
 
-static gboolean
-webkit_editor_on_table_dialog_open (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-       GVariant *result;
-       gboolean value = FALSE;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       if (!wk_editor->priv->web_extension_proxy) {
-               printf ("EHTMLEditorWebExtension not ready at %s!\n", G_STRFUNC);
-               return FALSE;
-       }
-
-       result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
-               wk_editor->priv->web_extension_proxy,
-               "EEditorTableDialogShow",
-               g_variant_new ("(t)", current_page_id (wk_editor)),
-               NULL);
-
-       if (result) {
-               g_variant_get (result, "(b)", &value);
-               g_variant_unref (result);
-       }
-
-       return value;
-}
-
-static void
-webkit_editor_on_table_dialog_close (EContentEditor *editor)
-{
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
-
-       webkit_editor_call_simple_extension_function (
-               wk_editor, "EEditorTableDialogSaveHistoryOnExit");
-
-       webkit_editor_finish_search (E_WEBKIT_EDITOR (editor));
-}
-
-static void
-webkit_editor_on_spell_check_dialog_open (EContentEditor *editor)
-{
-}
-
-static void
-webkit_editor_on_spell_check_dialog_close (EContentEditor *editor)
-{
-       webkit_editor_finish_search (E_WEBKIT_EDITOR (editor));
-}
-
 static gchar *
 move_to_another_word (EContentEditor *editor,
                       const gchar *word,
@@ -5174,28 +5063,6 @@ webkit_editor_spell_check_prev_word (EContentEditor *editor,
        return move_to_another_word (editor, word, "EEditorSpellCheckDialogPrev");
 }
 
-static void
-webkit_editor_on_replace_dialog_open (EContentEditor *editor)
-{
-}
-
-static void
-webkit_editor_on_replace_dialog_close (EContentEditor *editor)
-{
-       webkit_editor_finish_search (E_WEBKIT_EDITOR (editor));
-}
-
-static void
-webkit_editor_on_find_dialog_open (EContentEditor *editor)
-{
-}
-
-static void
-webkit_editor_on_find_dialog_close (EContentEditor *editor)
-{
-       webkit_editor_finish_search (E_WEBKIT_EDITOR (editor));
-}
-
 static void
 webkit_editor_uri_request_done_cb (GObject *source_object,
                                   GAsyncResult *result,
@@ -6939,6 +6806,8 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->get_current_signature_uid =  webkit_editor_get_current_signature_uid;
        iface->is_ready = webkit_editor_is_ready;
        iface->insert_signature = webkit_editor_insert_signature;
+       iface->on_dialog_open = webkit_editor_on_dialog_open;
+       iface->on_dialog_close = webkit_editor_on_dialog_close;
        iface->delete_cell_contents = webkit_editor_delete_cell_contents;
        iface->delete_column = webkit_editor_delete_column;
        iface->delete_row = webkit_editor_delete_row;
@@ -6947,8 +6816,6 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->insert_column_before = webkit_editor_insert_column_before;
        iface->insert_row_above = webkit_editor_insert_row_above;
        iface->insert_row_below = webkit_editor_insert_row_below;
-       iface->on_h_rule_dialog_open = webkit_editor_on_h_rule_dialog_open;
-       iface->on_h_rule_dialog_close = webkit_editor_on_h_rule_dialog_close;
        iface->h_rule_set_align = webkit_editor_h_rule_set_align;
        iface->h_rule_get_align = webkit_editor_h_rule_get_align;
        iface->h_rule_set_size = webkit_editor_h_rule_set_size;
@@ -6957,8 +6824,6 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->h_rule_get_width = webkit_editor_h_rule_get_width;
        iface->h_rule_set_no_shade = webkit_editor_h_rule_set_no_shade;
        iface->h_rule_get_no_shade = webkit_editor_h_rule_get_no_shade;
-       iface->on_image_dialog_open = webkit_editor_on_image_dialog_open;
-       iface->on_image_dialog_close = webkit_editor_on_image_dialog_close;
        iface->image_set_src = webkit_editor_image_set_src;
        iface->image_get_src = webkit_editor_image_get_src;
        iface->image_set_alt = webkit_editor_image_set_alt;
@@ -6981,10 +6846,8 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->image_set_width_follow = webkit_editor_image_set_width_follow;
        iface->image_get_width = webkit_editor_image_get_width;
        iface->image_get_height = webkit_editor_image_get_height;
-       iface->on_link_dialog_open = webkit_editor_on_link_dialog_open;
-       iface->on_link_dialog_close = webkit_editor_on_link_dialog_close;
-       iface->link_set_values = webkit_editor_link_set_values;
-       iface->link_get_values = webkit_editor_link_get_values;
+       iface->link_set_properties = webkit_editor_link_set_properties;
+       iface->link_get_properties = webkit_editor_link_get_properties;
        iface->page_set_text_color = webkit_editor_page_set_text_color;
        iface->page_get_text_color = webkit_editor_page_get_text_color;
        iface->page_set_background_color = webkit_editor_page_set_background_color;
@@ -6997,10 +6860,6 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->page_get_font_name = webkit_editor_page_get_font_name;
        iface->page_set_background_image_uri = webkit_editor_page_set_background_image_uri;
        iface->page_get_background_image_uri = webkit_editor_page_get_background_image_uri;
-       iface->on_page_dialog_open = webkit_editor_on_page_dialog_open;
-       iface->on_page_dialog_close = webkit_editor_on_page_dialog_close;
-       iface->on_cell_dialog_open = webkit_editor_on_cell_dialog_open;
-       iface->on_cell_dialog_close = webkit_editor_on_cell_dialog_close;
        iface->cell_set_v_align = webkit_editor_cell_set_v_align;
        iface->cell_get_v_align = webkit_editor_cell_get_v_align;
        iface->cell_set_align = webkit_editor_cell_set_align;
@@ -7037,14 +6896,6 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->table_set_background_image_uri = webkit_editor_table_set_background_image_uri;
        iface->table_get_background_color = webkit_editor_table_get_background_color;
        iface->table_set_background_color = webkit_editor_table_set_background_color;
-       iface->on_table_dialog_open = webkit_editor_on_table_dialog_open;
-       iface->on_table_dialog_close = webkit_editor_on_table_dialog_close;
-       iface->on_spell_check_dialog_open = webkit_editor_on_spell_check_dialog_open;
-       iface->on_spell_check_dialog_close = webkit_editor_on_spell_check_dialog_close;
        iface->spell_check_next_word = webkit_editor_spell_check_next_word;
        iface->spell_check_prev_word = webkit_editor_spell_check_prev_word;
-       iface->on_replace_dialog_open = webkit_editor_on_replace_dialog_open;
-       iface->on_replace_dialog_close = webkit_editor_on_replace_dialog_close;
-       iface->on_find_dialog_open = webkit_editor_on_find_dialog_open;
-       iface->on_find_dialog_close = webkit_editor_on_find_dialog_close;
 }


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