[evolution/webkit-composer-rebased: 94/105] Introduce e_editor_widget_exec_command() and port everything to it



commit a5d415cd499a5e0a2949ef3f793349cf9d019132
Author: Dan VrÃtil <dvratil redhat com>
Date:   Sun Dec 2 16:18:24 2012 +0100

    Introduce e_editor_widget_exec_command() and port everything to it
    
    e_editor_widget_exec_command() is a wrapper for webkit_dom_document_exec_command(),
    however the command to be executed is passed as an enum member. This makes
    it much easier to use, because the commands are not documented anywhere
    else and the only place where to get list of all supported commands is
    just from a table somewhere within WebKit source code.

 e-util/e-editor-hrule-dialog.c |    5 +-
 e-util/e-editor-link-dialog.c  |    5 +-
 e-util/e-editor-selection.c    |  200 ++++++++++++++++++---------------------
 e-util/e-editor-selection.h    |    1 +
 e-util/e-editor-widget.c       |  154 ++++++++++++++++---------------
 e-util/e-editor-widget.h       |  112 ++++++++++++++++++++++-
 e-util/e-editor.c              |    1 -
 7 files changed, 291 insertions(+), 187 deletions(-)
---
diff --git a/e-util/e-editor-hrule-dialog.c b/e-util/e-editor-hrule-dialog.c
index d217481..bca6b20 100644
--- a/e-util/e-editor-hrule-dialog.c
+++ b/e-util/e-editor-hrule-dialog.c
@@ -24,6 +24,7 @@
 
 #include "e-editor-hrule-dialog.h"
 #include "e-editor-utils.h"
+#include "e-editor-widget.h"
 
 #include <glib/gi18n-lib.h>
 #include <webkit/webkitdom.h>
@@ -233,8 +234,8 @@ editor_hrule_dialog_show (GtkWidget *widget)
 	}
 
 	if (!rule) {
-		webkit_dom_document_exec_command (
-			document, "insertHorizontalRule", FALSE, "");
+		e_editor_widget_exec_command (
+			editor_widget, E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE, NULL);
 
 		rule = e_editor_dom_node_find_child_element (
 			webkit_dom_range_get_start_container (range, NULL), "HR");
diff --git a/e-util/e-editor-link-dialog.c b/e-util/e-editor-link-dialog.c
index f067053..ea75db8 100644
--- a/e-util/e-editor-link-dialog.c
+++ b/e-util/e-editor-link-dialog.c
@@ -25,6 +25,7 @@
 #include "e-editor-link-dialog.h"
 #include "e-editor-selection.h"
 #include "e-editor-utils.h"
+#include "e-editor-widget.h"
 
 #include <glib/gi18n-lib.h>
 
@@ -168,8 +169,8 @@ editor_link_dialog_ok (EEditorLinkDialog *dialog)
 				gtk_entry_get_text (
 					GTK_ENTRY (dialog->priv->label_edit)));
 
-			webkit_dom_document_exec_command (
-				document, "insertHTML", FALSE, html);
+			e_editor_widget_exec_command (
+				widget, E_EDITOR_WIDGET_COMMAND_INSERT_HTML, html);
 
 			g_free (html);
 
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index 967c255..2bf3bdd 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -230,7 +230,7 @@ editor_selection_set_editor_widget (EEditorSelection *selection,
 {
 	selection->priv->webview = g_object_ref (E_EDITOR_WIDGET (editor_widget));
 	g_signal_connect (
-		webview, "selection-changed",
+		editor_widget, "selection-changed",
 		G_CALLBACK (webview_selection_changed), selection);
 }
 
@@ -437,7 +437,7 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
 			"editor-widget",
 			NULL,
 			NULL,
-		        E_TYPE_EDITOR_WIDGET
+		        E_TYPE_EDITOR_WIDGET,
 		        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
 	/**
@@ -913,8 +913,7 @@ void
 e_editor_selection_set_alignment (EEditorSelection *selection,
 				  EEditorSelectionAlignment alignment)
 {
-	WebKitDOMDocument *document;
-	const gchar *command;
+	EEditorWidgetCommand command;
 
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
@@ -924,20 +923,20 @@ e_editor_selection_set_alignment (EEditorSelection *selection,
 
 	switch (alignment) {
 		case E_EDITOR_SELECTION_ALIGNMENT_CENTER:
-			command = "justifyCenter";
+			command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER;
 			break;
 
 		case E_EDITOR_SELECTION_ALIGNMENT_LEFT:
-			command = "justifyLeft";
+			command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT;
 			break;
 
 		case E_EDITOR_SELECTION_ALIGNMENT_RIGHT:
-			command = "justifyRight";
+			command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT;
 			break;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, command, FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview), command, NULL);
 
 	g_object_notify (G_OBJECT (selection), "alignment");
 }
@@ -984,14 +983,12 @@ void
 e_editor_selection_set_background_color (EEditorSelection *selection,
 					const gchar *color)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (color && *color);
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (
-		document, "backColor", FALSE, color);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR, color);
 
 	g_object_notify (G_OBJECT (selection), "background-color");
 }
@@ -1080,8 +1077,7 @@ e_editor_selection_set_block_format (EEditorSelection *selection,
 				     EEditorSelectionBlockFormat format)
 {
 	EEditorSelectionBlockFormat current_format;
-	WebKitDOMDocument *document;
-	const gchar *command;
+	EEditorWidgetCommand command;
 	const gchar *value;
 
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
@@ -1091,80 +1087,80 @@ e_editor_selection_set_block_format (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-
 	switch (format) {
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "BLOCKQUOTE";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H1:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H1";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H2:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H2";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H3:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H3";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H4:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H4";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H5:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H5";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_H6:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "H6";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "P";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_PRE:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "PRE";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_ADDRESS:
-			command = "formatBlock";
+			command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
 			value = "ADDRESS";
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST:
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA:
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ROMAN:
-			command = "insertOrderedList";
-			value = "";
+			command = E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST;
+			value = NULL;
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST:
-			command = "insertUnorderedList";
-			value = "";
+			command = E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST;
+			value = NULL;
 			break;
 		case E_EDITOR_SELECTION_BLOCK_FORMAT_NONE:
 		default:
-			command = "removeFormat";
-			value = "";
+			command = E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT;
+			value = NULL;
 			break;
 	}
 
 
 	/* First remove (un)ordered list before changing formatting */
 	if (current_format == E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST) {
-		webkit_dom_document_exec_command (
-			document, "insertUnorderedList", FALSE, "");
+		e_editor_widget_exec_command (
+			E_EDITOR_WIDGET (selection->priv->webview),
+			E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST, NULL);
 		/*		    ^-- not a typo, "insert" toggles the formatting
 		 * 			if already present */
 	} else if (current_format >= E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST) {
-		webkit_dom_document_exec_command (
-			document, "insertOrderedList", FALSE ,"");
+		e_editor_widget_exec_command (
+			E_EDITOR_WIDGET (selection->priv->webview),
+			E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST, NULL);
 	}
 
-	webkit_dom_document_exec_command (
-		document, command, FALSE, value);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview), command, value);
 
 	/* Fine tuning - set the specific marker type for ordered lists */
 	if ((format == E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA) ||
@@ -1229,7 +1225,6 @@ void
 e_editor_selection_set_font_color (EEditorSelection *selection,
 				   const GdkRGBA *rgba)
 {
-	WebKitDOMDocument *document;
 	gchar *color;
 
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
@@ -1240,8 +1235,9 @@ e_editor_selection_set_font_color (EEditorSelection *selection,
 
 	color = g_strdup_printf ("#%06x", e_rgba_to_value ((GdkRGBA *) rgba));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "foreColor", FALSE, color);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_FORE_COLOR, color);
 
 	g_free (color);
 
@@ -1289,12 +1285,12 @@ void
 e_editor_selection_set_font_name (EEditorSelection *selection,
 				  const gchar *font_name)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "fontName", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_FONT_NAME, font_name);
+
 
 	g_object_notify (G_OBJECT (selection), "font-name");
 }
@@ -1342,14 +1338,15 @@ void
 e_editor_selection_set_font_size (EEditorSelection *selection,
 				  guint font_size)
 {
-	WebKitDOMDocument *document;
 	gchar *size_str;
 
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
 	size_str = g_strdup_printf("%d", font_size);
-	webkit_dom_document_exec_command (document, "fontSize", FALSE, size_str);
+
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_FONT_SIZE, size_str);
 	g_free (size_str);
 
 	g_object_notify (G_OBJECT (selection), "font-size");
@@ -1398,12 +1395,12 @@ e_editor_selection_is_indented (EEditorSelection *selection)
 void
 e_editor_selection_indent (EEditorSelection *selection)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "indent", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_INDENT, NULL);
+
 
 	g_object_notify (G_OBJECT (selection), "indented");
 }
@@ -1417,12 +1414,12 @@ e_editor_selection_indent (EEditorSelection *selection)
 void
 e_editor_selection_unindent (EEditorSelection *selection)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "outdent", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_OUTDENT, NULL);
+
 
 	g_object_notify (G_OBJECT (selection), "indented");
 }
@@ -1456,8 +1453,6 @@ void
 e_editor_selection_set_bold (EEditorSelection *selection,
 			     gboolean bold)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_bold (selection) ? TRUE : FALSE)
@@ -1465,8 +1460,10 @@ e_editor_selection_set_bold (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "bold", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_BOLD, NULL);
+
 
 	g_object_notify (G_OBJECT (selection), "bold");
 }
@@ -1500,8 +1497,6 @@ void
 e_editor_selection_set_italic (EEditorSelection *selection,
 			       gboolean italic)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_italic (selection) ? TRUE : FALSE)
@@ -1509,8 +1504,9 @@ e_editor_selection_set_italic (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "italic", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_ITALIC, NULL);
 
 	g_object_notify (G_OBJECT (selection), "italic");
 }
@@ -1579,8 +1575,9 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
 		 *     In theory it's possible to write a code that would remove
 		 *     the <TT> from selection using advanced DOM manipulation,
 		 *     but right now I don't really feel like writing it all... */
-		webkit_dom_document_exec_command (
-			document, "removeFormat", FALSE, "");
+		e_editor_widget_exec_command (
+			E_EDITOR_WIDGET (selection->priv->webview),
+			E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT, NULL);
 	}
 
 	g_object_notify (G_OBJECT (selection), "monospaced");
@@ -1615,8 +1612,6 @@ void
 e_editor_selection_set_strike_through (EEditorSelection *selection,
 				       gboolean strike_through)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_strike_through (selection) ? TRUE : FALSE)
@@ -1624,8 +1619,9 @@ e_editor_selection_set_strike_through (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "strikeThrough", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH, NULL);
 
 	g_object_notify (G_OBJECT (selection), "strike-through");
 }
@@ -1679,8 +1675,6 @@ void
 e_editor_selection_set_subscript (EEditorSelection *selection,
 				  gboolean subscript)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_subscript (selection) ? TRUE : FALSE)
@@ -1688,8 +1682,9 @@ e_editor_selection_set_subscript (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "subscript", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_SUBSCRIPT, NULL);
 
 	g_object_notify (G_OBJECT (selection), "subscript");
 }
@@ -1743,8 +1738,6 @@ void
 e_editor_selection_set_superscript (EEditorSelection *selection,
 				    gboolean superscript)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_superscript (selection) ? TRUE : FALSE)
@@ -1752,8 +1745,9 @@ e_editor_selection_set_superscript (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "superscript", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT, NULL);
 
 	g_object_notify (G_OBJECT (selection), "superscript");
 }
@@ -1787,8 +1781,6 @@ void
 e_editor_selection_set_underline (EEditorSelection *selection,
 				  gboolean underline)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
 	if ((e_editor_selection_is_underline (selection) ? TRUE : FALSE)
@@ -1796,8 +1788,9 @@ e_editor_selection_set_underline (EEditorSelection *selection,
 		return;
 	}
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "underline", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_UNDERLINE, NULL);
 
 	g_object_notify (G_OBJECT (selection), "underline");
 }
@@ -1812,12 +1805,11 @@ e_editor_selection_set_underline (EEditorSelection *selection,
 void
 e_editor_selection_unlink (EEditorSelection *selection)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "unlink", FALSE, "");
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_UNLINK, NULL);
 }
 
 /**
@@ -1831,13 +1823,12 @@ void
 e_editor_selection_create_link (EEditorSelection *selection,
 				const gchar *uri)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (uri && *uri);
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (document, "createLink", FALSE, uri);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_CREATE_LINK, uri);
 }
 
 /**
@@ -1852,15 +1843,12 @@ void
 e_editor_selection_insert_text (EEditorSelection *selection,
 				const gchar *plain_text)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (plain_text != NULL);
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-
-	webkit_dom_document_exec_command (
-		document, "insertText", FALSE, plain_text);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, plain_text);
 }
 
 /**
@@ -1875,14 +1863,12 @@ void
 e_editor_selection_insert_html (EEditorSelection *selection,
 				const gchar *html_text)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (html_text != NULL);
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (
-			document, "insertHTML", FALSE, html_text);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_INSERT_HTML, html_text);
 }
 
 /**
@@ -1897,14 +1883,12 @@ void
 e_editor_selection_insert_image (EEditorSelection *selection,
 				 const gchar *image_uri)
 {
-	WebKitDOMDocument *document;
-
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (image_uri != NULL);
 
-	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	webkit_dom_document_exec_command (
-			document, "insertImage", FALSE, image_uri);
+	e_editor_widget_exec_command (
+		E_EDITOR_WIDGET (selection->priv->webview),
+		E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE, image_uri);
 }
 
 static gint
diff --git a/e-util/e-editor-selection.h b/e-util/e-editor-selection.h
index 4d62cca..5ffc91c 100644
--- a/e-util/e-editor-selection.h
+++ b/e-util/e-editor-selection.h
@@ -26,6 +26,7 @@
 #define E_EDITOR_SELECTION_H
 
 #include <glib-object.h>
+#include <gdk/gdk.h>
 
 /* Standard GObject macros */
 #define E_TYPE_EDITOR_SELECTION \
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 8730edc..1d431ed 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -487,9 +487,8 @@ editor_widget_key_press_event (GtkWidget *gtk_widget,
 		 * command to do it. */
 		EEditorSelection *selection = e_editor_widget_get_selection (E_EDITOR_WIDGET (gtk_widget));
 		if (e_editor_selection_is_citation (selection)) {
-			WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor));
-			webkit_dom_document_exec_command (document,  "InsertNewlineInQuotedContent", FALSE, "");
-			return TRUE;
+			return e_editor_widget_exec_command (
+				editor, E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT, NULL);
 		}
 	}
 
@@ -941,7 +940,6 @@ e_editor_widget_init (EEditorWidget *editor)
 {
 	WebKitWebSettings *settings;
 	WebKitWebInspector *inspector;
-	WebKitDOMDocument *document;
 	GSettings *g_settings;
 	GSettingsSchema *settings_schema;
 	ESpellChecker *checker;
@@ -971,9 +969,8 @@ e_editor_widget_init (EEditorWidget *editor)
 
 	/* Don't use CSS when possible to preserve compatibility with older
 	 * versions of Evolution or other MUAs */
-	document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor));
-	webkit_dom_document_exec_command (
-		document, "styleWithCSS", FALSE, "false");
+	e_editor_widget_exec_command (
+		editor, E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS, "false");
 
 	g_signal_connect (editor, "user-changed-contents",
 		G_CALLBACK (editor_widget_user_changed_contents_cb), NULL);
@@ -1060,74 +1057,89 @@ e_editor_widget_get_selection (EEditorWidget *widget)
 /**
  * e_editor_widget_exec_command:
  * @widget: an #EEditorWidget
- * @command: a command to execute
- * @value: value of the command (or @NULL)
+ * @command: an #EEditorWidgetCommand to execute
+ * @value: value of the command (or @NULL if the command does not require value)
+ *
+ * The function will fail when @value is @NULL or empty but the current @command
+ * requires a value to be passed. The @value is ignored when the @command does
+ * not expect any value.
  *
- * Supported @command keywords are:
- *	"BackColor" - sets background color to @value
- *	"Bold" - toggles bold text, depending whether @value is "true" or "false"
- *	"Copy" - copies current selection to clipboard
- *	"CreateLink" - converts current selection to a link that points to URL in @value
- *	"Cut" - cuts current selection to clipboard
- *	"DefaultParagraphSeparator"
- *	"Delete" - deletes current selection
- *	"FindString" - highlights string passed in @value
- *	"FontName" - sets font name to @value
- *	"FontSize" - sets font point size to @value (no units, just number)
- *	"FontSizeDelta" - changes font size by delta passed in @value (no units, just number)
- *	"FontColor" - sets font color to @value
- *	"FormatBlock" - formats block to given formatting. Allowed formatting keywords are "BLOCKQUOTE",
- *			"H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE" and "ADDRESS"
- *	"ForwardDelete"
- *	"HiliteColor" - sets color in which results of "FindString" command should be highlighted to @value
- *	"Indent" - indents current paragraph
- *	"InsertHTML" - inserts content of @value into document as an HTML code
- *	"InsertHorizontalRule" - inserts <HR> on current line
- *	"InsertImage" - inserts an image with URL contained in @value into document
- *	"InsertLineBreak" - breaks line at current cursor position
- *	"InsertNewlineInQuotedContent - breaks citation at current cursor position
- *	"InsertOrderedList - inserts <OL> environment
- *	"InsertParagraph - inserts <P> environment
- *	"InsertText - inserts content of @value as text
- *	"InsertUnorderedList" - inserts <UL> environment
- *	"Italic" - toggles italic format depending on whether @value is "true" or "false"
- *	"JustifyCenter" - aligns current paragraph to center
- *	"JustifyFull" - justifies current paragraph to block
- *	"JustifyLeft" - aligns current paragraph to left
- *	"JustifyNone" - cancels any justification or alignment of current paragraph
- *	"JustifyRight" - aligns current paragraph to right
- *	"Outdent" - outdents current paragraph
- *	"Paste" - pastes clipboard content at current cursor position
- *	"PasteAndMatchStyle" - pastes clipboard content and matches it's style to style at current cursor position
- *	"PasteAsPlainText" - pastes clipboard content at current cursor position removing any HTML formatting
- *	"Print" - initiates printing of current document
- *	"Redo"
- *	"RemoveFormat" - removes any formatting of current selection
- *	"SelectAll" - selects the entire document
- *	"Strikethrough" - toggles strikethrough formatting depending on whether @value is "true" or "false"
- *	"StyleWithCSS" - toggles whether style should be defined in CSS "style" attribute of elements or
- *			 whether to use deprecated <FONT> tags. Depends on whether @value is "true" or "false"
- *	"Subscript" - toggles subscript of current selection depending on whether @value is "true" or "false"
- *	"Superscript" - toggles superscript of current selection depending on whether @value is "true" or "false"
- *	"Transpose"
- *	"Underline" - toggles underline formatting of current selection depending on whether @value is "true" or "false"
- *	"Undo"
- *	"Unlink" - removes links (<A>) from current selection (if there's any)
- *	"Unselect" - cancels current selection
- *	"UseCSS" - whether to allow use of CSS or not depending on whether @value is "true" or "false"
+ * Returns: @TRUE when the command was succesfully executed, @FALSE otherwise.
  */
 gboolean
 e_editor_widget_exec_command (EEditorWidget* widget,
-			      const gchar* command,
+			      EEditorWidgetCommand command,
 			      const gchar* value)
 {
 	WebKitDOMDocument *document;
+	const gchar *cmd_str = 0;
+	gboolean has_value;
 
-	g_return_if_fail (E_IS_EDITOR_WIDGET (widget));
-	g_return_if_fail (command && *command);
+	g_return_val_if_fail (E_IS_EDITOR_WIDGET (widget), FALSE);
+
+#define CHECK_COMMAND(cmd,str,val) case cmd:\
+	if (val) {\
+		g_return_val_if_fail (value && *value, FALSE);\
+	}\
+	has_value = val; \
+	cmd_str = str;\
+	break;
+
+	switch (command) {
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR, "BackColor", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_BOLD, "Bold", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_COPY, "Copy", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_CREATE_LINK, "CreateLink", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_CUT, "Cut", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR, "DefaultParagraphSeparator", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_DELETE, "Delete", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FIND_STRING, "FindString", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_NAME, "FontName", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_SIZE, "FontSize", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA, "FontSizeDelta", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORE_COLOR, "ForeColor", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK, "FormatBlock", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE, "ForwardDelete", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_HILITE_COLOR, "HiliteColor", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INDENT, "Indent", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE, "InsertHorizontalRule", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_HTML, "InsertHTML", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE, "InsertImage", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK, "InsertLineBreak", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT, "InsertNewlineInQuotedContent", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST, "InsertOrderedList", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH, "InsertParagraph", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, "InsertText", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST, "InsertUnorderedList", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_ITALIC, "Italic", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER, "JustifyCenter", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL, "JustifyFull", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT, "JustifyLeft", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE, "JustifyNone", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT, "JustifyRight", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_OUTDENT, "Outdent", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE, "Paste", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE, "PasteAndMatchStyle", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT, "PasteAsPlainText", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PRINT, "Print", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_REDO, "Redo", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT, "RemoveFormat", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SELECT_ALL, "SelectAll", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH, "Strikethrough", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS, "StyleWithCSS", TRUE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SUBSCRIPT, "Subscript", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT, "Superscript", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_TRANSPOSE, "Transpose", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNDERLINE, "Underline", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNDO, "Undo", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNLINK, "Unlink", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNSELECT, "Unselect", FALSE)
+		CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_USE_CSS, "UseCSS", TRUE)
+	}
 
 	document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
-	return webkit_dom_document_exec_command (document, command, FALSE, value ? value : "");
+	return webkit_dom_document_exec_command (
+		document, cmd_str, FALSE, has_value ? value : "" );
 }
 
 /**
@@ -1424,7 +1436,7 @@ e_editor_widget_set_spell_languages (EEditorWidget *widget,
 	g_return_if_fail (spell_languages);
 
 	g_list_free_full (widget->priv->spelling_langs, g_object_unref);
-	widget->priv->spelling_langs = g_list_copy (spell_languages);
+	widget->priv->spelling_langs = g_list_copy ((GList *) spell_languages);
 	g_list_foreach (widget->priv->spelling_langs, (GFunc) g_object_ref, NULL);
 
 	g_object_notify (G_OBJECT (widget), "spell-languages");
@@ -1595,13 +1607,8 @@ static void
 do_set_text_plain (EEditorWidget *widget,
 		   gpointer data)
 {
-	WebKitDOMDocument *document;
-
-	document =
-		webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
-
-	webkit_dom_document_exec_command (
-		document, "insertText", FALSE, data);
+	e_editor_widget_exec_command (
+		widget, E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, data);
 }
 
 /**
@@ -1800,3 +1807,4 @@ e_editor_widget_update_fonts (EEditorWidget *widget)
 	pango_font_description_free (ms);
 	pango_font_description_free (vw);
 }
+
diff --git a/e-util/e-editor-widget.h b/e-util/e-editor-widget.h
index 6b94d19..5d77c3e 100644
--- a/e-util/e-editor-widget.h
+++ b/e-util/e-editor-widget.h
@@ -58,6 +58,116 @@ typedef enum {
 	E_EDITOR_WIDGET_REPLACE_ANSWER_NEXT
 } EEditorWidgetReplaceAnswer;
 
+
+/**
+ * EEditorWidgetCommand:
+ * @E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR: Sets background color to given value.
+ * @E_EDITOR_WIDGET_COMMAND_BOLD: Toggles bold formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_COPY: Copies current selection to clipboard.
+ * @E_EDITOR_WIDGET_COMMAND_CREATE_LINK: Converts current selection to a link that points to URL in value
+ * @E_EDITOR_WIDGET_COMMAND_CUT: Cuts current selection to clipboard.
+ * @E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR:
+ * @E_EDITOR_WIDGET_COMMAND_DELETE: Deletes current selection.
+ * @E_EDITOR_WIDGET_COMMAND_FIND_STRING: Highlights given string.
+ * @E_EDITOR_WIDGET_COMMAND_FONT_NAME: Sets font name to given value.
+ * @E_EDITOR_WIDGET_COMMAND_FONT_SIZE: Sets font point size to given value (no units, just number)
+ * @E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA: Changes font size by given delta value (no units, just number)
+ * @E_EDITOR_WIDGET_COMMAND_FORE_COLOR: Sets font color to given value
+ * @E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK: Sets block type of current paragraph to given format. Allowed formats
+ * 	are "BLOCKQUOTE", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE" and "ADDRESS".
+ * @E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE:
+ * @E_EDITOR_WIDGET_COMMAND_HILITE_COLOR: Sets color in which results of "FindString" command should be highlighted to given value.
+ * @E_EDITOR_WIDGET_COMMAND_INDENT: Indents current paragraph by one level.
+ * @E_EDITOR_WIDGET_COMMAND_INSERTS_HTML: Inserts give HTML code into document.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE: Inserts a horizontal rule (&lt;HR&gt;) on current line.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE: Inserts an image with given source file.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK: Breaks line at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT: Breaks citation at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_ORDERERED_LIST: Creates an ordered list environment at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH: Inserts a new paragraph at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_TEXT: Inserts given text at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST: Creates an undordered list environment at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_ITALIC: Toggles italic formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER: Aligns current paragraph to center.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL: Justifies current paragraph to block.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE: Removes any justification or alignment of current paragraph.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT: Aligns current paragraph to right.
+ * @E_EDITOR_WIDGET_COMMAND_OUTDENT: Outdents current paragraph by one level.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE: Pastes clipboard content at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE: Pastes clipboard content and matches it's style to style at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT: Pastes clipboard content at current cursor position removing any HTML formatting.
+ * @E_EDITOR_WIDGET_COMMAND_PRINT: Print current document.
+ * @E_EDITOR_WIDGET_COMMAND_REDO: Redos last action.
+ * @E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT: Removes any formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_SELECT_ALL: Extends selects to the entire document.
+ * @E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH: Toggles strikethrough formatting.
+ * @E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS: Toggles whether style should be defined in CSS "style" attribute of elements or
+ *	whether to use deprecated <FONT> tags. Depends on whether given value is "true" or "false".
+ * @E_EDITOR_WIDGET_COMMAND_SUBSCRIPT: Toggles subscript of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT: Toggles superscript of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_TRANSPOSE:
+ * @E_EDITOR_WIDGET_COMMAND_UNDERLINE: Toggles underline formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_UNDO: Undos last action.
+ * @E_EDITOR_WIDGET_COMMAND_UNLINK:  Removes active links (&lt;A&gt;) from current selection (if there's any).
+ * @E_EDITOR_WIDGET_COMMAND_UNSELECT: Cancels current selection.
+ * @E_EDITOR_WIDGET_COMMAND_USE_CSS: Whether to allow use of CSS or not depending on whether given value is "true" or "false".
+ *
+ * Used to identify DOM command to execute using #e_editor_widget_exec_command().
+ * Some commands require value to be passed in, which is always stated in the documentation.
+ */
+
+typedef enum {
+	E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR,
+	E_EDITOR_WIDGET_COMMAND_BOLD,
+	E_EDITOR_WIDGET_COMMAND_COPY,
+	E_EDITOR_WIDGET_COMMAND_CREATE_LINK,
+	E_EDITOR_WIDGET_COMMAND_CUT,
+	E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR,
+	E_EDITOR_WIDGET_COMMAND_DELETE,
+	E_EDITOR_WIDGET_COMMAND_FIND_STRING,
+	E_EDITOR_WIDGET_COMMAND_FONT_NAME,
+	E_EDITOR_WIDGET_COMMAND_FONT_SIZE,
+	E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA,
+	E_EDITOR_WIDGET_COMMAND_FORE_COLOR,
+	E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK,
+	E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE,
+	E_EDITOR_WIDGET_COMMAND_HILITE_COLOR,
+	E_EDITOR_WIDGET_COMMAND_INDENT,
+	E_EDITOR_WIDGET_COMMAND_INSERT_HTML,
+	E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE,
+	E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE,
+	E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK,
+	E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT,
+	E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST,
+	E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH,
+	E_EDITOR_WIDGET_COMMAND_INSERT_TEXT,
+	E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST,
+	E_EDITOR_WIDGET_COMMAND_ITALIC,
+	E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER,
+	E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL,
+	E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT,
+	E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE,
+	E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT,
+	E_EDITOR_WIDGET_COMMAND_OUTDENT,
+	E_EDITOR_WIDGET_COMMAND_PASTE,
+	E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE,
+	E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT,
+	E_EDITOR_WIDGET_COMMAND_PRINT,
+	E_EDITOR_WIDGET_COMMAND_REDO,
+	E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT,
+	E_EDITOR_WIDGET_COMMAND_SELECT_ALL,
+	E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH,
+	E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS,
+	E_EDITOR_WIDGET_COMMAND_SUBSCRIPT,
+	E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT,
+	E_EDITOR_WIDGET_COMMAND_TRANSPOSE,
+	E_EDITOR_WIDGET_COMMAND_UNDERLINE,
+	E_EDITOR_WIDGET_COMMAND_UNDO,
+	E_EDITOR_WIDGET_COMMAND_UNLINK,
+	E_EDITOR_WIDGET_COMMAND_UNSELECT,
+	E_EDITOR_WIDGET_COMMAND_USE_CSS
+} EEditorWidgetCommand;
+
 typedef struct _EEditorWidget EEditorWidget;
 typedef struct _EEditorWidgetClass EEditorWidgetClass;
 typedef struct _EEditorWidgetPrivate EEditorWidgetPrivate;
@@ -85,7 +195,7 @@ EEditorSelection *
 		e_editor_widget_get_selection	(EEditorWidget *widget);
 
 gboolean	e_editor_widget_exec_command	(EEditorWidget *widget,
-						 const gchar *command,
+						 EEditorWidgetCommand command,
 						 const gchar *value);
 
 gboolean	e_editor_widget_get_changed	(EEditorWidget *widget);
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index 2d127c6..f7aa0b4 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -980,7 +980,6 @@ e_editor_set_filename (EEditor *editor,
  *
  * Returns: @TRUE when content is succesfully saved, @FALSE otherwise.
  */
- */
 gboolean
 e_editor_save (EEditor *editor,
 	       const gchar *filename,



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