[evolution/wip/webkit-composer: 521/966] Initial import of GtkhtmlEditor class



commit df3429fe1ff091597868a1877ab961a62ec737af
Author: Dan Vrátil <dvratil redhat com>
Date:   Thu Jul 26 21:18:08 2012 +0200

    Initial import of GtkhtmlEditor class
    
    GtkhtmlEditor => EEditor
    
    EEditor is a GtkBox which handles installation of menu actions and toolbars and
    bindings between EEditorWidget and these actions.
    
    As of now, only elementary formatting works.

 e-util/Makefile.am        |    6 +
 e-util/e-editor-actions.c | 1351 +++++++++++++++++++++++++++++++++++++++++++++
 e-util/e-editor-actions.h |   32 ++
 e-util/e-editor-private.h |   29 +
 e-util/e-editor-widgets.h |  234 ++++++++
 e-util/e-editor.c         |  383 +++++++++++++
 e-util/e-editor.h         |   32 ++
 e-util/e-util.h           |    3 +
 8 files changed, 2070 insertions(+), 0 deletions(-)
---
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 3998082..5ec388d 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -179,8 +179,11 @@ evolution_util_include_HEADERS =  \
        e-destination-store.h \
        e-dialog-utils.h \
        e-dialog-widgets.h \
+       e-editor-actions.h \
        e-editor-selection.h \
        e-editor-widget.h \
+       e-editor-widgets.h \
+       e-editor.h \
        e-emoticon-action.h \
        e-emoticon-chooser-menu.h \
        e-emoticon-chooser.h \
@@ -435,8 +438,11 @@ libevolution_util_la_SOURCES = \
        e-destination-store.c \
        e-dialog-utils.c \
        e-dialog-widgets.c \
+       e-editor-actions.c \
+       e-editor-private.h \
        e-editor-selection.c \
        e-editor-widget.c \
+       e-editor.c \
        e-emoticon-action.c \
        e-emoticon-chooser-menu.c \
        e-emoticon-chooser.c \
diff --git a/e-util/e-editor-actions.c b/e-util/e-editor-actions.c
index 7f511fe..a221c31 100644
--- a/e-util/e-editor-actions.c
+++ b/e-util/e-editor-actions.c
@@ -1,7 +1,10 @@
 /* e-editor-actions.c
  *
+<<<<<<< HEAD
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
  *
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
  * License as published by the Free Software Foundation.
@@ -17,6 +20,11 @@
  * Boston, MA 02111-1307, USA.
  */
 
+<<<<<<< HEAD
+=======
+//#include "e-editor-private.h"
+
+>>>>>>> Initial import of GtkhtmlEditor class
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -24,6 +32,7 @@
 #include <gio/gio.h>
 #include <glib/gi18n-lib.h>
 #include <string.h>
+<<<<<<< HEAD
 #include <enchant/enchant.h>
 
 #include "e-editor.h"
@@ -34,6 +43,15 @@
 #include "e-emoticon-chooser.h"
 #include "e-image-chooser-dialog.h"
 #include "e-spell-checker.h"
+=======
+
+#include "e-editor.h"
+#include "e-editor-actions.h"
+#include "e-editor-private.h"
+#include "e-editor-widgets.h"
+#include "e-emoticon-action.h"
+#include "e-image-chooser-dialog.h"
+>>>>>>> Initial import of GtkhtmlEditor class
 
 static void
 insert_html_file_ready_cb (GFile *file,
@@ -110,6 +128,7 @@ insert_text_file_ready_cb (GFile *file,
 }
 
 static void
+<<<<<<< HEAD
 editor_update_static_spell_actions (EEditor *editor)
 {
        ESpellChecker *checker;
@@ -131,11 +150,81 @@ editor_update_static_spell_actions (EEditor *editor)
 /*****************************************************************************
  * Action Callbacks
  *****************************************************************************/
+=======
+replace_answer (EEditor *editor,
+                EEditorWidgetReplaceAnswer answer)
+{
+       /* FIXME WEBKIT
+       if (e_editor_widget_replace (e_editor_get_editor_widget (editor), answer))
+               gtk_widget_hide (WIDGET (REPLACE_CONFIRMATION_WINDOW));
+       */
+}
+
+/*****************************************************************************
+ * Action Callbacks
+ *****************************************************************************/
+
+static void
+action_bold_cb (GtkToggleAction *action,
+                EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_bold (
+               selection, gtk_toggle_action_get_active (action));
+}
+
+
+static void
+action_confirm_replace_cb (GtkAction *action,
+                           EEditor *editor)
+{
+       replace_answer (editor, E_EDITOR_WIDGET_REPLACE_ANSWER_REPLACE);
+}
+
+static void
+action_confirm_replace_all_cb (GtkAction *action,
+                               EEditor *editor)
+{
+       replace_answer (editor, E_EDITOR_WIDGET_REPLACE_ANSWER_REPLACE_ALL);
+}
+
+static void
+action_confirm_replace_cancel_cb (GtkAction *action,
+                                  EEditor *editor)
+{
+       replace_answer (editor, E_EDITOR_WIDGET_REPLACE_ANSWER_CANCEL);
+}
+
+static void
+action_confirm_replace_next_cb (GtkAction *action,
+                                EEditor *editor)
+{
+       replace_answer (editor, E_EDITOR_WIDGET_REPLACE_ANSWER_NEXT);
+}
+
+static WebKitDOMNode *
+find_parent_element_by_type (WebKitDOMNode *node, GType type)
+{
+       while (node) {
+
+               if (g_type_is_a (type, webkit_dom_node_get_type ()))
+                       return node;
+
+               node = webkit_dom_node_get_parent_node (node);
+       }
+
+       return NULL;
+}
+>>>>>>> Initial import of GtkhtmlEditor class
 
 static void
 action_context_delete_cell_cb (GtkAction *action,
                                EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMNode *sibling;
        WebKitDOMElement *cell;
 
@@ -162,6 +251,65 @@ action_context_delete_cell_cb (GtkAction *action,
                        WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (sibling),
                        webkit_dom_html_table_cell_element_get_col_span (
                                WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (sibling)) + 1);
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *start, *end, *cell;
+       gboolean single_row;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       /* Find TD in which the selection starts */
+       start = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (start)) {
+               start = find_parent_element_by_type (
+                       start, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       /* Find TD in which the selection ends */
+       end = webkit_dom_range_get_end_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (end)) {
+               end = find_parent_element_by_type (
+                       end, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       single_row = (webkit_dom_node_get_parent_node (start) ==
+                       webkit_dom_node_get_parent_node (end));
+
+       cell = start;
+       while (cell) {
+               WebKitDOMNodeList *nodes;
+               gulong length, i;
+
+               /* Remove all child nodes in the cell */
+               nodes = webkit_dom_node_get_child_nodes (cell);
+               length = webkit_dom_node_list_get_length (nodes);
+               for (i = 0; i < length; i++) {
+                       webkit_dom_node_remove_child (
+                               cell,
+                               webkit_dom_node_list_item (nodes, i),
+                               NULL);
+               }
+
+               if (cell == end)
+                       break;
+
+               cell = webkit_dom_node_get_next_sibling (cell);
+
+               if (!cell && !single_row) {
+                       cell = webkit_dom_node_get_first_child (
+                               webkit_dom_node_get_parent_node (cell));
+               }
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 }
 
@@ -169,6 +317,7 @@ static void
 action_context_delete_column_cb (GtkAction *action,
                                  EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *cell, *table;
        WebKitDOMHTMLCollection *rows;
        gulong index, length, ii;
@@ -200,6 +349,59 @@ action_context_delete_column_cb (GtkAction *action,
 
                webkit_dom_html_table_row_element_delete_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), index, NULL);
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *start, *end, *first_row;
+       gulong index, count, i;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1) {
+               return;
+       }
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       /* Find TD in which the selection starts */
+       start = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (start)) {
+               start = find_parent_element_by_type (
+                       start, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       /* Find TD in which the selection ends */
+       end = webkit_dom_range_get_end_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (end)) {
+               end = find_parent_element_by_type (
+                       end, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       first_row = find_parent_element_by_type (
+               start, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       first_row = webkit_dom_node_get_first_child (
+               webkit_dom_node_get_parent_node (first_row));
+
+       index = webkit_dom_html_table_cell_element_get_cell_index (
+                       WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (start));
+       count = webkit_dom_html_table_cell_element_get_cell_index (
+                       WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (end)) - index;
+
+       for (i = 0; i < count; i++) {
+               WebKitDOMNode *row = first_row;
+
+               while (row) {
+                       webkit_dom_html_table_row_element_delete_cell (
+                               WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row),
+                               index, NULL);
+
+                       row = webkit_dom_node_get_next_sibling (row);
+               }
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 }
 
@@ -207,6 +409,7 @@ static void
 action_context_delete_row_cb (GtkAction *action,
                               EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *row;
 
        g_return_if_fail (editor->priv->table_cell != NULL);
@@ -217,10 +420,53 @@ action_context_delete_row_cb (GtkAction *action,
        webkit_dom_node_remove_child (
                webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (row)),
                WEBKIT_DOM_NODE (row), NULL);
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *start, *end, *table;
+       gulong index, row_count, i;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       start = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_ROW_ELEMENT (start)) {
+               start = find_parent_element_by_type (
+                       start, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       }
+
+       end = webkit_dom_range_get_end_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_ROW_ELEMENT (end)) {
+               end = find_parent_element_by_type (
+                       end, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       }
+
+       table = find_parent_element_by_type (
+                       start, WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT);
+
+       index = webkit_dom_html_table_row_element_get_row_index (
+                       WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (start));
+       row_count = webkit_dom_html_table_row_element_get_row_index (
+                       WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (end)) - index;
+
+       for (i = 0; i < row_count; i++) {
+               webkit_dom_html_table_element_delete_row (
+                       WEBKIT_DOM_HTML_TABLE_ELEMENT (table), index, NULL);
+       }
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_delete_table_cb (GtkAction *action,
+<<<<<<< HEAD
                                 EEditor *editor)
 {
        WebKitDOMElement *table;
@@ -233,12 +479,40 @@ action_context_delete_table_cb (GtkAction *action,
        webkit_dom_node_remove_child (
                webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (table)),
                WEBKIT_DOM_NODE (table), NULL);
+=======
+    EEditor *editor)
+{
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *table;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       table = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_ELEMENT (table)) {
+               table = find_parent_element_by_type (
+                       table, WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT);
+       }
+
+       webkit_dom_node_remove_child (
+               webkit_dom_node_get_parent_node (table), table, NULL);
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_insert_column_after_cb (GtkAction *action,
                                        EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *cell, *row;
        gulong index;
 
@@ -258,6 +532,35 @@ action_context_insert_column_after_cb (GtkAction *action,
        row = WEBKIT_DOM_ELEMENT (
                webkit_dom_node_get_first_child (
                        webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (row))));
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *cell, *row;
+       gulong index;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       cell = webkit_dom_range_get_end_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (cell)) {
+               cell = find_parent_element_by_type (
+                       cell, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       row = find_parent_element_by_type (
+               cell, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       /* Get the first row in the table */
+       row = webkit_dom_node_get_first_child (
+               webkit_dom_node_get_parent_node (row));
+>>>>>>> Initial import of GtkhtmlEditor class
 
        index = webkit_dom_html_table_cell_element_get_cell_index (
                        WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (cell));
@@ -266,8 +569,12 @@ action_context_insert_column_after_cb (GtkAction *action,
                webkit_dom_html_table_row_element_insert_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), index + 1, NULL);
 
+<<<<<<< HEAD
                row = WEBKIT_DOM_ELEMENT (
                        webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (row)));
+=======
+               row = webkit_dom_node_get_next_sibling (row);
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 }
 
@@ -275,6 +582,7 @@ static void
 action_context_insert_column_before_cb (GtkAction *action,
                                         EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *cell, *row;
        gulong index;
 
@@ -294,6 +602,35 @@ action_context_insert_column_before_cb (GtkAction *action,
        row = WEBKIT_DOM_ELEMENT (
                webkit_dom_node_get_first_child (
                        webkit_dom_node_get_parent_node (WEBKIT_DOM_NODE (row))));
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *cell, *row;
+       gulong index;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       cell = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (cell)) {
+               cell = find_parent_element_by_type (
+                       cell, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT);
+       }
+
+       row = find_parent_element_by_type (
+               cell, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       /* Get the first row in the table */
+       row = webkit_dom_node_get_first_child (
+               webkit_dom_node_get_parent_node (row));
+>>>>>>> Initial import of GtkhtmlEditor class
 
        index = webkit_dom_html_table_cell_element_get_cell_index (
                        WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (cell));
@@ -302,8 +639,12 @@ action_context_insert_column_before_cb (GtkAction *action,
                webkit_dom_html_table_row_element_insert_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), index - 1, NULL);
 
+<<<<<<< HEAD
                row = WEBKIT_DOM_ELEMENT (
                        webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (row)));
+=======
+               row = webkit_dom_node_get_next_sibling (row);
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 }
 
@@ -311,6 +652,7 @@ static void
 action_context_insert_row_above_cb (GtkAction *action,
                                     EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *row, *table;
        WebKitDOMHTMLCollection *cells;
        WebKitDOMHTMLElement *new_row;
@@ -338,12 +680,45 @@ action_context_insert_row_above_cb (GtkAction *action,
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (new_row), -1, NULL);
        }
 
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *row, *table;
+       gulong index;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       row = webkit_dom_range_get_start_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (row)) {
+               row = find_parent_element_by_type (
+                       row, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       }
+
+       table = find_parent_element_by_type (
+               row, WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT);
+
+       index = webkit_dom_html_table_row_element_get_row_index (
+                       WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row));
+
+       webkit_dom_html_table_element_insert_row (
+               WEBKIT_DOM_HTML_TABLE_ELEMENT (table), index - 1, NULL);
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_insert_row_below_cb (GtkAction *action,
                                     EEditor *editor)
 {
+<<<<<<< HEAD
        WebKitDOMElement *row, *table;
        WebKitDOMHTMLCollection *cells;
        WebKitDOMHTMLElement *new_row;
@@ -356,10 +731,37 @@ action_context_insert_row_below_cb (GtkAction *action,
 
        table = e_editor_dom_node_find_parent_element (WEBKIT_DOM_NODE (row), "TABLE");
        g_return_if_fail (table != NULL);
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *row, *table;
+       gulong index;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       row = webkit_dom_range_get_end_container (range, NULL);
+       if (!WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (row)) {
+               row = find_parent_element_by_type (
+                       row, WEBKIT_TYPE_DOM_HTML_TABLE_ROW_ELEMENT);
+       }
+
+       table = find_parent_element_by_type (
+               row, WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT);
+>>>>>>> Initial import of GtkhtmlEditor class
 
        index = webkit_dom_html_table_row_element_get_row_index (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row));
 
+<<<<<<< HEAD
        new_row = webkit_dom_html_table_element_insert_row (
                        WEBKIT_DOM_HTML_TABLE_ELEMENT (table), index + 1, NULL);
 
@@ -370,12 +772,17 @@ action_context_insert_row_below_cb (GtkAction *action,
                webkit_dom_html_table_row_element_insert_cell (
                        WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (new_row), -1, NULL);
        }
+=======
+       webkit_dom_html_table_element_insert_row (
+               WEBKIT_DOM_HTML_TABLE_ELEMENT (table), index + 1, NULL);
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_remove_link_cb (GtkAction *action,
                                EEditor *editor)
 {
+<<<<<<< HEAD
        EEditorWidget *widget;
        EEditorSelection *selection;
 
@@ -383,12 +790,20 @@ action_context_remove_link_cb (GtkAction *action,
        selection = e_editor_widget_get_selection (widget);
 
        e_editor_selection_unlink (selection);
+=======
+       WebKitDOMDocument *document;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       webkit_dom_document_exec_command (document, "unlink", FALSE, "");
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_spell_add_cb (GtkAction *action,
                              EEditor *editor)
 {
+<<<<<<< HEAD
        ESpellChecker *spell_checker;
        EEditorSelection *selection;
        gchar *word;
@@ -400,12 +815,36 @@ action_context_spell_add_cb (GtkAction *action,
        if (word && *word) {
                e_spell_checker_learn_word (spell_checker, word);
        }
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitSpellChecker *spell_checker;
+       gchar *word;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+       word = webkit_dom_range_get_text (range);
+
+       spell_checker = WEBKIT_SPELL_CHECKER (webkit_get_text_checker ());
+       webkit_spell_checker_learn_word (spell_checker, word);
+
+       g_free (word);
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_context_spell_ignore_cb (GtkAction *action,
                                 EEditor *editor)
 {
+<<<<<<< HEAD
        ESpellChecker *spell_checker;
        EEditorSelection *selection;
        gchar *word;
@@ -417,6 +856,29 @@ action_context_spell_ignore_cb (GtkAction *action,
        if (word && *word) {
                e_spell_checker_ignore_word (spell_checker, word);
        }
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitSpellChecker *spell_checker;
+       gchar *word;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+       word = webkit_dom_range_get_text (range);
+
+       spell_checker = WEBKIT_SPELL_CHECKER (webkit_get_text_checker ());
+       webkit_spell_checker_ignore_word (spell_checker, word);
+
+       g_free (word);
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -436,14 +898,163 @@ action_cut_cb (GtkAction *action,
 }
 
 static void
+<<<<<<< HEAD
 action_indent_cb (GtkAction *action,
                   EEditor *editor)
 {
        e_editor_selection_indent (editor->priv->selection);
+=======
+action_find_cb (GtkAction *action,
+                EEditor *editor)
+{
+       gboolean found;
+
+
+       found = webkit_web_view_search_text (
+               WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)),
+               gtk_entry_get_text (GTK_ENTRY (WIDGET (FIND_ENTRY))),
+               gtk_toggle_button_get_active (
+                       GTK_TOGGLE_BUTTON (WIDGET (FIND_CASE_SENSITIVE))),
+               !gtk_toggle_button_get_active (
+                       GTK_TOGGLE_BUTTON (WIDGET (FIND_BACKWARDS))),
+               gtk_toggle_button_get_active (
+                       GTK_TOGGLE_BUTTON (WIDGET (FIND_WRAP))));
+
+       gtk_action_set_sensitive (ACTION (FIND), found);
+
+       if (!found)
+               gtk_label_set_label (
+                       GTK_LABEL (WIDGET (FIND_RESULT_LABEL)),
+                       N_("No match found"));
+}
+
+static void
+action_find_again_cb (GtkAction *action,
+                      EEditor *editor)
+{
+       /* FIXME WEBKIT
+        * Verify that this actually works and if so, then just change the
+        * callback and remove this function. If not, then we are in trouble...
+        */
+
+       action_find_cb (action, editor);
+}
+
+
+static void
+action_find_and_replace_cb (GtkAction *action,
+                            EEditor *editor)
+{
+       WebKitDOMDocument *document;
+       WebKitDOMNode *start, *end;
+       WebKitDOMNodeList *children;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       WebKitDOMNode *node;
+
+       gulong length, i;
+       const gchar *needle, *replacement;
+       gboolean case_sensitive, backwards, wrap, only_selection;
+
+       needle = gtk_entry_get_text (GTK_ENTRY (WIDGET (REPLACE_ENTRY)));
+       replacement = gtk_entry_get_text (
+                               GTK_ENTRY (WIDGET (REPLACE_WITH_ENTRY)));
+       case_sensitive = gtk_toggle_button_get_active (
+                               GTK_TOGGLE_BUTTON (WIDGET (REPLACE_CASE_SENSITIVE)));
+       wrap = gtk_toggle_button_get_active (
+                               GTK_TOGGLE_BUTTON (WIDGET (REPLACE_WRAP)));
+       backwards = gtk_toggle_button_get_active (
+                               GTK_TOGGLE_BUTTON (WIDGET (REPLACE_BACKWARDS)));
+       only_selection = gtk_toggle_button_get_active (
+                               GTK_TOGGLE_BUTTON (WIDGET (REPLACE_ONLY_SELECTION)));
+
+       /* XXX Port this if to native WebKit API if they ever implement
+        * support for find&replace...unless this implementation
+        * is better ;) */
+
+       /* FIXME WEBKIT This is not working at all */
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+       start = webkit_dom_range_get_start_container (range, NULL);
+
+       if (only_selection) {
+               end = webkit_dom_range_get_end_container (range, NULL);
+       } else {
+               end = NULL;
+       }
+
+       /* WEBKIT FIXME Implement me! */
+       /*
+       node = start;
+       while (node && (node != end)) {
+
+
+
+       }
+       */
+
+       /*
+       html = gtkhtml_editor_get_html (editor);
+
+       gtk_widget_hide (WIDGET (REPLACE_WINDOW));
+
+       html_engine_replace (
+               html->engine,
+               gtk_entry_get_text (GTK_ENTRY (WIDGET (REPLACE_ENTRY))),
+               gtk_entry_get_text (GTK_ENTRY (WIDGET (REPLACE_WITH_ENTRY))),
+               gtk_toggle_button_get_active (
+                       GTK_TOGGLE_BUTTON (WIDGET (REPLACE_CASE_SENSITIVE))),
+               !gtk_toggle_button_get_active (
+                       GTK_TOGGLE_BUTTON (WIDGET (REPLACE_BACKWARDS))),
+               FALSE, replace_ask_cb, editor);
+       */
+}
+
+/* FIXME WEBKIT
+static void
+replace_ask_cb (HTMLEngine *engine,
+                gpointer data)
+{
+       GtkhtmlEditor *editor = data;
+
+       gtk_window_present (GTK_WINDOW (WIDGET (REPLACE_CONFIRMATION_WINDOW)));
+}
+
+static void
+replace_answer (GtkhtmlEditor *editor,
+                HTMLReplaceQueryAnswer answer)
+{
+       GtkHTML *html;
+
+       html = gtkhtml_editor_get_html (editor);
+
+       if (html_engine_replace_do (html->engine, answer))
+               gtk_widget_hide (WIDGET (REPLACE_CONFIRMATION_WINDOW));
+}
+*/
+
+static void
+action_indent_cb (GtkAction *action,
+                  EEditor *editor)
+{
+       WebKitDOMDocument *document;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       webkit_dom_document_exec_command (document, "indent", FALSE, "");
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_insert_emoticon_cb (GtkAction *action,
+<<<<<<< HEAD
                            EEditor *editor)
 {
        EEditorWidget *widget;
@@ -455,6 +1066,47 @@ action_insert_emoticon_cb (GtkAction *action,
 
        widget = e_editor_get_editor_widget (editor);
        e_editor_widget_insert_smiley (widget, emoticon);
+=======
+      EEditor *editor)
+{
+       /* FIXME WEBKIT
+       GtkHTML *html;
+       HTMLObject *image;
+       GtkIconInfo *icon_info;
+       GtkIconTheme *icon_theme;
+       GtkhtmlFaceChooser *chooser;
+       GtkhtmlFace *face;
+       const gchar *filename;
+       gchar *uri = NULL;
+
+       html = gtkhtml_editor_get_html (editor);
+
+       chooser = GTKHTML_FACE_CHOOSER (action);
+       face = gtkhtml_face_chooser_get_current_face (chooser);
+       g_return_if_fail (face != NULL);
+
+       icon_theme = gtk_icon_theme_get_default ();
+       icon_info = gtk_icon_theme_lookup_icon (
+               icon_theme, face->icon_name, 16, 0);
+       g_return_if_fail (icon_info != NULL);
+
+       filename = gtk_icon_info_get_filename (icon_info);
+       if (filename != NULL)
+               uri = g_filename_to_uri (filename, NULL, NULL);
+       gtk_icon_info_free (icon_info);
+       g_return_if_fail (uri != NULL);
+
+       image = html_image_new (
+               html_engine_get_image_factory (html->engine),
+               uri, NULL, NULL, -1, -1, FALSE, FALSE, 0, NULL,
+               HTML_VALIGN_MIDDLE, FALSE);
+       html_image_set_alt (HTML_IMAGE (image), face->text_face);
+       html_engine_paste_object (
+               html->engine, image, html_object_get_length (image));
+
+       g_free (uri);
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -465,10 +1117,17 @@ action_insert_html_file_cb (GtkToggleAction *action,
        GtkFileFilter *filter;
 
        dialog = gtk_file_chooser_dialog_new (
+<<<<<<< HEAD
                _("Insert HTML File"), NULL,
                GTK_FILE_CHOOSER_ACTION_OPEN,
                GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+=======
+                       _("Insert HTML File"), NULL,
+                       GTK_FILE_CHOOSER_ACTION_OPEN,
+                       GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+>>>>>>> Initial import of GtkhtmlEditor class
 
        filter = gtk_file_filter_new ();
        gtk_file_filter_set_name (filter, _("HTML file"));
@@ -476,9 +1135,14 @@ action_insert_html_file_cb (GtkToggleAction *action,
        gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
 
        if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+<<<<<<< HEAD
                GFile *file;
 
                file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+=======
+               GFile *file = gtk_file_chooser_get_file (
+                                       GTK_FILE_CHOOSER (dialog));
+>>>>>>> Initial import of GtkhtmlEditor class
 
                /* XXX Need a way to cancel this. */
                g_file_load_contents_async (
@@ -498,6 +1162,7 @@ action_insert_image_cb (GtkAction *action,
 {
        GtkWidget *dialog;
 
+<<<<<<< HEAD
        dialog = e_image_chooser_dialog_new (_("Insert Image"), NULL);
 
        if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
@@ -512,6 +1177,22 @@ action_insert_image_cb (GtkAction *action,
                e_editor_selection_insert_image (selection, uri);
 
                g_free (uri);
+=======
+       dialog = e_image_chooser_dialog_new (
+                       _("Insert Image"), NULL);
+
+       if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+               gchar *uri;
+               EEditorSelection *selection;
+
+                uri = gtk_file_chooser_get_uri (
+                               GTK_FILE_CHOOSER (dialog));
+
+                selection = e_editor_widget_get_selection (
+                               e_editor_get_editor_widget (editor));
+                e_editor_selection_insert_image (selection, uri);
+                g_free (uri);
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 
        gtk_widget_destroy (dialog);
@@ -521,33 +1202,89 @@ static void
 action_insert_link_cb (GtkAction *action,
                        EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->link_dialog == NULL)
                editor->priv->link_dialog =
                        e_editor_link_dialog_new (editor);
 
        gtk_window_present (GTK_WINDOW (editor->priv->link_dialog));
+=======
+       /* FIXME WEBKIT */
+       gtk_window_present (GTK_WINDOW (WIDGET (LINK_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_insert_rule_cb (GtkAction *action,
                        EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->hrule_dialog == NULL)
                editor->priv->hrule_dialog =
                        e_editor_hrule_dialog_new (editor);
 
        gtk_window_present (GTK_WINDOW (editor->priv->hrule_dialog));
+=======
+       WebKitDOMDocument *document;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       webkit_dom_document_exec_command (
+               document, "insertHorizontalRule", FALSE, "");
+
+       /* FIXME WEBKIT - does the action work? */
+       gtk_action_activate (ACTION (PROPERTIES_RULE));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_insert_table_cb (GtkAction *action,
                         EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->table_dialog == NULL)
                editor->priv->table_dialog =
                        e_editor_table_dialog_new (editor);
 
        gtk_window_present (GTK_WINDOW (editor->priv->table_dialog));
+=======
+       WebKitDOMDocument *document;
+       WebKitDOMElement *table;
+       WebKitDOMDOMWindow *window;
+       WebKitDOMDOMSelection *selection;
+       WebKitDOMRange *range;
+       gint i;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       window = webkit_dom_document_get_default_view (document);
+       selection = webkit_dom_dom_window_get_selection (window);
+       if (webkit_dom_dom_selection_get_range_count (selection) < 1)
+               return;
+
+       range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+       /* Default 3x3 table */
+       table = webkit_dom_document_create_element (document, "TABLE", NULL);
+       for (i = 0; i < 3; i++) {
+               WebKitDOMHTMLElement *row;
+               gint j;
+
+               row = webkit_dom_html_table_element_insert_row (
+                       WEBKIT_DOM_HTML_TABLE_ELEMENT (table), -1, NULL);
+
+               for (j = 0; j < 3; j++) {
+                       webkit_dom_html_table_row_element_insert_cell (
+                               WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row),
+                               -1, NULL);
+               }
+       }
+
+       webkit_dom_range_insert_node (range, WEBKIT_DOM_NODE (table), NULL);
+
+       /* FIXME WEBKIT - does the action work? */
+       gtk_action_activate (ACTION (PROPERTIES_TABLE));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -558,10 +1295,17 @@ action_insert_text_file_cb (GtkAction *action,
        GtkFileFilter *filter;
 
        dialog = gtk_file_chooser_dialog_new (
+<<<<<<< HEAD
                _("Insert text file"), NULL,
                GTK_FILE_CHOOSER_ACTION_OPEN,
                GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+=======
+                       _("Insert text file"), NULL,
+                       GTK_FILE_CHOOSER_ACTION_OPEN,
+                       GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+>>>>>>> Initial import of GtkhtmlEditor class
 
        filter = gtk_file_filter_new ();
        gtk_file_filter_set_name (filter, _("Text file"));
@@ -569,9 +1313,14 @@ action_insert_text_file_cb (GtkAction *action,
        gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
 
        if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+<<<<<<< HEAD
                GFile *file;
 
                file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+=======
+               GFile *file = gtk_file_chooser_get_file (
+                                       GTK_FILE_CHOOSER (dialog));
+>>>>>>> Initial import of GtkhtmlEditor class
 
                /* XXX Need a way to cancel this. */
                g_file_load_contents_async (
@@ -586,6 +1335,7 @@ action_insert_text_file_cb (GtkAction *action,
 }
 
 static void
+<<<<<<< HEAD
 action_language_cb (GtkToggleAction *toggle_action,
                     EEditor *editor)
 {
@@ -631,6 +1381,106 @@ update_mode_combobox (gpointer data)
                GTK_RADIO_ACTION (action), (is_html ? 1 : 0));
 
        return FALSE;
+=======
+action_italic_cb (GtkToggleAction *action,
+                  EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_italic (
+               selection, gtk_toggle_action_get_active (action));
+}
+
+static void
+action_justify_cb (GtkRadioAction *action,
+                   GtkRadioAction *current,
+                   EEditor *editor)
+{
+       WebKitDOMDocument *document;
+       const gchar *command;
+
+       document = webkit_web_view_get_dom_document (
+                       WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+
+       switch (gtk_radio_action_get_current_value (current))
+       {
+               case E_EDITOR_SELECTION_ALIGNMENT_CENTER:
+                       command = "justifyCenter";
+                       break;
+
+               case E_EDITOR_SELECTION_ALIGNMENT_LEFT:
+                       command = "justifyLeft";
+                       break;
+
+               case E_EDITOR_SELECTION_ALIGNMENT_RIGHT:
+                       command = "justifyRight";
+                       break;
+       }
+
+       webkit_dom_document_exec_command (document, command, FALSE, "");
+}
+
+static void
+action_language_cb (GtkToggleAction *action,
+                    EEditor *editor)
+{
+       /* FIXME WEBKIT */
+       /*
+       const GtkhtmlSpellLanguage *language;
+       GtkhtmlSpellChecker *checker;
+       const gchar *language_code;
+       GtkAction *add_action;
+       GtkHTML *html;
+       GList *list;
+       guint length;
+       gchar *action_name;
+       gboolean active;
+
+       active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+       language_code = gtk_action_get_name (GTK_ACTION (action));
+       language = gtkhtml_spell_language_lookup (language_code);
+
+       checker = g_hash_table_lookup (
+               editor->priv->available_spell_checkers, language);
+       g_return_if_fail (checker != NULL);
+
+       //Update the list of active spell checkers.
+       list = editor->priv->active_spell_checkers;
+       if (active)
+               list = g_list_insert_sorted (
+                       list, g_object_ref (checker),
+                       (GCompareFunc) gtkhtml_spell_checker_compare);
+       else {
+               GList *link;
+
+               link = g_list_find (list, checker);
+               g_return_if_fail (link != NULL);
+               list = g_list_delete_link (list, link);
+               g_object_unref (checker);
+       }
+       editor->priv->active_spell_checkers = list;
+       length = g_list_length (list);
+
+       // Update "Add Word To" context menu item visibility.
+       action_name = g_strdup_printf ("context-spell-add-%s", language_code);
+       add_action = gtkhtml_editor_get_action (editor, action_name);
+       gtk_action_set_visible (add_action, active);
+       g_free (action_name);
+
+       gtk_action_set_visible (ACTION (CONTEXT_SPELL_ADD), length == 1);
+       gtk_action_set_visible (ACTION (CONTEXT_SPELL_ADD_MENU), length > 1);
+       gtk_action_set_visible (ACTION (CONTEXT_SPELL_IGNORE), length > 0);
+
+       gtk_action_set_sensitive (ACTION (SPELL_CHECK), length > 0);
+
+       html = gtkhtml_editor_get_html (editor);
+       html_engine_spell_check (html->engine);
+
+       gtkthtml_editor_emit_spell_languages_changed (editor);
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -638,6 +1488,7 @@ action_mode_cb (GtkRadioAction *action,
                 GtkRadioAction *current,
                 EEditor *editor)
 {
+<<<<<<< HEAD
        GtkActionGroup *action_group;
        EEditorWidget *editor_widget;
        gboolean is_html;
@@ -671,31 +1522,144 @@ action_mode_cb (GtkRadioAction *action,
        gtk_action_set_sensitive (ACTION (STYLE_H5), is_html);
        gtk_action_set_sensitive (ACTION (STYLE_H6), is_html);
        gtk_action_set_sensitive (ACTION (STYLE_ADDRESS), is_html);
+=======
+       /* FIXME WEBKIT */
+       /*
+       GtkActionGroup *action_group;
+       HTMLPainter *new_painter;
+       HTMLPainter *old_painter;
+       GtkHTML *html;
+       EditorMode mode;
+       gboolean html_mode;
+
+       html = gtkhtml_editor_get_html (editor);
+       mode = gtk_radio_action_get_current_value (current);
+       html_mode = (mode == EDITOR_MODE_HTML);
+
+       action_group = editor->priv->html_actions;
+       gtk_action_group_set_sensitive (action_group, html_mode);
+
+       action_group = editor->priv->html_context_actions;
+       gtk_action_group_set_visible (action_group, html_mode);
+
+       gtk_widget_set_sensitive (editor->priv->color_combo_box, html_mode);
+
+       if (html_mode)
+               gtk_widget_show (editor->priv->html_toolbar);
+       else
+               gtk_widget_hide (editor->priv->html_toolbar);
+
+       // Certain paragraph styles are HTML-only.
+       gtk_action_set_sensitive (ACTION (STYLE_H1), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_H2), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_H3), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_H4), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_H5), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_H6), html_mode);
+       gtk_action_set_sensitive (ACTION (STYLE_ADDRESS), html_mode);
+
+       // Swap painters.
+
+       if (html_mode) {
+               new_painter = editor->priv->html_painter;
+               old_painter = editor->priv->plain_painter;
+       } else {
+               new_painter = editor->priv->plain_painter;
+               old_painter = editor->priv->html_painter;
+       }
+
+       // Might be true during initialization.
+       if (html->engine->painter == new_painter)
+               return;
+
+       html_gdk_painter_unrealize (HTML_GDK_PAINTER (old_painter));
+       if (html->engine->window != NULL)
+               html_gdk_painter_realize (
+                       HTML_GDK_PAINTER (new_painter),
+                       html->engine->window);
+
+       html_font_manager_set_default (
+               &new_painter->font_manager,
+               old_painter->font_manager.variable.face,
+               old_painter->font_manager.fixed.face,
+               old_painter->font_manager.var_size,
+               old_painter->font_manager.var_points,
+               old_painter->font_manager.fix_size,
+               old_painter->font_manager.fix_points);
+
+       html_engine_set_painter (html->engine, new_painter);
+       html_engine_schedule_redraw (html->engine);
+
+       g_object_notify (G_OBJECT (editor), "html-mode");
+       */
+}
+
+static void
+action_monospaced_cb (GtkToggleAction *action,
+                      EEditor *editor)
+{
+       /* FIXME WEBKIT */
+       /*
+       GtkHTML *html;
+       GtkHTMLFontStyle and_mask;
+       GtkHTMLFontStyle or_mask;
+
+       if (editor->priv->ignore_style_change)
+               return;
+
+       if (gtk_toggle_action_get_active (action)) {
+               and_mask = GTK_HTML_FONT_STYLE_MAX;
+               or_mask = GTK_HTML_FONT_STYLE_FIXED;
+       } else {
+               and_mask = ~GTK_HTML_FONT_STYLE_FIXED;
+               or_mask = 0;
+       }
+
+       html = gtkhtml_editor_get_html (editor);
+       gtk_html_set_font_style (html, and_mask, or_mask);
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_paste_cb (GtkAction *action,
                  EEditor *editor)
 {
+<<<<<<< HEAD
        /* Paste only into WebView when it has focus */
        if (gtk_widget_has_focus (GTK_WIDGET (e_editor_get_editor_widget (editor)))) {
                webkit_web_view_paste_clipboard (
                        WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
        }
+=======
+       webkit_web_view_paste_clipboard (
+               WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_paste_quote_cb (GtkAction *action,
                        EEditor *editor)
 {
+<<<<<<< HEAD
        e_editor_widget_paste_clipboard_quoted (
                e_editor_get_editor_widget (editor));
+=======
+       /* FIXME WEBKIT */
+       /*
+       GtkHTML *html;
+
+       html = gtkhtml_editor_get_html (editor);
+       gtk_html_paste (html, TRUE);
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_cell_cb (GtkAction *action,
                            EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->cell_dialog == NULL) {
                editor->priv->cell_dialog =
                        e_editor_cell_dialog_new (editor);
@@ -704,12 +1668,16 @@ action_properties_cell_cb (GtkAction *action,
        e_editor_cell_dialog_show (
                E_EDITOR_CELL_DIALOG (editor->priv->cell_dialog),
                editor->priv->table_cell);
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (CELL_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_image_cb (GtkAction *action,
                             EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->image_dialog == NULL) {
                editor->priv->image_dialog =
                        e_editor_image_dialog_new (editor);
@@ -718,78 +1686,122 @@ action_properties_image_cb (GtkAction *action,
        e_editor_image_dialog_show (
                E_EDITOR_IMAGE_DIALOG (editor->priv->image_dialog),
                editor->priv->image);
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (IMAGE_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_link_cb (GtkAction *action,
                            EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->link_dialog == NULL) {
                editor->priv->link_dialog =
                        e_editor_link_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->link_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (LINK_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_page_cb (GtkAction *action,
                            EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->page_dialog == NULL) {
                editor->priv->page_dialog =
                        e_editor_page_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->page_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (PAGE_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_paragraph_cb (GtkAction *action,
                                 EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->paragraph_dialog == NULL) {
                editor->priv->paragraph_dialog =
                        e_editor_paragraph_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->paragraph_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (PARAGRAPH_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_rule_cb (GtkAction *action,
                            EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->hrule_dialog == NULL) {
                editor->priv->hrule_dialog =
                        e_editor_hrule_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->hrule_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (RULE_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_table_cb (GtkAction *action,
                             EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->table_dialog == NULL) {
                editor->priv->table_dialog =
                        e_editor_table_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->table_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (TABLE_PROPERTIES_WINDOW)));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_properties_text_cb (GtkAction *action,
                            EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->text_dialog == NULL) {
                editor->priv->text_dialog =
                        e_editor_text_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->text_dialog));
+=======
+       gtk_window_present (GTK_WINDOW (WIDGET (TEXT_PROPERTIES_WINDOW)));
+}
+
+static void
+action_style_cb (GtkRadioAction *action,
+                 GtkRadioAction *current,
+                 EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       /* FIXME WEBKIT What's this good for? */
+       if (editor->priv->ignore_style_change)
+               return;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_block_format (
+               selection, gtk_radio_action_get_current_value (current));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -812,6 +1824,7 @@ static void
 action_show_find_cb (GtkAction *action,
                      EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->find_dialog == NULL) {
                editor->priv->find_dialog = e_editor_find_dialog_new (editor);
                gtk_action_set_sensitive (ACTION (FIND_AGAIN), TRUE);
@@ -842,18 +1855,102 @@ action_show_replace_cb (GtkAction *action,
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->replace_dialog));
+=======
+       gtk_widget_set_sensitive (WIDGET (FIND_BUTTON), TRUE);
+
+       gtk_window_present (GTK_WINDOW (WIDGET (FIND_WINDOW)));
+}
+
+static void
+action_show_replace_cb (GtkAction *action,
+                        EEditor *editor)
+{
+       gtk_window_present (GTK_WINDOW (WIDGET (REPLACE_WINDOW)));
+}
+
+static void
+action_size_cb (GtkRadioAction *action,
+                GtkRadioAction *current,
+                EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       if (editor->priv->ignore_style_change)
+               return;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_font_size (
+               selection, gtk_radio_action_get_current_value (current));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_spell_check_cb (GtkAction *action,
                        EEditor *editor)
 {
+<<<<<<< HEAD
        if (editor->priv->spell_check_dialog == NULL) {
                editor->priv->spell_check_dialog =
                        e_editor_spell_check_dialog_new (editor);
        }
 
        gtk_window_present (GTK_WINDOW (editor->priv->spell_check_dialog));
+=======
+       /* FIXME WEBKIT
+       e_editor_widget_spell_check (editor);
+       */
+}
+
+static void
+action_strikethrough_cb (GtkToggleAction *action,
+                         EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       if (editor->priv->ignore_style_change)
+               return;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_italic (
+               selection, gtk_toggle_action_get_active (action));
+}
+
+static void
+action_test_url_cb (GtkAction *action,
+                    EEditor *editor)
+{
+       /* FIXME WEBKIT What does this do? */
+       /*
+       GtkEntry *entry;
+       GtkWindow *window;
+       const gchar *text;
+
+       entry = GTK_ENTRY (WIDGET (LINK_PROPERTIES_URL_ENTRY));
+       window = GTK_WINDOW (WIDGET (LINK_PROPERTIES_WINDOW));
+
+       text = gtk_entry_get_text (entry);
+
+       if (text != NULL && *text != '\0')
+               gtkhtml_editor_show_uri (window, text);
+       */
+}
+
+static void
+action_underline_cb (GtkToggleAction *action,
+                     EEditor *editor)
+{
+       EEditorSelection *selection;
+
+       if (editor->priv->ignore_style_change)
+               return;
+
+       selection = e_editor_widget_get_selection (
+                       e_editor_get_editor_widget (editor));
+       e_editor_selection_set_underline (
+               selection, gtk_toggle_action_get_active (action));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
@@ -868,13 +1965,23 @@ static void
 action_unindent_cb (GtkAction *action,
                     EEditor *editor)
 {
+<<<<<<< HEAD
        e_editor_selection_unindent (editor->priv->selection);
+=======
+       WebKitDOMDocument *document;
+
+       document = webkit_web_view_get_dom_document (
+               WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
+       webkit_dom_document_exec_command (
+               document, "outdent", FALSE, "");
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 action_wrap_lines_cb (GtkAction *action,
                       EEditor *editor)
 {
+<<<<<<< HEAD
        e_editor_selection_wrap_lines (editor->priv->selection);
 }
 
@@ -889,6 +1996,12 @@ action_show_webkit_inspector_cb (GtkAction *action,
        inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (widget));
 
        webkit_web_inspector_show (inspector);
+=======
+       /* FIXME WEBKIT */
+       /*
+       e_editor_widget_wrap_lines (editor);
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 /*****************************************************************************
@@ -899,6 +2012,37 @@ action_show_webkit_inspector_cb (GtkAction *action,
 
 static GtkActionEntry core_entries[] = {
 
+<<<<<<< HEAD
+=======
+       { "confirm-replace",
+         NULL,
+         N_("_Replace"),
+         NULL,
+         NULL,
+         G_CALLBACK (action_confirm_replace_cb) },
+
+       { "confirm-replace-all",
+         NULL,
+         N_("Replace _All"),
+         NULL,
+         NULL,
+         G_CALLBACK (action_confirm_replace_all_cb) },
+
+       { "confirm-replace-cancel",
+         GTK_STOCK_CLOSE,
+         NULL,
+         NULL,
+         NULL,
+         G_CALLBACK (action_confirm_replace_cancel_cb) },
+
+       { "confirm-replace-next",
+         NULL,
+         N_("_Next"),
+         NULL,
+         NULL,
+         G_CALLBACK (action_confirm_replace_next_cb) },
+
+>>>>>>> Initial import of GtkhtmlEditor class
        { "copy",
          GTK_STOCK_COPY,
          N_("_Copy"),
@@ -913,6 +2057,30 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_cut_cb) },
 
+<<<<<<< HEAD
+=======
+       { "find",
+         GTK_STOCK_FIND,
+         NULL,
+         NULL,
+         NULL,
+         G_CALLBACK (action_find_cb) },
+
+       { "find-again",
+         NULL,
+         N_("Find A_gain"),
+         "<Control>g",
+         NULL,
+         G_CALLBACK (action_find_again_cb) },
+
+       { "find-and-replace",
+         GTK_STOCK_FIND_AND_REPLACE,
+         NULL,
+         NULL,
+         NULL,
+         G_CALLBACK (action_find_and_replace_cb) },
+
+>>>>>>> Initial import of GtkhtmlEditor class
        { "indent",
          GTK_STOCK_INDENT,
          N_("_Increase Indent"),
@@ -969,6 +2137,7 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_show_find_cb) },
 
+<<<<<<< HEAD
        { "find-again",
          NULL,
          N_("Find A_gain"),
@@ -976,6 +2145,8 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_find_again_cb) },
 
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
        { "show-replace",
          GTK_STOCK_FIND_AND_REPLACE,
          N_("Re_place..."),
@@ -990,6 +2161,16 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_spell_check_cb) },
 
+<<<<<<< HEAD
+=======
+       { "test-url",
+         NULL,
+         N_("_Test URL..."),
+         NULL,
+         NULL,
+         G_CALLBACK (action_test_url_cb) },
+
+>>>>>>> Initial import of GtkhtmlEditor class
        { "undo",
          GTK_STOCK_UNDO,
          N_("_Undo"),
@@ -1011,6 +2192,7 @@ static GtkActionEntry core_entries[] = {
          NULL,
          G_CALLBACK (action_wrap_lines_cb) },
 
+<<<<<<< HEAD
        { "webkit-inspector",
           NULL,
           N_("Open Inspector"),
@@ -1018,6 +2200,8 @@ static GtkActionEntry core_entries[] = {
           NULL,
           G_CALLBACK (action_show_webkit_inspector_cb) },
 
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
        /* Menus */
 
        { "edit-menu",
@@ -1108,14 +2292,22 @@ static GtkRadioActionEntry core_mode_entries[] = {
          N_("_HTML"),
          NULL,
          N_("HTML editing mode"),
+<<<<<<< HEAD
          TRUE },       /* e_editor_widget_set_html_mode */
+=======
+         E_EDITOR_WIDGET_MODE_HTML },
+>>>>>>> Initial import of GtkhtmlEditor class
 
        { "mode-plain",
          NULL,
          N_("Plain _Text"),
          NULL,
          N_("Plain text editing mode"),
+<<<<<<< HEAD
          FALSE }       /* e_editor_widget_set_html_mode */
+=======
+         E_EDITOR_WIDGET_MODE_PLAIN_TEXT }
+>>>>>>> Initial import of GtkhtmlEditor class
 };
 
 static GtkRadioActionEntry core_style_entries[] = {
@@ -1169,6 +2361,7 @@ static GtkRadioActionEntry core_style_entries[] = {
          NULL,
          E_EDITOR_SELECTION_BLOCK_FORMAT_H6 },
 
+<<<<<<< HEAD
         { "style-preformat",
           NULL,
           N_("_Preformatted"),
@@ -1176,6 +2369,8 @@ static GtkRadioActionEntry core_style_entries[] = {
           NULL,
           E_EDITOR_SELECTION_BLOCK_FORMAT_PRE },
 
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
        { "style-address",
          NULL,
          N_("A_ddress"),
@@ -1183,12 +2378,21 @@ static GtkRadioActionEntry core_style_entries[] = {
          NULL,
          E_EDITOR_SELECTION_BLOCK_FORMAT_ADDRESS },
 
+<<<<<<< HEAD
         { "style-blockquote",
           NULL,
           N_("_Blockquote"),
           "<Control>9",
           NULL,
           E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE },
+=======
+       { "style-preformat",
+         NULL,
+         N_("_Preformatted"),
+         "<Control>7",
+         NULL,
+         E_EDITOR_SELECTION_BLOCK_FORMAT_PRE },
+>>>>>>> Initial import of GtkhtmlEditor class
 
        { "style-list-bullet",
          NULL,
@@ -1324,7 +2528,11 @@ static GtkToggleActionEntry html_toggle_entries[] = {
          N_("_Bold"),
          "<Control>b",
          N_("Bold"),
+<<<<<<< HEAD
          NULL,
+=======
+         G_CALLBACK (action_bold_cb),
+>>>>>>> Initial import of GtkhtmlEditor class
          FALSE },
 
        { "italic",
@@ -1332,7 +2540,11 @@ static GtkToggleActionEntry html_toggle_entries[] = {
          N_("_Italic"),
          "<Control>i",
          N_("Italic"),
+<<<<<<< HEAD
          NULL,
+=======
+         G_CALLBACK (action_italic_cb),
+>>>>>>> Initial import of GtkhtmlEditor class
          FALSE },
 
        { "monospaced",
@@ -1340,7 +2552,11 @@ static GtkToggleActionEntry html_toggle_entries[] = {
          N_("_Plain Text"),
          "<Control>t",
          N_("Plain Text"),
+<<<<<<< HEAD
          NULL,
+=======
+         G_CALLBACK (action_monospaced_cb),
+>>>>>>> Initial import of GtkhtmlEditor class
          FALSE },
 
        { "strikethrough",
@@ -1348,7 +2564,11 @@ static GtkToggleActionEntry html_toggle_entries[] = {
          N_("_Strikethrough"),
          NULL,
          N_("Strikethrough"),
+<<<<<<< HEAD
          NULL,
+=======
+         G_CALLBACK (action_strikethrough_cb),
+>>>>>>> Initial import of GtkhtmlEditor class
          FALSE },
 
        { "underline",
@@ -1356,7 +2576,11 @@ static GtkToggleActionEntry html_toggle_entries[] = {
          N_("_Underline"),
          "<Control>u",
          N_("Underline"),
+<<<<<<< HEAD
          NULL,
+=======
+         G_CALLBACK (action_underline_cb),
+>>>>>>> Initial import of GtkhtmlEditor class
          FALSE }
 };
 
@@ -1651,15 +2875,23 @@ static GtkActionEntry spell_context_entries[] = {
 static void
 editor_actions_setup_languages_menu (EEditor *editor)
 {
+<<<<<<< HEAD
        ESpellChecker *checker;
        EEditorWidget *editor_widget;
        GtkUIManager *manager;
        GtkActionGroup *action_group;
        GList *list, *link;
+=======
+       /* FIXME WEBKIT
+       GtkUIManager *manager;
+       GtkActionGroup *action_group;
+       const GList *available_languages;
+>>>>>>> Initial import of GtkhtmlEditor class
        guint merge_id;
 
        manager = editor->priv->manager;
        action_group = editor->priv->language_actions;
+<<<<<<< HEAD
        editor_widget = e_editor_get_editor_widget (editor);
        checker = e_editor_widget_get_spell_checker (editor_widget);
        merge_id = gtk_ui_manager_new_merge_id (manager);
@@ -1683,6 +2915,27 @@ editor_actions_setup_languages_menu (EEditor *editor)
                        checker, e_spell_dictionary_get_code (dictionary));
                gtk_toggle_action_set_active (action, active);
 
+=======
+       available_languages = gtkhtml_spell_language_get_available ();
+       merge_id = gtk_ui_manager_new_merge_id (manager);
+
+       while (available_languages != NULL) {
+               GtkhtmlSpellLanguage *language = available_languages->data;
+               GtkhtmlSpellChecker *checker;
+               GtkToggleAction *action;
+
+               checker = gtkhtml_spell_checker_new (language);
+
+               g_hash_table_insert (
+                       editor->priv->available_spell_checkers,
+                       language, checker);
+
+               action = gtk_toggle_action_new (
+                       gtkhtml_spell_language_get_code (language),
+                       gtkhtml_spell_language_get_name (language),
+                       NULL, NULL);
+
+>>>>>>> Initial import of GtkhtmlEditor class
                g_signal_connect (
                        action, "toggled",
                        G_CALLBACK (action_language_cb), editor);
@@ -1695,41 +2948,74 @@ editor_actions_setup_languages_menu (EEditor *editor)
                gtk_ui_manager_add_ui (
                        manager, merge_id,
                        "/main-menu/edit-menu/language-menu",
+<<<<<<< HEAD
                        e_spell_dictionary_get_code (dictionary),
                        e_spell_dictionary_get_code (dictionary),
                        GTK_UI_MANAGER_AUTO, FALSE);
        }
 
        g_list_free (list);
+=======
+                       gtkhtml_spell_language_get_code (language),
+                       gtkhtml_spell_language_get_code (language),
+                       GTK_UI_MANAGER_AUTO, FALSE);
+
+               available_languages = g_list_next (available_languages);
+       }
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 editor_actions_setup_spell_check_menu (EEditor *editor)
 {
+<<<<<<< HEAD
        ESpellChecker *checker;
        GtkUIManager *manager;
        GtkActionGroup *action_group;
        GList *available_dicts, *iter;
+=======
+       /*
+       GtkUIManager *manager;
+       GtkActionGroup *action_group;
+       const GList *available_languages;
+>>>>>>> Initial import of GtkhtmlEditor class
        guint merge_id;
 
        manager = editor->priv->manager;
        action_group = editor->priv->spell_check_actions;;
+<<<<<<< HEAD
        checker = e_editor_widget_get_spell_checker (editor->priv->editor_widget);
        available_dicts = e_spell_checker_list_available_dicts (checker);
        merge_id = gtk_ui_manager_new_merge_id (manager);
 
        for (iter = available_dicts; iter; iter = iter->next) {
                ESpellDictionary *dictionary = iter->data;
+=======
+       available_languages = gtkhtml_spell_language_get_available ();
+       merge_id = gtk_ui_manager_new_merge_id (manager);
+
+       while (available_languages != NULL) {
+               GtkhtmlSpellLanguage *language = available_languages->data;
+>>>>>>> Initial import of GtkhtmlEditor class
                GtkAction *action;
                const gchar *code;
                const gchar *name;
                gchar *action_label;
                gchar *action_name;
 
+<<<<<<< HEAD
                code = e_spell_dictionary_get_code (dictionary);
                name = e_spell_dictionary_get_name (dictionary);
 
                /* Add a suggestion menu. */
+=======
+               code = gtkhtml_spell_language_get_code (language);
+               name = gtkhtml_spell_language_get_name (language);
+
+               // Add a suggestion menu. 
+
+>>>>>>> Initial import of GtkhtmlEditor class
                action_name = g_strdup_printf (
                        "context-spell-suggest-%s-menu", code);
 
@@ -1745,11 +3031,19 @@ editor_actions_setup_spell_check_menu (EEditor *editor)
 
                g_free (action_name);
 
+<<<<<<< HEAD
                /* Add an item to the "Add Word To" menu. */
                action_name = g_strdup_printf ("context-spell-add-%s", code);
                /* Translators: %s will be replaced with the actual dictionary
                 * name, where a user can add a word to. This is part of an
                 * "Add Word To" submenu. */
+=======
+               // Add an item to the "Add Word To" menu.
+
+               action_name = g_strdup_printf ("context-spell-add-%s", code);
+               // Translators: %s will be replaced with the actual dictionary name,
+               //where a user can add a word to. This is part of an "Add Word To" submenu.
+>>>>>>> Initial import of GtkhtmlEditor class
                action_label = g_strdup_printf (_("%s Dictionary"), name);
 
                action = gtk_action_new (
@@ -1759,8 +3053,13 @@ editor_actions_setup_spell_check_menu (EEditor *editor)
                        action, "activate",
                        G_CALLBACK (action_context_spell_add_cb), editor);
 
+<<<<<<< HEAD
                /* Visibility is dependent on whether the
                 * corresponding language action is active. */
+=======
+               // Visibility is dependent on whether the
+               //corresponding language action is active.
+>>>>>>> Initial import of GtkhtmlEditor class
                gtk_action_set_visible (action, FALSE);
 
                gtk_action_group_add_action (action_group, action);
@@ -1775,9 +3074,16 @@ editor_actions_setup_spell_check_menu (EEditor *editor)
 
                g_free (action_label);
                g_free (action_name);
+<<<<<<< HEAD
        }
 
        g_list_free (available_dicts);
+=======
+
+               available_languages = g_list_next (available_languages);
+       }
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 void
@@ -1787,14 +3093,20 @@ editor_actions_init (EEditor *editor)
        GtkActionGroup *action_group;
        GtkUIManager *manager;
        const gchar *domain;
+<<<<<<< HEAD
        EEditorWidget *editor_widget;
        GSettings *settings;
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        g_return_if_fail (E_IS_EDITOR (editor));
 
        manager = e_editor_get_ui_manager (editor);
        domain = GETTEXT_PACKAGE;
+<<<<<<< HEAD
        editor_widget = e_editor_get_editor_widget (editor);
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        /* Core Actions */
        action_group = editor->priv->core_actions;
@@ -1806,16 +3118,25 @@ editor_actions_init (EEditor *editor)
                action_group, core_justify_entries,
                G_N_ELEMENTS (core_justify_entries),
                E_EDITOR_SELECTION_ALIGNMENT_LEFT,
+<<<<<<< HEAD
                NULL, NULL);
        gtk_action_group_add_radio_actions (
                action_group, core_mode_entries,
                G_N_ELEMENTS (core_mode_entries),
                TRUE,
+=======
+               G_CALLBACK (action_justify_cb), editor);
+       gtk_action_group_add_radio_actions (
+               action_group, core_mode_entries,
+               G_N_ELEMENTS (core_mode_entries),
+               E_EDITOR_WIDGET_MODE_HTML,
+>>>>>>> Initial import of GtkhtmlEditor class
                G_CALLBACK (action_mode_cb), editor);
        gtk_action_group_add_radio_actions (
                action_group, core_style_entries,
                G_N_ELEMENTS (core_style_entries),
                E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH,
+<<<<<<< HEAD
                NULL, NULL);
        gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
@@ -1831,13 +3152,24 @@ editor_actions_init (EEditor *editor)
        /* Face Action */
        action = e_emoticon_action_new (
                "insert-emoticon", _("_Emoticon"),
+=======
+               G_CALLBACK (action_style_cb), editor);
+       gtk_ui_manager_insert_action_group (manager, action_group, 0);
+
+       /* Face Action */
+       action = e_emoticon_action_new (
+               "insert-face", _("_Emoticon"),
+>>>>>>> Initial import of GtkhtmlEditor class
                _("Insert Emoticon"), NULL);
        g_object_set (action, "icon-name", "face-smile", NULL);
        g_signal_connect (
                action, "item-activated",
                G_CALLBACK (action_insert_emoticon_cb), editor);
        gtk_action_group_add_action (action_group, action);
+<<<<<<< HEAD
        g_object_unref (action);
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        /* Core Actions (HTML only) */
        action_group = editor->priv->html_actions;
@@ -1852,7 +3184,11 @@ editor_actions_init (EEditor *editor)
                action_group, html_size_entries,
                G_N_ELEMENTS (html_size_entries),
                E_EDITOR_SELECTION_FONT_SIZE_NORMAL,
+<<<<<<< HEAD
                NULL, NULL);
+=======
+               G_CALLBACK (action_size_cb), editor);
+>>>>>>> Initial import of GtkhtmlEditor class
        gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
        /* Context Menu Actions */
@@ -1889,6 +3225,7 @@ editor_actions_init (EEditor *editor)
        editor_actions_setup_spell_check_menu (editor);
        gtk_ui_manager_insert_action_group (manager, action_group, 0);
 
+<<<<<<< HEAD
        /* Do this after all language actions are initialized. */
        editor_update_static_spell_actions (editor);
 
@@ -1899,6 +3236,15 @@ editor_actions_init (EEditor *editor)
                "short-label", _("_Find"), NULL);
        g_object_set (
                G_OBJECT (ACTION (SHOW_REPLACE)),
+=======
+       /* Fine Tuning */
+
+       g_object_set (
+               G_OBJECT (ACTION (FIND)),
+               "short-label", _("_Find"), NULL);
+       g_object_set (
+               G_OBJECT (ACTION (FIND_AND_REPLACE)),
+>>>>>>> Initial import of GtkhtmlEditor class
                "short-label", _("Re_place"), NULL);
        g_object_set (
                G_OBJECT (ACTION (INSERT_IMAGE)),
@@ -1915,6 +3261,7 @@ editor_actions_init (EEditor *editor)
                "short-label", _("_Table"), NULL);
 
        gtk_action_set_sensitive (ACTION (UNINDENT), FALSE);
+<<<<<<< HEAD
        gtk_action_set_sensitive (ACTION (FIND_AGAIN), FALSE);
        gtk_action_set_sensitive (ACTION (SPELL_CHECK), FALSE);
 
@@ -2002,3 +3349,7 @@ editor_actions_init (EEditor *editor)
                g_settings_get_boolean (settings, "composer-developer-mode"));
        g_object_unref (settings);
 }
+=======
+}
+ 
+>>>>>>> Initial import of GtkhtmlEditor class
diff --git a/e-util/e-editor-actions.h b/e-util/e-editor-actions.h
index 8f987d5..9970a75 100644
--- a/e-util/e-editor-actions.h
+++ b/e-util/e-editor-actions.h
@@ -1,7 +1,10 @@
 /* e-editor-actions.h
+<<<<<<< HEAD
  *
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
  *
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
  * License as published by the Free Software Foundation.
@@ -29,6 +32,17 @@
 
 #define E_EDITOR_ACTION_BOLD(editor) \
        E_EDITOR_ACTION ((editor), "bold")
+<<<<<<< HEAD
+=======
+#define E_EDITOR_ACTION_CONFIRM_REPLACE(editor) \
+       E_EDITOR_ACTION ((editor), "confirm-replace")
+#define E_EDITOR_ACTION_CONFIRM_REPLACE_ALL(editor) \
+       E_EDITOR_ACTION ((editor), "confirm-replace-all")
+#define E_EDITOR_ACTION_CONFIRM_REPLACE_CANCEL(editor) \
+       E_EDITOR_ACTION ((editor), "confirm-replace-cancel")
+#define E_EDITOR_ACTION_CONFIRM_REPLACE_NEXT(editor) \
+       E_EDITOR_ACTION ((editor), "confirm-replace-next")
+>>>>>>> Initial import of GtkhtmlEditor class
 #define E_EDITOR_ACTION_CONTEXT_DELETE_CELL(editor) \
        E_EDITOR_ACTION ((editor), "context-delete-cell")
 #define E_EDITOR_ACTION_CONTEXT_DELETE_COLUMN(editor) \
@@ -75,10 +89,17 @@
        E_EDITOR_ACTION ((editor), "cut")
 #define E_EDITOR_ACTION_EDIT_MENU(editor) \
        E_EDITOR_ACTION ((editor), "edit-menu")
+<<<<<<< HEAD
 #define E_EDITOR_ACTION_FIND_AGAIN(editor) \
        E_EDITOR_ACTION ((editor), "find-again")
 #define E_EDITOR_ACTION_FONT_SIZE_GROUP(editor) \
        E_EDITOR_ACTION ((editor), "size-plus-zero")
+=======
+#define E_EDITOR_ACTION_FIND(editor) \
+       E_EDITOR_ACTION ((editor), "find")
+#define E_EDITOR_ACTION_FIND_AND_REPLACE(editor) \
+       E_EDITOR_ACTION ((editor), "find-and-replace")
+>>>>>>> Initial import of GtkhtmlEditor class
 #define E_EDITOR_ACTION_FORMAT_MENU(editor) \
        E_EDITOR_ACTION ((editor), "format-menu")
 #define E_EDITOR_ACTION_FORMAT_TEXT(editor) \
@@ -107,14 +128,20 @@
        E_EDITOR_ACTION ((editor), "mode-plain")
 #define E_EDITOR_ACTION_MONOSPACED(editor) \
        E_EDITOR_ACTION ((editor), "monospaced")
+<<<<<<< HEAD
 #define E_EDITOR_ACTION_PASTE(editor) \
        E_EDITOR_ACTION ((editor), "paste")
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 #define E_EDITOR_ACTION_PROPERTIES_RULE(editor) \
        E_EDITOR_ACTION ((editor), "properties-rule")
 #define E_EDITOR_ACTION_PROPERTIES_TABLE(editor) \
        E_EDITOR_ACTION ((editor), "properties-table")
+<<<<<<< HEAD
 #define E_EDITOR_ACTION_REDO(editor) \
        E_EDITOR_ACTION ((editor), "redo")
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 #define E_EDITOR_ACTION_SHOW_FIND(editor) \
        E_EDITOR_ACTION ((editor), "show-find")
 #define E_EDITOR_ACTION_SHOW_REPLACE(editor) \
@@ -145,11 +172,16 @@
        E_EDITOR_ACTION ((editor), "test-url")
 #define E_EDITOR_ACTION_UNDERLINE(editor) \
        E_EDITOR_ACTION ((editor), "underline")
+<<<<<<< HEAD
 #define E_EDITOR_ACTION_UNDO(editor) \
        E_EDITOR_ACTION ((editor), "undo")
 #define E_EDITOR_ACTION_UNINDENT(editor) \
        E_EDITOR_ACTION ((editor), "unindent")
 #define E_EDITOR_ACTION_WEBKIT_INSPECTOR(editor) \
        E_EDITOR_ACTION ((editor), "webkit-inspector")
+=======
+#define E_EDITOR_ACTION_UNINDENT(editor) \
+       E_EDITOR_ACTION ((editor), "unindent")
+>>>>>>> Initial import of GtkhtmlEditor class
 
 #endif /* E_EDITOR_ACTIONS_H */
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index 981f1d0..ffd093d 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -1,7 +1,11 @@
+<<<<<<< HEAD
 /*
  * e-editor-private.h
  *
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+=======
+/* e-editor-private.h
+>>>>>>> Initial import of GtkhtmlEditor class
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
@@ -25,6 +29,7 @@
 #include <e-action-combo-box.h>
 #include <e-color-combo.h>
 #include <e-editor-actions.h>
+<<<<<<< HEAD
 #include <e-editor-widget.h>
 #include <e-editor-find-dialog.h>
 #include <e-editor-replace-dialog.h>
@@ -37,11 +42,19 @@
 #include <e-editor-paragraph-dialog.h>
 #include <e-editor-cell-dialog.h>
 #include <e-editor-spell-check-dialog.h>
+=======
+#include <e-editor-widgets.h>
+#include <e-editor-widget.h>
+>>>>>>> Initial import of GtkhtmlEditor class
 
 #ifdef HAVE_XFREE
 #include <X11/XF86keysym.h>
 #endif
 
+<<<<<<< HEAD
+=======
+
+>>>>>>> Initial import of GtkhtmlEditor class
 #define ACTION(name) (E_EDITOR_ACTION_##name (editor))
 #define WIDGET(name) (E_EDITOR_WIDGETS_##name (editor))
 
@@ -56,11 +69,16 @@ struct _EEditorPrivate {
        GtkActionGroup *language_actions;
        GtkActionGroup *spell_check_actions;
        GtkActionGroup *suggestion_actions;
+<<<<<<< HEAD
+=======
+       GtkBuilder *builder;
+>>>>>>> Initial import of GtkhtmlEditor class
 
        GtkWidget *main_menu;
        GtkWidget *main_toolbar;
        GtkWidget *edit_toolbar;
        GtkWidget *html_toolbar;
+<<<<<<< HEAD
        GtkWidget *activity_bar;
        GtkWidget *alert_bar;
        GtkWidget *edit_area;
@@ -77,6 +95,10 @@ struct _EEditorPrivate {
        GtkWidget *cell_dialog;
        GtkWidget *spell_check_dialog;
 
+=======
+       GtkWidget *edit_area;
+
+>>>>>>> Initial import of GtkhtmlEditor class
        GtkWidget *color_combo_box;
        GtkWidget *mode_combo_box;
        GtkWidget *size_combo_box;
@@ -84,6 +106,7 @@ struct _EEditorPrivate {
        GtkWidget *scrolled_window;
 
        EEditorWidget *editor_widget;
+<<<<<<< HEAD
        EEditorSelection *selection;
 
        gchar *filename;
@@ -100,6 +123,12 @@ struct _EEditorPrivate {
        /* The web view is uneditable while the editor is busy.
         * This is used to restore the previous editable state. */
        gboolean saved_editable;
+=======
+
+       guint ignore_style_change : 1;
+
+       gchar *filename;
+>>>>>>> Initial import of GtkhtmlEditor class
 };
 
 void           editor_actions_init             (EEditor *editor);
diff --git a/e-util/e-editor-widgets.h b/e-util/e-editor-widgets.h
new file mode 100644
index 0000000..5b28a7e
--- /dev/null
+++ b/e-util/e-editor-widgets.h
@@ -0,0 +1,234 @@
+/* e-editor-widgets.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
+#error "Only <e-util/e-util.h> should be included directly."
+#endif
+
+#ifndef E_EDITOR_WIDGETS_H
+#define E_EDITOR_WIDGETS_H
+
+#define E_EDITOR_WIDGETS(editor, name) \
+       (e_editor_get_widget ((editor), (name)))
+
+/* Cell Properties Window */
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_CELL_RADIO_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-cell-radio-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-color-combo")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_COLUMN_RADIO_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-column-radio-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_COLUMN_SPAN_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-column-span-spin-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_HEADER_STYLE_CHECK_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-header-style-check-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_HORIZONTAL_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-horizontal-combo-box")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_IMAGE_FILE_CHOOSER(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-image-file-chooser")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_ROW_RADIO_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-row-radio-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_ROW_SPAN_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-row-span-spin-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_TABLE_RADIO_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-table-radio-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_VERTICAL_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-vertical-combo-box")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_WIDTH_CHECK_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-width-check-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_WIDTH_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-width-combo-box")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_WIDTH_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-width-spin-button")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-window")
+#define E_EDITOR_WIDGETS_CELL_PROPERTIES_WRAP_TEXT_CHECK_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "cell-properties-wrap-text-check-button")
+
+/* Find Window */
+#define E_EDITOR_WIDGETS_FIND_BACKWARDS(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-backwards")
+#define E_EDITOR_WIDGETS_FIND_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-button")
+#define E_EDITOR_WIDGETS_FIND_CASE_SENSITIVE(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-case-sensitive")
+#define E_EDITOR_WIDGETS_FIND_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-window")
+#define E_EDITOR_WIDGETS_FIND_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-entry")
+#define E_EDITOR_WIDGETS_FIND_REGULAR_EXPRESSION(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-regular-expression")
+#define E_EDITOR_WIDGETS_FIND_RESULT_LABEL(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-result-label")
+#define E_EDITOR_WIDGETS_FIND_WRAP(editor) \
+       E_EDITOR_WIDGETS ((editor), "find-wrap")
+
+/* Image Properties Window */
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-alignment-combo-box")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_BORDER_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-border-spin-button")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_DESCRIPTION_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-description-entry")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_HEIGHT_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-height-combo-box")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_HEIGHT_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-height-spin-button")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_SOURCE_FILE_CHOOSER(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-source-file-chooser")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_URL_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-url-button")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_URL_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-url-entry")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_WIDTH_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-width-combo-box")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_WIDTH_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-width-spin-button")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-window")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_X_PADDING_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-x-padding-spin-button")
+#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_Y_PADDING_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "image-properties-y-padding-spin-button")
+
+/* Link Properties Window */
+#define E_EDITOR_WIDGETS_LINK_PROPERTIES_DESCRIPTION_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "link-properties-description-entry")
+#define E_EDITOR_WIDGETS_LINK_PROPERTIES_TEST_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "link-properties-test-button")
+#define E_EDITOR_WIDGETS_LINK_PROPERTIES_URL_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "link-properties-url-entry")
+#define E_EDITOR_WIDGETS_LINK_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "link-properties-window")
+
+/* Page Properties Window */
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_BACKGROUND_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-background-color-combo")
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_CUSTOM_FILE_CHOOSER(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-custom-file-chooser")
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_LINK_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-link-color-combo")
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_TEMPLATE_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-template-combo-box")
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_TEXT_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-text-color-combo")
+#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "page-properties-window")
+
+/* Paragraph Properties Window */
+#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_CENTER_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "paragraph-properties-center-button")
+#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_LEFT_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "paragraph-properties-left-button")
+#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_RIGHT_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "paragraph-properties-right-button")
+#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_STYLE_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "paragraph-properties-style-combo-box")
+#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "paragraph-properties-window")
+
+/* Replace Confirmation Window */
+#define E_EDITOR_WIDGETS_REPLACE_CONFIRMATION_CLOSE_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-confirmation-close-button")
+#define E_EDITOR_WIDGETS_REPLACE_CONFIRMATION_NEXT_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-confirmation-next-button")
+#define E_EDITOR_WIDGETS_REPLACE_CONFIRMATION_REPLACE_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-confirmation-replace-button")
+#define E_EDITOR_WIDGETS_REPLACE_CONFIRMATION_REPLACE_ALL_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-confirmation-replace-all-button")
+#define E_EDITOR_WIDGETS_REPLACE_CONFIRMATION_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-confirmation-window")
+
+/* Replace Window */
+#define E_EDITOR_WIDGETS_REPLACE_BACKWARDS(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-backwards")
+#define E_EDITOR_WIDGETS_REPLACE_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-button")
+#define E_EDITOR_WIDGETS_REPLACE_CASE_SENSITIVE(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-case-sensitive")
+#define E_EDITOR_WIDGETS_REPLACE_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-entry")
+#define E_EDITOR_WIDGETS_REPLACE_WITH_ENTRY(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-with-entry")
+#define E_EDITOR_WIDGETS_REPLACE_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-window")
+#define E_EDITOR_WIDGETS_REPLACE_WRAP(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-wrap")
+#define E_EDITOR_WIDGETS_REPLACE_ONLY_SELECTION(editor) \
+       E_EDITOR_WIDGETS ((editor), "replace-only-selection")
+
+/* Rule Properties Window */
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-alignment-combo-box")
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_SHADED_CHECK_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-shaded-check-button")
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_SIZE_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-size-spin-button")
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WIDTH_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-width-combo-box")
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WIDTH_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-width-spin-button")
+#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "rule-properties-window")
+
+/* Spell Check Window */
+#define E_EDITOR_WIDGETS_SPELL_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "spell-window")
+
+/* Table Properties Window */
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-alignment-combo-box")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_BORDER_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-border-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-color-combo")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_COLS_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-cols-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_IMAGE_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-image-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_PADDING_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-padding-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_ROWS_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-rows-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_SPACING_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-spacing-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_WIDTH_CHECK_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-width-check-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_WIDTH_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-width-combo-box")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_WIDTH_SPIN_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-width-spin-button")
+#define E_EDITOR_WIDGETS_TABLE_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "table-properties-window")
+
+/* Text Properties Window */
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_BOLD_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-bold-button")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_COLOR_COMBO(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-color-combo")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_ITALIC_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-italic-button")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_SIZE_COMBO_BOX(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-size-combo-box")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_STRIKETHROUGH_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-strikethrough-button")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_UNDERLINE_BUTTON(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-underline-button")
+#define E_EDITOR_WIDGETS_TEXT_PROPERTIES_WINDOW(editor) \
+       E_EDITOR_WIDGETS ((editor), "text-properties-window")
+
+#endif /* E_EDITOR_WIDGETS_H */
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index d1dc969..7b89f05 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -1,7 +1,11 @@
+<<<<<<< HEAD
 /*
  * e-editor.c
  *
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+=======
+/* e-editor.c
+>>>>>>> Initial import of GtkhtmlEditor class
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
@@ -18,6 +22,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+<<<<<<< HEAD
 #include <config.h>
 #include <glib/gi18n-lib.h>
 
@@ -511,6 +516,27 @@ editor_show_popup (EEditor *editor,
        return TRUE;
 }
 
+=======
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-editor.h"
+#include "e-editor-private.h"
+
+#include <glib/gi18n-lib.h>
+
+G_DEFINE_TYPE (
+       EEditor,
+       e_editor,
+       GTK_TYPE_BOX);
+
+enum {
+       PROP_0,
+       PROP_FILENAME
+};
+
+>>>>>>> Initial import of GtkhtmlEditor class
 static gchar *
 editor_find_ui_file (const gchar *basename)
 {
@@ -536,6 +562,7 @@ editor_find_ui_file (const gchar *basename)
 }
 
 static void
+<<<<<<< HEAD
 editor_parent_changed (GtkWidget *widget,
                        GtkWidget *previous_parent)
 {
@@ -593,6 +620,17 @@ editor_set_property (GObject *object,
                case PROP_FILENAME:
                        e_editor_set_filename (
                                E_EDITOR (object),
+=======
+editor_set_property (GObject *object,
+                    guint property_id,
+                    const GValue *value,
+                    GParamSpec *pspec)
+{
+       switch (property_id) {
+
+               case PROP_FILENAME:
+                       e_editor_set_filename (E_EDITOR (object),
+>>>>>>> Initial import of GtkhtmlEditor class
                                g_value_get_string (value));
                        return;
 
@@ -603,6 +641,7 @@ editor_set_property (GObject *object,
 
 static void
 editor_get_property (GObject *object,
+<<<<<<< HEAD
                      guint property_id,
                      GValue *value,
                      GParamSpec *pspec)
@@ -619,6 +658,19 @@ editor_get_property (GObject *object,
                                value, e_editor_get_filename (
                                E_EDITOR (object)));
                        return;
+=======
+                    guint property_id,
+                    GValue *value,
+                    GParamSpec *pspec)
+{
+       switch (property_id) {
+
+               case PROP_FILENAME:
+                       g_value_set_string (
+                               value, e_editor_get_filename(
+                               E_EDITOR (object)));
+               return;
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -629,22 +681,48 @@ editor_constructed (GObject *object)
 {
        EEditor *editor = E_EDITOR (object);
        EEditorPrivate *priv = editor->priv;
+<<<<<<< HEAD
        GtkIMMulticontext *im_context;
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        GtkWidget *widget;
        GtkToolbar *toolbar;
        GtkToolItem *tool_item;
 
+<<<<<<< HEAD
        /* Construct the editing toolbars. */
 
        widget = e_editor_get_managed_widget (editor, "/edit-toolbar");
        gtk_widget_set_hexpand (widget, TRUE);
        gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
        gtk_grid_attach (GTK_GRID (editor), widget, 0, 0, 1, 1);
+=======
+       /* Construct main window widgets. */
+
+       widget = e_editor_get_managed_widget (editor, "/main-menu");
+       gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+       priv->main_menu = g_object_ref (widget);
+       gtk_widget_show (widget);
+
+       widget = e_editor_get_managed_widget (editor, "/main-toolbar");
+       gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+       priv->main_toolbar = g_object_ref (widget);
+       gtk_widget_show (widget);
+
+       gtk_style_context_add_class (
+               gtk_widget_get_style_context (widget),
+               GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
+
+       widget = e_editor_get_managed_widget (editor, "/edit-toolbar");
+       gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
+       gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+>>>>>>> Initial import of GtkhtmlEditor class
        priv->edit_toolbar = g_object_ref (widget);
        gtk_widget_show (widget);
 
        widget = e_editor_get_managed_widget (editor, "/html-toolbar");
+<<<<<<< HEAD
        gtk_widget_set_hexpand (widget, TRUE);
        gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
        gtk_grid_attach (GTK_GRID (editor), widget, 0, 1, 1, 1);
@@ -673,24 +751,38 @@ editor_constructed (GObject *object)
 
        /* Construct the main editing area. */
 
+=======
+       gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
+       gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+       priv->html_toolbar = g_object_ref (widget);
+       gtk_widget_show (widget);
+
+>>>>>>> Initial import of GtkhtmlEditor class
        widget = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (
                GTK_SCROLLED_WINDOW (widget),
                GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_shadow_type (
                GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+<<<<<<< HEAD
        gtk_widget_set_hexpand (widget, TRUE);
        gtk_widget_set_vexpand (widget, TRUE);
        gtk_grid_attach (GTK_GRID (editor), widget, 0, 4, 1, 1);
+=======
+       gtk_box_pack_start (GTK_BOX (editor), widget, TRUE, TRUE, 0);
+>>>>>>> Initial import of GtkhtmlEditor class
        priv->scrolled_window = g_object_ref (widget);
        gtk_widget_show (widget);
 
        widget = GTK_WIDGET (e_editor_get_editor_widget (editor));
        gtk_container_add (GTK_CONTAINER (priv->scrolled_window), widget);
        gtk_widget_show (widget);
+<<<<<<< HEAD
        g_signal_connect_swapped (
                widget, "popup-event",
                G_CALLBACK (editor_show_popup), editor);
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        /* Add some combo boxes to the "edit" toolbar. */
 
@@ -731,6 +823,7 @@ editor_constructed (GObject *object)
        gtk_toolbar_insert (toolbar, tool_item, 0);
        priv->color_combo_box = g_object_ref (widget);
        gtk_widget_show_all (GTK_WIDGET (tool_item));
+<<<<<<< HEAD
        g_object_bind_property (
                priv->color_combo_box, "current-color",
                priv->selection, "font-color",
@@ -739,6 +832,8 @@ editor_constructed (GObject *object)
                priv->editor_widget, "editable",
                priv->color_combo_box, "sensitive",
                G_BINDING_SYNC_CREATE);
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 
        tool_item = gtk_tool_item_new ();
        widget = e_action_combo_box_new_with_action (
@@ -750,6 +845,7 @@ editor_constructed (GObject *object)
        priv->size_combo_box = g_object_ref (widget);
        gtk_widget_show_all (GTK_WIDGET (tool_item));
 
+<<<<<<< HEAD
        /* Add input methods to the context menu. */
        widget = e_editor_get_managed_widget (
                editor, "/context-menu/context-input-methods-menu");
@@ -759,16 +855,99 @@ editor_constructed (GObject *object)
        gtk_im_multicontext_append_menuitems (
                GTK_IM_MULTICONTEXT (im_context),
                GTK_MENU_SHELL (widget));
+=======
+       /* Initialize painters (requires "edit_area"). */
+
+       /* FIXME WEBKIT
+       html = e_editor_widget_get_html (E_EDITOR_WIDGET (editor));
+       gtk_widget_ensure_style (GTK_WIDGET (html));
+       priv->html_painter = g_object_ref (html->engine->painter);
+       priv->plain_painter = html_plain_painter_new (priv->edit_area, TRUE);
+       */
+
+       /* Add input methods to the context menu. */
+
+       /* FIXME WEBKIT
+       widget = e_editor_get_managed_widget (
+               editor, "/context-menu/context-input-methods-menu");
+       widget = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+       gtk_im_multicontext_append_menuitems (
+               GTK_IM_MULTICONTEXT (html->priv->im_context),
+               GTK_MENU_SHELL (widget));
+       */
+
+       /* Configure color stuff. */
+
+       /* FIXME WEBKIT
+       priv->palette = gtkhtml_color_palette_new ();
+       priv->text_color = gtkhtml_color_state_new ();
+
+       gtkhtml_color_state_set_default_label (
+               priv->text_color, _("Automatic"));
+       gtkhtml_color_state_set_palette (
+               priv->text_color, priv->palette);
+       */
+
+       /* Text color widgets share state. */
+
+       /* FIXME WEBKIT
+       widget = priv->color_combo_box;
+       gtkhtml_color_combo_set_state (
+               GTKHTML_COLOR_COMBO (widget), priv->text_color);
+
+       widget = WIDGET (TEXT_PROPERTIES_COLOR_COMBO);
+       gtkhtml_color_combo_set_state (
+               GTKHTML_COLOR_COMBO (widget), priv->text_color);
+       */
+
+       /* These color widgets share a custom color palette. */
+
+       /* FIXME WEBKIT
+       widget = WIDGET (CELL_PROPERTIES_COLOR_COMBO);
+       gtkhtml_color_combo_set_palette (
+               GTKHTML_COLOR_COMBO (widget), priv->palette);
+
+       widget = WIDGET (PAGE_PROPERTIES_BACKGROUND_COLOR_COMBO);
+       gtkhtml_color_combo_set_palette (
+               GTKHTML_COLOR_COMBO (widget), priv->palette);
+
+       widget = WIDGET (PAGE_PROPERTIES_LINK_COLOR_COMBO);
+       gtkhtml_color_combo_set_palette (
+               GTKHTML_COLOR_COMBO (widget), priv->palette);
+
+       widget = WIDGET (TABLE_PROPERTIES_COLOR_COMBO);
+       gtkhtml_color_combo_set_palette (
+               GTKHTML_COLOR_COMBO (widget), priv->palette);
+               */
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 editor_dispose (GObject *object)
 {
+<<<<<<< HEAD
        EEditorPrivate *priv;
 
        priv = E_EDITOR_GET_PRIVATE (object);
 
        g_clear_object (&priv->manager);
+=======
+       EEditor *editor = E_EDITOR (object);
+       EEditorPrivate *priv = editor->priv;
+
+       /* Disconnect signal handlers from the color
+        * state object since it may live on. */
+       /* FIXME WEBKIT
+       if (priv->text_color != NULL) {
+               g_signal_handlers_disconnect_matched (
+                       priv->text_color, G_SIGNAL_MATCH_DATA,
+                       0, 0, NULL, NULL, editor);
+       }
+       */
+
+       g_clear_object (&priv->manager);
+       g_clear_object (&priv->manager);
+>>>>>>> Initial import of GtkhtmlEditor class
        g_clear_object (&priv->core_actions);
        g_clear_object (&priv->html_actions);
        g_clear_object (&priv->context_actions);
@@ -776,13 +955,30 @@ editor_dispose (GObject *object)
        g_clear_object (&priv->language_actions);
        g_clear_object (&priv->spell_check_actions);
        g_clear_object (&priv->suggestion_actions);
+<<<<<<< HEAD
+=======
+       g_clear_object (&priv->builder);
+
+       /* FIXME WEBKIT
+       g_hash_table_remove_all (priv->available_spell_checkers);
+
+       g_list_foreach (
+               priv->active_spell_checkers,
+               (GFunc) g_object_unref, NULL);
+       g_list_free (priv->active_spell_checkers);
+       priv->active_spell_checkers = NULL;
+       */
+>>>>>>> Initial import of GtkhtmlEditor class
 
        g_clear_object (&priv->main_menu);
        g_clear_object (&priv->main_toolbar);
        g_clear_object (&priv->edit_toolbar);
        g_clear_object (&priv->html_toolbar);
+<<<<<<< HEAD
        g_clear_object (&priv->activity_bar);
        g_clear_object (&priv->alert_bar);
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
        g_clear_object (&priv->edit_area);
 
        g_clear_object (&priv->color_combo_box);
@@ -791,6 +987,7 @@ editor_dispose (GObject *object)
        g_clear_object (&priv->style_combo_box);
        g_clear_object (&priv->scrolled_window);
 
+<<<<<<< HEAD
        g_clear_object (&priv->editor_widget);
 
        /* Chain up to parent's dispose() method. */
@@ -839,11 +1036,28 @@ e_editor_class_init (EEditorClass *class)
        g_type_class_add_private (class, sizeof (EEditorPrivate));
 
        object_class = G_OBJECT_CLASS (class);
+=======
+       /* FIXME WEBKIT
+       DISPOSE (priv->palette);
+       DISPOSE (priv->text_color);
+       */
+}
+
+static void
+e_editor_class_init (EEditorClass *klass)
+{
+       GObjectClass *object_class;
+
+       g_type_class_add_private (klass, sizeof (EEditorPrivate));
+
+       object_class = G_OBJECT_CLASS (klass);
+>>>>>>> Initial import of GtkhtmlEditor class
        object_class->set_property = editor_set_property;
        object_class->get_property = editor_get_property;
        object_class->constructed = editor_constructed;
        object_class->dispose = editor_dispose;
 
+<<<<<<< HEAD
        widget_class = GTK_WIDGET_CLASS (class);
        widget_class->parent_set = editor_parent_changed;
 
@@ -861,11 +1075,14 @@ e_editor_class_init (EEditorClass *class)
                        G_PARAM_READABLE |
                        G_PARAM_STATIC_STRINGS));
 
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
        g_object_class_install_property (
                object_class,
                PROP_FILENAME,
                g_param_spec_string (
                        "filename",
+<<<<<<< HEAD
                        NULL,
                        NULL,
                        NULL,
@@ -896,17 +1113,31 @@ static void
 e_editor_alert_sink_init (EAlertSinkInterface *interface)
 {
        interface->submit_alert = editor_submit_alert;
+=======
+                       NULL,
+                       NULL,
+                       NULL,
+                       G_PARAM_READWRITE));
+>>>>>>> Initial import of GtkhtmlEditor class
 }
 
 static void
 e_editor_init (EEditor *editor)
 {
        EEditorPrivate *priv;
+<<<<<<< HEAD
        GtkWidget *widget;
        gchar *filename;
        GError *error = NULL;
 
        editor->priv = E_EDITOR_GET_PRIVATE (editor);
+=======
+       GError *error;
+       gchar *filename;
+
+       editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
+               editor, E_TYPE_EDITOR, EEditorPrivate);
+>>>>>>> Initial import of GtkhtmlEditor class
 
        priv = editor->priv;
 
@@ -918,14 +1149,23 @@ e_editor_init (EEditor *editor)
        priv->language_actions = gtk_action_group_new ("language");
        priv->spell_check_actions = gtk_action_group_new ("spell-check");
        priv->suggestion_actions = gtk_action_group_new ("suggestion");
+<<<<<<< HEAD
        priv->editor_widget = g_object_ref_sink (e_editor_widget_new ());
        priv->selection = e_editor_widget_get_selection (priv->editor_widget);
 
        filename = editor_find_ui_file ("e-editor-manager.ui");
+=======
+       priv->editor_widget = e_editor_widget_new ();
+
+       filename = editor_find_ui_file ("e-editor-manager.ui");
+
+       error = NULL;
+>>>>>>> Initial import of GtkhtmlEditor class
        if (!gtk_ui_manager_add_ui_from_file (priv->manager, filename, &error)) {
                g_critical ("Couldn't load builder file: %s\n", error->message);
                g_clear_error (&error);
        }
+<<<<<<< HEAD
        g_free (filename);
 
        editor_actions_init (editor);
@@ -987,6 +1227,52 @@ e_editor_get_editor_widget (EEditor *editor)
  *
  * Returns #GtkUIManager that manages all the actions in the @editor.
  */
+=======
+
+       g_free (filename);
+
+       filename = editor_find_ui_file ("e-editor-builder.ui");
+
+       priv->builder = gtk_builder_new ();
+       /* To keep translated strings in subclasses */
+       gtk_builder_set_translation_domain (priv->builder, GETTEXT_PACKAGE);
+       error = NULL;
+       if (!gtk_builder_add_from_file (priv->builder, filename, &error)) {
+               g_critical ("Couldn't load builder file: %s\n", error->message);
+               g_clear_error (&error);
+       }
+
+       g_free (filename);
+
+       editor_actions_init (editor);
+}
+
+GtkWidget *
+e_editor_new (void)
+{
+       return g_object_new (E_TYPE_EDITOR,
+               "orientation", GTK_ORIENTATION_VERTICAL,
+               NULL);
+}
+
+EEditorWidget *
+e_editor_get_editor_widget (EEditor *editor)
+{
+       g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
+
+       return editor->priv->editor_widget;
+}
+
+
+GtkBuilder *
+e_editor_get_builder (EEditor *editor)
+{
+       g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
+
+       return editor->priv->builder;
+}
+
+>>>>>>> Initial import of GtkhtmlEditor class
 GtkUIManager *
 e_editor_get_ui_manager (EEditor *editor)
 {
@@ -995,6 +1281,7 @@ e_editor_get_ui_manager (EEditor *editor)
        return editor->priv->manager;
 }
 
+<<<<<<< HEAD
 /**
  * e_editor_get_action:
  * @editor: an #EEditor
@@ -1009,11 +1296,21 @@ e_editor_get_action (EEditor *editor,
        GtkUIManager *manager;
        GtkAction *action = NULL;
        GList *list;
+=======
+GtkAction *
+e_editor_get_action (EEditor *editor,
+                    const gchar *action_name)
+{
+       GtkUIManager *manager;
+       GtkAction *action = NULL;
+       GList *iter;
+>>>>>>> Initial import of GtkhtmlEditor class
 
        g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
        g_return_val_if_fail (action_name != NULL, NULL);
 
        manager = e_editor_get_ui_manager (editor);
+<<<<<<< HEAD
        list = gtk_ui_manager_get_action_groups (manager);
 
        while (list != NULL && action == NULL) {
@@ -1023,6 +1320,16 @@ e_editor_get_action (EEditor *editor,
                        action_group, action_name);
 
                list = g_list_next (list);
+=======
+       iter = gtk_ui_manager_get_action_groups (manager);
+
+       while (iter != NULL && action == NULL) {
+               GtkActionGroup *action_group = iter->data;
+
+               action = gtk_action_group_get_action (
+                       action_group, action_name);
+               iter = g_list_next (iter);
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 
        g_return_val_if_fail (action != NULL, NULL);
@@ -1030,6 +1337,7 @@ e_editor_get_action (EEditor *editor,
        return action;
 }
 
+<<<<<<< HEAD
 /**
  * e_editor_get_action_group:
  * @editor: an #EEditor
@@ -1044,30 +1352,71 @@ e_editor_get_action_group (EEditor *editor,
 {
        GtkUIManager *manager;
        GList *list;
+=======
+GtkActionGroup *
+e_editor_get_action_group (EEditor *editor,
+                          const gchar *group_name)
+{
+       GtkUIManager *manager;
+       GList *iter;
+>>>>>>> Initial import of GtkhtmlEditor class
 
        g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
        g_return_val_if_fail (group_name != NULL, NULL);
 
        manager = e_editor_get_ui_manager (editor);
+<<<<<<< HEAD
        list = gtk_ui_manager_get_action_groups (manager);
 
        while (list != NULL) {
                GtkActionGroup *action_group = list->data;
+=======
+       iter = gtk_ui_manager_get_action_groups (manager);
+
+       while (iter != NULL) {
+               GtkActionGroup *action_group = iter->data;
+>>>>>>> Initial import of GtkhtmlEditor class
                const gchar *name;
 
                name = gtk_action_group_get_name (action_group);
                if (strcmp (name, group_name) == 0)
                        return action_group;
 
+<<<<<<< HEAD
                list = g_list_next (list);
+=======
+               iter = g_list_next (iter);
+>>>>>>> Initial import of GtkhtmlEditor class
        }
 
        return NULL;
 }
 
 GtkWidget *
+<<<<<<< HEAD
 e_editor_get_managed_widget (EEditor *editor,
                              const gchar *widget_path)
+=======
+e_editor_get_widget (EEditor *editor,
+                           const gchar *widget_name)
+{
+       GtkBuilder *builder;
+       GObject *object;
+
+       g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
+       g_return_val_if_fail (widget_name != NULL, NULL);
+
+       builder = e_editor_get_builder (editor);
+       object = gtk_builder_get_object (builder, widget_name);
+       g_return_val_if_fail (GTK_IS_WIDGET (object), NULL);
+
+       return GTK_WIDGET (object);
+}
+
+GtkWidget *
+e_editor_get_managed_widget (EEditor *editor,
+                            const gchar *widget_path)
+>>>>>>> Initial import of GtkhtmlEditor class
 {
        GtkUIManager *manager;
        GtkWidget *widget;
@@ -1083,12 +1432,15 @@ e_editor_get_managed_widget (EEditor *editor,
        return widget;
 }
 
+<<<<<<< HEAD
 /**
  * e_editor_get_filename:
  * @editor: an #EEditor
  *
  * Returns path and name of file to which content of the editor should be saved.
  */
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 const gchar *
 e_editor_get_filename (EEditor *editor)
 {
@@ -1097,6 +1449,7 @@ e_editor_get_filename (EEditor *editor)
        return editor->priv->filename;
 }
 
+<<<<<<< HEAD
 /**
  * e_editor_set_filename:
  * @editor: an #EEditor
@@ -1108,6 +1461,11 @@ e_editor_get_filename (EEditor *editor)
 void
 e_editor_set_filename (EEditor *editor,
                        const gchar *filename)
+=======
+void
+e_editor_set_filename (EEditor *editor,
+                      const gchar *filename)
+>>>>>>> Initial import of GtkhtmlEditor class
 {
        g_return_if_fail (E_IS_EDITOR (editor));
 
@@ -1120,6 +1478,7 @@ e_editor_set_filename (EEditor *editor,
        g_object_notify (G_OBJECT (editor), "filename");
 }
 
+<<<<<<< HEAD
 /**
  * e_editor_new_activity:
  * @editor: an #EEditor
@@ -1187,6 +1546,13 @@ e_editor_save (EEditor *editor,
                const gchar *filename,
                gboolean as_html,
                GError **error)
+=======
+gboolean
+e_editor_save (EEditor *editor,
+              const gchar *filename,
+              gboolean as_html,
+              GError **error)
+>>>>>>> Initial import of GtkhtmlEditor class
 {
        GFile *file;
        GFileOutputStream *stream;
@@ -1199,6 +1565,7 @@ e_editor_save (EEditor *editor,
        if ((error && *error) || !stream)
                return FALSE;
 
+<<<<<<< HEAD
        if (as_html)
                content = e_editor_widget_get_text_html (
                        E_EDITOR_WIDGET (editor));
@@ -1210,6 +1577,19 @@ e_editor_save (EEditor *editor,
                g_set_error (
                        error, G_IO_ERROR, G_IO_ERROR_FAILED,
                        "Failed to obtain content of editor");
+=======
+       if (as_html) {
+               content = e_editor_widget_get_text_html (
+                               E_EDITOR_WIDGET (editor));
+       } else {
+               content = e_editor_widget_get_text_plain (
+                               E_EDITOR_WIDGET (editor));
+       }
+
+       if (!content || !*content) {
+               g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                            "Failed to obtain content of editor");
+>>>>>>> Initial import of GtkhtmlEditor class
                return FALSE;
        }
 
@@ -1223,4 +1603,7 @@ e_editor_save (EEditor *editor,
 
        return TRUE;
 }
+<<<<<<< HEAD
 
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
diff --git a/e-util/e-editor.h b/e-util/e-editor.h
index 00831ac..8313233 100644
--- a/e-util/e-editor.h
+++ b/e-util/e-editor.h
@@ -1,7 +1,11 @@
+<<<<<<< HEAD
 /*
  * e-editor.h
  *
  * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+=======
+/* e-editor.h
+>>>>>>> Initial import of GtkhtmlEditor class
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU Lesser General Public
@@ -26,7 +30,10 @@
 #define E_EDITOR_H
 
 #include <gtk/gtk.h>
+<<<<<<< HEAD
 #include <e-util/e-activity.h>
+=======
+>>>>>>> Initial import of GtkhtmlEditor class
 #include <e-util/e-editor-widget.h>
 
 /* Standard GObject macros */
@@ -55,11 +62,17 @@ typedef struct _EEditorClass EEditorClass;
 typedef struct _EEditorPrivate EEditorPrivate;
 
 struct _EEditor {
+<<<<<<< HEAD
        GtkGrid parent;
+=======
+       GtkBox parent;
+
+>>>>>>> Initial import of GtkhtmlEditor class
        EEditorPrivate *priv;
 };
 
 struct _EEditorClass {
+<<<<<<< HEAD
        GtkGridClass parent_class;
 
        void            (*update_actions)       (EEditor *editor,
@@ -72,6 +85,16 @@ GType                e_editor_get_type               (void) G_GNUC_CONST;
 GtkWidget *    e_editor_new                    (void);
 gboolean       e_editor_is_busy                (EEditor *editor);
 EEditorWidget *        e_editor_get_editor_widget      (EEditor *editor);
+=======
+       GtkBoxClass parent_class;
+};
+
+GType          e_editor_get_type               (void);
+GtkWidget *    e_editor_new                    (void);
+
+EEditorWidget* e_editor_get_editor_widget      (EEditor *editor);
+
+>>>>>>> Initial import of GtkhtmlEditor class
 GtkBuilder *   e_editor_get_builder            (EEditor *editor);
 GtkUIManager * e_editor_get_ui_manager         (EEditor *editor);
 GtkAction *    e_editor_get_action             (EEditor *editor,
@@ -80,14 +103,23 @@ GtkActionGroup *e_editor_get_action_group  (EEditor *editor,
                                                 const gchar *group_name);
 GtkWidget *    e_editor_get_widget             (EEditor *editor,
                                                 const gchar *widget_name);
+<<<<<<< HEAD
 GtkWidget *    e_editor_get_managed_widget     (EEditor *editor,
+=======
+GtkWidget *    e_editor_get_managed_widget
+                                               (EEditor *editor,
+>>>>>>> Initial import of GtkhtmlEditor class
                                                 const gchar *widget_path);
 const gchar *  e_editor_get_filename           (EEditor *editor);
 void           e_editor_set_filename           (EEditor *editor,
                                                 const gchar *filename);
+<<<<<<< HEAD
 EActivity *    e_editor_new_activity           (EEditor *editor);
 void           e_editor_pack_above             (EEditor *editor,
                                                 GtkWidget *child);
+=======
+
+>>>>>>> Initial import of GtkhtmlEditor class
 
 /*****************************************************************************
  * High-Level Editing Interface
diff --git a/e-util/e-util.h b/e-util/e-util.h
index f39e75a..37d167d 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -91,8 +91,11 @@
 #include <e-util/e-destination-store.h>
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-dialog-widgets.h>
+#include <e-util/e-editor-actions.h>
 #include <e-util/e-editor-selection.h>
 #include <e-util/e-editor-widget.h>
+#include <e-util/e-editor-widgets.h>
+#include <e-util/e-editor.h>
 #include <e-util/e-emoticon-action.h>
 #include <e-util/e-emoticon-chooser-menu.h>
 #include <e-util/e-emoticon-chooser.h>


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