[evolution/wip/webkit-composer: 535/966] Make changing color work



commit 7cdd312c992f4adf2faf1977d4a7c27e062c4381
Author: Dan Vrátil <dvratil redhat com>
Date:   Fri Aug 3 17:01:59 2012 +0200

    Make changing color work
    
    The 'current-color' property of EColorCombo is binded to 'font-color'
    property of EEditorSelection, so that any change is handled automatically.

 e-util/e-color-combo.c      |    5 +-
 e-util/e-editor-selection.c |   97 +++--
 e-util/e-editor-selection.h |    7 +-
 e-util/e-editor.c           | 1033 -------------------------------------------
 4 files changed, 67 insertions(+), 1075 deletions(-)
---
diff --git a/e-util/e-color-combo.c b/e-util/e-color-combo.c
index bfc8544..400d606 100644
--- a/e-util/e-color-combo.c
+++ b/e-util/e-color-combo.c
@@ -558,7 +558,7 @@ e_color_combo_class_init (EColorComboClass *klass)
                        "current-color",
                        "Current color",
                        "The currently selected color",
-                       GDK_TYPE_COLOR,
+                       GDK_TYPE_RGBA,
                        G_PARAM_READWRITE));
 
        g_object_class_install_property (
@@ -568,7 +568,7 @@ e_color_combo_class_init (EColorComboClass *klass)
                        "default-color",
                        "Default color",
                        "The color associated with the default button",
-                       GDK_TYPE_COLOR,
+                       GDK_TYPE_RGBA,
                        G_PARAM_CONSTRUCT |
                        G_PARAM_READWRITE));
 
@@ -837,7 +837,6 @@ e_color_combo_set_current_color (EColorCombo *combo,
                gdk_rgba_free (combo->priv->current_color);
        }
 
-
        combo->priv->current_color = gdk_rgba_copy (color);
 
        gtk_color_chooser_set_rgba (
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index b46c731..180e32a 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -23,6 +23,8 @@
 #include "e-editor-selection.h"
 #include "e-editor.h"
 
+#include <e-util/e-util.h>
+
 #include <webkit/webkit.h>
 #include <webkit/webkitdom.h>
 #include <string.h>
@@ -69,6 +71,8 @@ enum {
        PROP_UNDERLINE,
 };
 
+static const GdkRGBA black = { 0 };
+
 static WebKitDOMElement *
 find_parent_element_by_type (WebKitDOMNode *node, GType type)
 {
@@ -145,6 +149,32 @@ get_has_style (EEditorSelection *selection,
        return result;
 }
 
+static gchar *
+get_font_property (EEditorSelection *selection,
+                  const gchar *font_property)
+{
+       WebKitDOMRange *range;
+       WebKitDOMNode *node;
+       WebKitDOMElement *element;
+       gchar *value;
+
+       range = editor_selection_get_current_range (selection);
+       if (!range) {
+               return NULL;
+       }
+
+       node = webkit_dom_range_get_common_ancestor_container (range, NULL);
+       element = find_parent_element_by_type (
+                       node, WEBKIT_TYPE_DOM_HTML_FONT_ELEMENT);
+       if (!element) {
+               return NULL;
+       }
+
+       g_object_get (G_OBJECT (element), font_property, &value, NULL);
+
+       return value;
+}
+
 static void
 webview_selection_changed (WebKitWebView *webview,
                           EEditorSelection *selection)
@@ -183,6 +213,7 @@ e_editor_selection_get_property (GObject *object,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
+       GdkRGBA rgba = { 0 };
        EEditorSelection *selection = E_EDITOR_SELECTION (object);
 
        switch (property_id) {
@@ -212,8 +243,8 @@ e_editor_selection_get_property (GObject *object,
                        return;
 
                case PROP_FONT_COLOR:
-                       g_value_set_string (value,
-                               e_editor_selection_get_font_color (selection));
+                       e_editor_selection_get_font_color (selection, &rgba);
+                       g_value_set_boxed (value, &rgba);
                        return;
 
                case PROP_BLOCK_FORMAT:
@@ -296,7 +327,7 @@ e_editor_selection_set_property (GObject *object,
 
                case PROP_FONT_COLOR:
                        e_editor_selection_set_font_color (
-                               selection, g_value_get_string (value));
+                               selection, g_value_get_boxed (value));
                        return;
 
                case PROP_FONT_NAME:
@@ -433,11 +464,11 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
        g_object_class_install_property (
                object_class,
                PROP_FONT_COLOR,
-               g_param_spec_string (
+               g_param_spec_boxed (
                        "font-color",
                        NULL,
                        NULL,
-                       NULL,
+                       GDK_TYPE_RGBA,
                        G_PARAM_READWRITE));
 
        g_object_class_install_property (
@@ -816,36 +847,42 @@ e_editor_selection_set_bold (EEditorSelection *selection,
        g_object_notify (G_OBJECT (selection), "bold");
 }
 
-const gchar *
-e_editor_selection_get_font_color (EEditorSelection *selection)
+void
+e_editor_selection_get_font_color (EEditorSelection *selection,
+                                  GdkRGBA *rgba)
 {
-       WebKitDOMNode *node;
-       WebKitDOMRange *range;
-       WebKitDOMCSSStyleDeclaration *css;
-
-       g_return_val_if_fail (E_IS_EDITOR_SELECTION (selection), NULL);
-
-       range = editor_selection_get_current_range (selection);
-       node = webkit_dom_range_get_common_ancestor_container (range, NULL);
+       gchar *color;
+       g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
-       g_free (selection->priv->font_color);
-       css = webkit_dom_element_get_style (WEBKIT_DOM_ELEMENT (node));
-       selection->priv->font_color =
-               webkit_dom_css_style_declaration_get_property_value (css, "color");
+       color = get_font_property (selection, "color");
+       if (!color) {
+               *rgba = black;
+               return;
+       }
 
-       return selection->priv->font_color;
+       gdk_rgba_parse (rgba, color);
+       g_free (color);
 }
 
 void
 e_editor_selection_set_font_color (EEditorSelection *selection,
-                                  const gchar *color)
+                                  const GdkRGBA *rgba)
 {
        WebKitDOMDocument *document;
+       gchar *color;
 
        g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 
+       if (!rgba) {
+               rgba = &black;
+       }
+
+       color = g_strdup_printf ("#%06x", e_rgba_to_value ((GdkRGBA *) rgba));
+
        document = webkit_web_view_get_dom_document (selection->priv->webview);
-       webkit_dom_document_exec_command (document, "foreColor", FALSE, "");
+       webkit_dom_document_exec_command (document, "foreColor", FALSE, color);
+
+       g_free (color);
 
        g_object_notify (G_OBJECT (selection), "font-color");
 }
@@ -887,9 +924,6 @@ e_editor_selection_set_font_name (EEditorSelection *selection,
 guint
 e_editor_selection_get_font_size (EEditorSelection *selection)
 {
-       WebKitDOMNode *node;
-       WebKitDOMElement *element;
-       WebKitDOMRange *range;
        gchar *size;
        gint size_int;
 
@@ -897,20 +931,11 @@ e_editor_selection_get_font_size (EEditorSelection *selection)
                E_IS_EDITOR_SELECTION (selection),
                E_EDITOR_SELECTION_FONT_SIZE_NORMAL);
 
-       range = editor_selection_get_current_range (selection);
-       if (!range) {
-               return E_EDITOR_SELECTION_FONT_SIZE_NORMAL;
-       }
-
-       node = webkit_dom_range_get_common_ancestor_container (range, NULL);
-       element = find_parent_element_by_type (
-                       node, WEBKIT_TYPE_DOM_HTML_FONT_ELEMENT);
-       if (!element) {
+       size = get_font_property (selection, "size");
+       if (!size) {
                return E_EDITOR_SELECTION_FONT_SIZE_NORMAL;
        }
 
-       size = webkit_dom_html_font_element_get_size (
-                       WEBKIT_DOM_HTML_FONT_ELEMENT (element));
        size_int = atoi (size);
        g_free (size);
 
diff --git a/e-util/e-editor-selection.h b/e-util/e-editor-selection.h
index 99a1b16..8ced98c 100644
--- a/e-util/e-editor-selection.h
+++ b/e-util/e-editor-selection.h
@@ -129,9 +129,10 @@ guint                      e_editor_selection_get_font_size
 
 void                   e_editor_selection_set_font_color
                                                        (EEditorSelection *selection,
-                                                        const gchar *color);
-const gchar *          e_editor_selection_get_font_color
-                                                       (EEditorSelection *selection);
+                                                        const GdkRGBA *color);
+void                   e_editor_selection_get_font_color
+                                                       (EEditorSelection *selection,
+                                                        GdkRGBA *color);
 
 void                   e_editor_selection_set_block_format
                                                        (EEditorSelection *selection,
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index d78f134..c558e52 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -1,11 +1,4 @@
-<<<<<<< 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
@@ -22,501 +15,6 @@
  * Boston, MA 02111-1307, USA.
  */
 
-<<<<<<< HEAD
-#include <config.h>
-#include <glib/gi18n-lib.h>
-
-#include <camel/camel.h>
-#include <enchant/enchant.h>
-
-#include "e-editor.h"
-
-#include "e-activity-bar.h"
-#include "e-alert-bar.h"
-#include "e-alert-dialog.h"
-#include "e-alert-sink.h"
-#include "e-editor-private.h"
-#include "e-editor-utils.h"
-#include "e-editor-selection.h"
-
-#define E_EDITOR_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), E_TYPE_EDITOR, EEditorPrivate))
-
-/**
- * EEditor:
- *
- * #EEditor provides GUI for manipulating with properties of #EEditorWidget and
- * it's #EEditorSelection - i.e. toolbars and actions.
- */
-
-/* This controls how spelling suggestions are divided between the primary
- * context menu and a secondary menu.  The idea is to prevent the primary
- * menu from growing too long.
- *
- * The constants below are used as follows:
- *
- * if TOTAL_SUGGESTIONS <= MAX_LEVEL1_SUGGETIONS:
- *     LEVEL1_SUGGESTIONS = TOTAL_SUGGESTIONS
- * elif TOTAL_SUGGESTIONS - MAX_LEVEL1_SUGGESTIONS < MIN_LEVEL2_SUGGESTIONS:
- *     LEVEL1_SUGGESTIONS = TOTAL_SUGGESTIONS
- * else
- *     LEVEL1_SUGGESTIONS = MAX_LEVEL1_SUGGETIONS
- *
- * LEVEL2_SUGGESTIONS = TOTAL_SUGGESTIONS - LEVEL1_SUGGESTIONS
- *
- * Note that MAX_LEVEL1_SUGGETIONS is not a hard maximum.
- */
-#define MAX_LEVEL1_SUGGESTIONS 4
-#define MIN_LEVEL2_SUGGESTIONS 3
-
-enum {
-       PROP_0,
-       PROP_BUSY,
-       PROP_FILENAME
-};
-
-enum {
-       UPDATE_ACTIONS,
-       SPELL_LANGUAGES_CHANGED,
-       LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-/* Forward Declarations */
-static void    e_editor_alert_sink_init
-                                       (EAlertSinkInterface *interface);
-
-G_DEFINE_TYPE_WITH_CODE (
-       EEditor,
-       e_editor,
-       GTK_TYPE_GRID,
-       G_IMPLEMENT_INTERFACE (
-               E_TYPE_ALERT_SINK,
-               e_editor_alert_sink_init))
-
-/* Action callback for context menu spelling suggestions.
- * XXX This should really be in e-editor-actions.c */
-static void
-action_context_spell_suggest_cb (GtkAction *action,
-                                 EEditor *editor)
-{
-       EEditorWidget *widget;
-       EEditorSelection *selection;
-       const gchar *word;
-
-       word = g_object_get_data (G_OBJECT (action), "word");
-       g_return_if_fail (word != NULL);
-
-       widget = e_editor_get_editor_widget (editor);
-       selection = e_editor_widget_get_selection (widget);
-
-       e_editor_selection_replace_caret_word (selection, word);
-}
-
-static void
-editor_inline_spelling_suggestions (EEditor *editor)
-{
-       EEditorWidget *widget;
-       EEditorSelection *selection;
-       WebKitSpellChecker *checker;
-       GtkActionGroup *action_group;
-       GtkUIManager *manager;
-       gchar **suggestions;
-       const gchar *path;
-       gchar *word;
-       guint count = 0;
-       guint length;
-       guint merge_id;
-       guint threshold;
-       gint ii;
-
-       widget = e_editor_get_editor_widget (editor);
-       selection = e_editor_widget_get_selection (widget);
-       checker = WEBKIT_SPELL_CHECKER (webkit_get_text_checker ());
-
-       word = e_editor_selection_get_caret_word (selection);
-       if (word == NULL || *word == '\0')
-               return;
-
-       suggestions = webkit_spell_checker_get_guesses_for_word (checker, word, NULL);
-
-       path = "/context-menu/context-spell-suggest/";
-       manager = e_editor_get_ui_manager (editor);
-       action_group = editor->priv->suggestion_actions;
-       merge_id = editor->priv->spell_suggestions_merge_id;
-
-       length = (suggestions != NULL) ? g_strv_length (suggestions) : 0;
-
-       /* Calculate how many suggestions to put directly in the
-        * context menu.  The rest will go in a secondary menu. */
-       if (length <= MAX_LEVEL1_SUGGESTIONS) {
-               threshold = length;
-       } else if (length - MAX_LEVEL1_SUGGESTIONS < MIN_LEVEL2_SUGGESTIONS) {
-               threshold = length;
-       } else {
-               threshold = MAX_LEVEL1_SUGGESTIONS;
-       }
-
-       ii = 0;
-       for (ii = 0; suggestions && suggestions[ii]; ii++) {
-               gchar *suggestion = suggestions[ii];
-               gchar *action_name;
-               gchar *action_label;
-               GtkAction *action;
-               GtkWidget *child;
-               GSList *proxies;
-
-               /* Once we reach the threshold, put all subsequent
-                * spelling suggestions in a secondary menu. */
-               if (count == threshold)
-                       path = "/context-menu/context-more-suggestions-menu/";
-
-               /* Action name just needs to be unique. */
-               action_name = g_strdup_printf ("suggest-%d", count++);
-
-               action_label = g_markup_printf_escaped (
-                       "<b>%s</b>", suggestion);
-
-               action = gtk_action_new (
-                       action_name, action_label, NULL, NULL);
-
-               g_object_set_data_full (
-                       G_OBJECT (action), "word",
-                       g_strdup (suggestion), g_free);
-
-               g_signal_connect (
-                       action, "activate", G_CALLBACK (
-                       action_context_spell_suggest_cb), editor);
-
-               gtk_action_group_add_action (action_group, action);
-
-               gtk_ui_manager_add_ui (
-                       manager, merge_id, path,
-                       action_name, action_name,
-                       GTK_UI_MANAGER_AUTO, FALSE);
-
-               /* XXX GtkAction offers no support for Pango markup,
-                *     so we have to manually set "use-markup" on the
-                *     child of the proxy widget. */
-               gtk_ui_manager_ensure_update (manager);
-               proxies = gtk_action_get_proxies (action);
-               child = gtk_bin_get_child (proxies->data);
-               g_object_set (child, "use-markup", TRUE, NULL);
-
-               g_free (action_name);
-               g_free (action_label);
-       }
-
-       g_free (word);
-       g_strfreev (suggestions);
-}
-
-/* Helper for editor_update_actions() */
-static void
-editor_spell_checkers_foreach (EEditor *editor,
-                               const gchar *language_code)
-{
-       EEditorWidget *editor_widget;
-       EEditorSelection *selection;
-       ESpellChecker *spell_checker;
-       ESpellDictionary *dictionary;
-       GtkActionGroup *action_group;
-       GtkUIManager *manager;
-       GList *list, *link;
-       gchar *path;
-       gchar *word;
-       gint ii = 0;
-       guint merge_id;
-
-       editor_widget = e_editor_get_editor_widget (editor);
-       selection = e_editor_widget_get_selection (editor_widget);
-       spell_checker = e_editor_widget_get_spell_checker (editor_widget);
-
-       word = e_editor_selection_get_caret_word (selection);
-       if (word == NULL || *word == '\0')
-               return;
-
-       dictionary = e_spell_checker_ref_dictionary (
-               spell_checker, language_code);
-       if (dictionary != NULL) {
-               list = e_spell_dictionary_get_suggestions (
-                       dictionary, word, -1);
-               g_object_unref (dictionary);
-       } else {
-               list = NULL;
-       }
-
-       manager = e_editor_get_ui_manager (editor);
-       action_group = editor->priv->suggestion_actions;
-       merge_id = editor->priv->spell_suggestions_merge_id;
-
-       path = g_strdup_printf (
-               "/context-menu/context-spell-suggest/"
-               "context-spell-suggest-%s-menu", language_code);
-
-       for (link = list; link != NULL; link = g_list_next (link)) {
-               gchar *suggestion = link->data;
-               gchar *action_name;
-               gchar *action_label;
-               GtkAction *action;
-               GtkWidget *child;
-               GSList *proxies;
-
-               /* Action name just needs to be unique. */
-               action_name = g_strdup_printf (
-                       "suggest-%s-%d", language_code, ii);
-
-               action_label = g_markup_printf_escaped (
-                       "<b>%s</b>", suggestion);
-
-               action = gtk_action_new (
-                       action_name, action_label, NULL, NULL);
-
-               g_object_set_data_full (
-                       G_OBJECT (action), "word",
-                       g_strdup (suggestion), g_free);
-
-               g_signal_connect (
-                       action, "activate", G_CALLBACK (
-                       action_context_spell_suggest_cb), editor);
-
-               gtk_action_group_add_action (action_group, action);
-
-               gtk_ui_manager_add_ui (
-                       manager, merge_id, path,
-                       action_name, action_name,
-                       GTK_UI_MANAGER_AUTO, FALSE);
-
-               /* XXX GtkAction offers no supports for Pango markup,
-                *     so we have to manually set "use-markup" on the
-                *     child of the proxy widget. */
-               gtk_ui_manager_ensure_update (manager);
-               proxies = gtk_action_get_proxies (action);
-               child = gtk_bin_get_child (proxies->data);
-               g_object_set (child, "use-markup", TRUE, NULL);
-
-               g_free (action_name);
-               g_free (action_label);
-       }
-
-       g_list_free_full (list, (GDestroyNotify) g_free);
-
-       g_free (path);
-       g_free (word);
-}
-
-static void
-editor_update_actions (EEditor *editor,
-                       GdkEventButton *event)
-{
-       WebKitWebView *webview;
-       WebKitSpellChecker *checker;
-       WebKitHitTestResult *hit_test;
-       WebKitHitTestResultContext context;
-       WebKitDOMNode *node;
-       EEditorSelection *selection;
-       EEditorWidget *editor_widget;
-       ESpellChecker *spell_checker;
-       GtkUIManager *manager;
-       GtkActionGroup *action_group;
-       GList *list;
-       gchar **languages;
-       guint ii, n_languages;
-       gboolean visible;
-       guint merge_id;
-       gint loc, len;
-
-       editor_widget = e_editor_get_editor_widget (editor);
-       spell_checker = e_editor_widget_get_spell_checker (editor_widget);
-
-       webview = WEBKIT_WEB_VIEW (editor_widget);
-       manager = e_editor_get_ui_manager (editor);
-
-       editor->priv->image = NULL;
-       editor->priv->table_cell = NULL;
-
-       /* Update context menu item visibility. */
-       hit_test = webkit_web_view_get_hit_test_result (webview, event);
-       g_object_get (
-               G_OBJECT (hit_test),
-               "context", &context,
-               "inner-node", &node, NULL);
-       g_object_unref (hit_test);
-
-       visible = (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE);
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_IMAGE), visible);
-       if (visible)
-               editor->priv->image = node;
-
-       visible = (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK);
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_LINK), visible);
-
-       visible = (WEBKIT_DOM_IS_HTMLHR_ELEMENT (node));
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_RULE), visible);
-
-       visible = (webkit_dom_node_get_node_type (node) == 3);
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_TEXT), visible);
-
-       visible =
-               gtk_action_get_visible (ACTION (CONTEXT_PROPERTIES_IMAGE)) ||
-               gtk_action_get_visible (ACTION (CONTEXT_PROPERTIES_LINK)) ||
-               gtk_action_get_visible (ACTION (CONTEXT_PROPERTIES_TEXT));
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_PARAGRAPH), visible);
-
-       /* Set to visible if any of these are true:
-        *   - Selection is active and contains a link.
-        *   - Cursor is on a link.
-        *   - Cursor is on an image that has a URL or target.
-        */
-       visible = (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (node) ||
-               (e_editor_dom_node_find_parent_element (node, "A") != NULL));
-       gtk_action_set_visible (ACTION (CONTEXT_REMOVE_LINK), visible);
-
-       visible = (WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (node) ||
-               (e_editor_dom_node_find_parent_element (node, "TD") != NULL) ||
-               (e_editor_dom_node_find_parent_element (node, "TH") != NULL));
-       gtk_action_set_visible (ACTION (CONTEXT_DELETE_CELL), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_DELETE_COLUMN), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_DELETE_ROW), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_DELETE_TABLE), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_INSERT_COLUMN_AFTER), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_INSERT_COLUMN_BEFORE), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_INSERT_ROW_ABOVE), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_INSERT_ROW_BELOW), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_INSERT_TABLE), visible);
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_CELL), visible);
-       if (visible)
-               editor->priv->table_cell = node;
-
-       /* Note the |= (cursor must be in a table cell). */
-       visible |= (WEBKIT_DOM_IS_HTML_TABLE_ELEMENT (node) ||
-               (e_editor_dom_node_find_parent_element (node, "TABLE") != NULL));
-       gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_TABLE), visible);
-
-       /********************** Spell Check Suggestions **********************/
-
-       action_group = editor->priv->suggestion_actions;
-
-       /* Remove the old content from the context menu. */
-       merge_id = editor->priv->spell_suggestions_merge_id;
-       if (merge_id > 0) {
-               gtk_ui_manager_remove_ui (manager, merge_id);
-               editor->priv->spell_suggestions_merge_id = 0;
-       }
-
-       /* Clear the action group for spelling suggestions. */
-       list = gtk_action_group_list_actions (action_group);
-       while (list != NULL) {
-               GtkAction *action = list->data;
-
-               gtk_action_group_remove_action (action_group, action);
-               list = g_list_delete_link (list, list);
-       }
-
-       languages = e_spell_checker_list_active_languages (
-               spell_checker, &n_languages);
-
-       /* Decide if we should show spell checking items. */
-       checker = WEBKIT_SPELL_CHECKER (webkit_get_text_checker ());
-       selection = e_editor_widget_get_selection (editor_widget);
-       visible = FALSE;
-       if ((n_languages > 0) && e_editor_selection_has_text (selection)) {
-               gchar *word = e_editor_selection_get_caret_word (selection);
-               if (word && *word) {
-                       webkit_spell_checker_check_spelling_of_string (
-                               checker, word, &loc, &len);
-                       visible = (loc > -1);
-               } else {
-                       visible = FALSE;
-               }
-               g_free (word);
-       }
-
-       action_group = editor->priv->spell_check_actions;
-       gtk_action_group_set_visible (action_group, visible);
-
-       /* Exit early if spell checking items are invisible. */
-       if (!visible) {
-               g_strfreev (languages);
-               return;
-       }
-
-       merge_id = gtk_ui_manager_new_merge_id (manager);
-       editor->priv->spell_suggestions_merge_id = merge_id;
-
-       /* Handle a single active language as a special case. */
-       if (n_languages == 1) {
-               editor_inline_spelling_suggestions (editor);
-               g_strfreev (languages);
-               return;
-       }
-
-       /* Add actions and context menu content for active languages. */
-       for (ii = 0; ii < n_languages; ii++)
-               editor_spell_checkers_foreach (editor, languages[ii]);
-
-       g_strfreev (languages);
-}
-
-static void
-editor_spell_languages_changed (EEditor *editor)
-{
-       EEditorWidget *editor_widget;
-       ESpellChecker *spell_checker;
-       WebKitWebSettings *settings;
-       gchar *comma_separated;
-       gchar **languages;
-
-       editor_widget = e_editor_get_editor_widget (editor);
-       spell_checker = e_editor_widget_get_spell_checker (editor_widget);
-
-       languages = e_spell_checker_list_active_languages (spell_checker, NULL);
-       comma_separated = g_strjoinv (",", languages);
-       g_strfreev (languages);
-
-       /* Set the languages for webview to highlight misspelled words */
-       settings = webkit_web_view_get_settings (
-               WEBKIT_WEB_VIEW (editor->priv->editor_widget));
-
-       g_object_set (
-               G_OBJECT (settings),
-               "spell-checking-languages", comma_separated,
-               NULL);
-
-       if (editor->priv->spell_check_dialog != NULL)
-               e_editor_spell_check_dialog_update_dictionaries (
-                       E_EDITOR_SPELL_CHECK_DIALOG (
-                       editor->priv->spell_check_dialog));
-
-       g_free (comma_separated);
-}
-
-static gboolean
-editor_show_popup (EEditor *editor,
-                   GdkEventButton *event,
-                   gpointer user_data)
-{
-       GtkWidget *menu;
-
-       menu = e_editor_get_managed_widget (editor, "/context-menu");
-
-       g_signal_emit (editor, signals[UPDATE_ACTIONS], 0, event);
-
-       if (event != NULL)
-               gtk_menu_popup (
-                       GTK_MENU (menu), NULL, NULL, NULL,
-                       user_data, event->button, event->time);
-       else
-               gtk_menu_popup (
-                       GTK_MENU (menu), NULL, NULL, NULL,
-                       user_data, 0, gtk_get_current_event_time ());
-
-       return TRUE;
-}
-
-=======
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -536,7 +34,6 @@ enum {
        PROP_FILENAME
 };
 
->>>>>>> Initial import of GtkhtmlEditor class
 static gchar *
 editor_find_ui_file (const gchar *basename)
 {
@@ -562,65 +59,6 @@ editor_find_ui_file (const gchar *basename)
 }
 
 static void
-<<<<<<< HEAD
-editor_parent_changed (GtkWidget *widget,
-                       GtkWidget *previous_parent)
-{
-       GtkWidget *top_level;
-       EEditor *editor = E_EDITOR (widget);
-
-       /* If he now have a window, then install our accelators to it */
-       top_level = gtk_widget_get_toplevel (widget);
-       if (GTK_IS_WINDOW (top_level)) {
-               gtk_window_add_accel_group (
-                       GTK_WINDOW (top_level),
-                       gtk_ui_manager_get_accel_group (editor->priv->manager));
-       }
-}
-
-static void
-editor_notify_activity_cb (EActivityBar *activity_bar,
-                           GParamSpec *pspec,
-                           EEditor *editor)
-{
-       EEditorWidget *editor_widget;
-       WebKitWebView *web_view;
-       gboolean editable;
-       gboolean busy;
-
-       busy = (e_activity_bar_get_activity (activity_bar) != NULL);
-
-       if (busy == editor->priv->busy)
-               return;
-
-       editor->priv->busy = busy;
-
-       editor_widget = e_editor_get_editor_widget (editor);
-       web_view = WEBKIT_WEB_VIEW (editor_widget);
-
-       if (busy) {
-               editable = webkit_web_view_get_editable (web_view);
-               webkit_web_view_set_editable (web_view, FALSE);
-               editor->priv->saved_editable = editable;
-       } else {
-               editable = editor->priv->saved_editable;
-               webkit_web_view_set_editable (web_view, editable);
-       }
-
-       g_object_notify (G_OBJECT (editor), "busy");
-}
-
-static void
-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),
-=======
 editor_set_property (GObject *object,
                     guint property_id,
                     const GValue *value,
@@ -630,7 +68,6 @@ editor_set_property (GObject *object,
 
                case PROP_FILENAME:
                        e_editor_set_filename (E_EDITOR (object),
->>>>>>> Initial import of GtkhtmlEditor class
                                g_value_get_string (value));
                        return;
 
@@ -641,24 +78,6 @@ editor_set_property (GObject *object,
 
 static void
 editor_get_property (GObject *object,
-<<<<<<< HEAD
-                     guint property_id,
-                     GValue *value,
-                     GParamSpec *pspec)
-{
-       switch (property_id) {
-               case PROP_BUSY:
-                       g_value_set_boolean (
-                               value, e_editor_is_busy (
-                               E_EDITOR (object)));
-                       return;
-
-               case PROP_FILENAME:
-                       g_value_set_string (
-                               value, e_editor_get_filename (
-                               E_EDITOR (object)));
-                       return;
-=======
                     guint property_id,
                     GValue *value,
                     GParamSpec *pspec)
@@ -670,7 +89,6 @@ editor_get_property (GObject *object,
                                value, e_editor_get_filename(
                                E_EDITOR (object)));
                return;
->>>>>>> Initial import of GtkhtmlEditor class
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -681,23 +99,11 @@ 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");
@@ -717,72 +123,28 @@ editor_constructed (GObject *object)
        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);
-       priv->html_toolbar = g_object_ref (widget);
-       gtk_widget_show (widget);
-
-       /* Construct the activity bar. */
-
-       widget = e_activity_bar_new ();
-       gtk_widget_set_hexpand (widget, TRUE);
-       gtk_grid_attach (GTK_GRID (editor), widget, 0, 2, 1, 1);
-       priv->activity_bar = g_object_ref (widget);
-       /* EActivityBar controls its own visibility. */
-
-       g_signal_connect (
-               widget, "notify::activity",
-               G_CALLBACK (editor_notify_activity_cb), editor);
-
-       /* Construct the alert bar for errors. */
-
-       widget = e_alert_bar_new ();
-       gtk_widget_set_hexpand (widget, TRUE);
-       gtk_grid_attach (GTK_GRID (editor), widget, 0, 3, 1, 1);
-       priv->alert_bar = g_object_ref (widget);
-       /* EAlertBar controls its own visibility. */
-
-       /* 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. */
 
@@ -823,17 +185,6 @@ 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",
-               G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
-       g_object_bind_property (
-               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 (
@@ -845,17 +196,6 @@ 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");
-       widget = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
-       g_object_get (
-               G_OBJECT (priv->editor_widget), "im-context", &im_context, NULL);
-       gtk_im_multicontext_append_menuitems (
-               GTK_IM_MULTICONTEXT (im_context),
-               GTK_MENU_SHELL (widget));
-=======
        /* Initialize painters (requires "edit_area"). */
 
        /* FIXME WEBKIT
@@ -919,19 +259,11 @@ editor_constructed (GObject *object)
        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;
 
@@ -947,7 +279,6 @@ editor_dispose (GObject *object)
 
        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);
@@ -955,8 +286,6 @@ 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
@@ -968,17 +297,11 @@ editor_dispose (GObject *object)
        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);
@@ -987,56 +310,6 @@ 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. */
-       G_OBJECT_CLASS (e_editor_parent_class)->dispose (object);
-}
-
-static void
-editor_submit_alert (EAlertSink *alert_sink,
-                     EAlert *alert)
-{
-       EEditorPrivate *priv;
-       EAlertBar *alert_bar;
-       GtkWidget *toplevel;
-       GtkWidget *widget;
-       GtkWindow *parent;
-
-       priv = E_EDITOR_GET_PRIVATE (alert_sink);
-
-       switch (e_alert_get_message_type (alert)) {
-               case GTK_MESSAGE_INFO:
-               case GTK_MESSAGE_WARNING:
-               case GTK_MESSAGE_ERROR:
-                       alert_bar = E_ALERT_BAR (priv->alert_bar);
-                       e_alert_bar_add_alert (alert_bar, alert);
-                       break;
-
-               default:
-                       widget = GTK_WIDGET (alert_sink);
-                       toplevel = gtk_widget_get_toplevel (widget);
-                       if (GTK_IS_WINDOW (toplevel))
-                               parent = GTK_WINDOW (toplevel);
-                       else
-                               parent = NULL;
-                       widget = e_alert_dialog_new (parent, alert);
-                       gtk_dialog_run (GTK_DIALOG (widget));
-                       gtk_widget_destroy (widget);
-       }
-}
-
-static void
-e_editor_class_init (EEditorClass *class)
-{
-       GObjectClass *object_class;
-       GtkWidgetClass *widget_class;
-
-       g_type_class_add_private (class, sizeof (EEditorPrivate));
-
-       object_class = G_OBJECT_CLASS (class);
-=======
        /* FIXME WEBKIT
        DISPOSE (priv->palette);
        DISPOSE (priv->text_color);
@@ -1051,93 +324,31 @@ e_editor_class_init (EEditorClass *klass)
        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;
-
-       class->update_actions = editor_update_actions;
-       class->spell_languages_changed = editor_spell_languages_changed;
-
-       g_object_class_install_property (
-               object_class,
-               PROP_BUSY,
-               g_param_spec_boolean (
-                       "busy",
-                       "Busy",
-                       "Whether an activity is in progress",
-                       FALSE,
-                       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,
-                       G_PARAM_READWRITE |
-                       G_PARAM_STATIC_STRINGS));
-
-       signals[UPDATE_ACTIONS] = g_signal_new (
-               "update-actions",
-               G_TYPE_FROM_CLASS (class),
-               G_SIGNAL_RUN_LAST,
-               G_STRUCT_OFFSET (EEditorClass, update_actions),
-               NULL, NULL,
-               g_cclosure_marshal_VOID__BOXED,
-               G_TYPE_NONE, 1,
-               GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
-       signals[SPELL_LANGUAGES_CHANGED] = g_signal_new (
-               "spell-languages-changed",
-               G_OBJECT_CLASS_TYPE (class),
-               G_SIGNAL_RUN_LAST,
-               G_STRUCT_OFFSET (EEditorClass, spell_languages_changed),
-               NULL, NULL,
-               g_cclosure_marshal_VOID__VOID,
-               G_TYPE_NONE, 0);
-}
-
-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;
 
@@ -1149,86 +360,16 @@ 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 ();
        priv->selection = e_editor_widget_get_selection (priv->editor_widget);
 
        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);
-       priv->editor_layout_row = 2;
-
-       /* Tweak the main-toolbar style. */
-       widget = e_editor_get_managed_widget (editor, "/main-toolbar");
-       gtk_style_context_add_class (
-               gtk_widget_get_style_context (widget),
-               GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
-}
-
-/**
- * e_editor_new:
- *
- * Constructs a new #EEditor.
- *
- * Returns: A newly created widget. [transfer-full]
- */
-GtkWidget *
-e_editor_new (void)
-{
-       return g_object_new (E_TYPE_EDITOR, NULL);
-}
-
-/**
- * e_editor_is_busy:
- * @editor: an #EEditor
- *
- * Returns %TRUE only while an #EActivity is in progress.
- *
- * Returns: whether @editor is busy
- **/
-gboolean
-e_editor_is_busy (EEditor *editor)
-{
-       g_return_val_if_fail (E_IS_EDITOR (editor), FALSE);
-
-       return editor->priv->busy;
-}
-
-/**
- * e_editor_get_editor_widget:
- * @editor: an #EEditor
- *
- * Returns instance of #EEditorWidget used in the @editor.
- */
-EEditorWidget *
-e_editor_get_editor_widget (EEditor *editor)
-{
-       g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
-
-       return editor->priv->editor_widget;
-}
-
-/**
- * e_editor_get_ui_manager:
- * @editor: an #EEditor
- *
- * Returns #GtkUIManager that manages all the actions in the @editor.
- */
-=======
 
        g_free (filename);
 
@@ -1273,7 +414,6 @@ e_editor_get_builder (EEditor *editor)
        return editor->priv->builder;
 }
 
->>>>>>> Initial import of GtkhtmlEditor class
 GtkUIManager *
 e_editor_get_ui_manager (EEditor *editor)
 {
@@ -1282,22 +422,6 @@ e_editor_get_ui_manager (EEditor *editor)
        return editor->priv->manager;
 }
 
-<<<<<<< HEAD
-/**
- * e_editor_get_action:
- * @editor: an #EEditor
- * @action_name: name of action to lookup and return
- *
- * Returns: A #GtkAction matching @action_name or @NULL if no such action exists.
- */
-GtkAction *
-e_editor_get_action (EEditor *editor,
-                     const gchar *action_name)
-{
-       GtkUIManager *manager;
-       GtkAction *action = NULL;
-       GList *list;
-=======
 GtkAction *
 e_editor_get_action (EEditor *editor,
                     const gchar *action_name)
@@ -1305,23 +429,11 @@ e_editor_get_action (EEditor *editor,
        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) {
-               GtkActionGroup *action_group = list->data;
-
-               action = gtk_action_group_get_action (
-                       action_group, action_name);
-
-               list = g_list_next (list);
-=======
        iter = gtk_ui_manager_get_action_groups (manager);
 
        while (iter != NULL && action == NULL) {
@@ -1330,7 +442,6 @@ e_editor_get_action (EEditor *editor,
                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);
@@ -1338,66 +449,34 @@ e_editor_get_action (EEditor *editor,
        return action;
 }
 
-<<<<<<< HEAD
-/**
- * e_editor_get_action_group:
- * @editor: an #EEditor
- * @group_name: name of action group to lookup and return
- *
- * Returns: A #GtkActionGroup matching @group_name or @NULL if not such action
- * group exists.
- */
-GtkActionGroup *
-e_editor_get_action_group (EEditor *editor,
-                           const gchar *group_name)
-{
-       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)
 {
@@ -1417,7 +496,6 @@ e_editor_get_widget (EEditor *editor,
 GtkWidget *
 e_editor_get_managed_widget (EEditor *editor,
                             const gchar *widget_path)
->>>>>>> Initial import of GtkhtmlEditor class
 {
        GtkUIManager *manager;
        GtkWidget *widget;
@@ -1433,15 +511,6 @@ 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)
 {
@@ -1450,23 +519,9 @@ e_editor_get_filename (EEditor *editor)
        return editor->priv->filename;
 }
 
-<<<<<<< HEAD
-/**
- * e_editor_set_filename:
- * @editor: an #EEditor
- * @filename: Target file
- *
- * Sets file to which content of the editor should be saved (see
- * e_editor_save()).
- */
-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));
 
@@ -1479,81 +534,11 @@ e_editor_set_filename (EEditor *editor,
        g_object_notify (G_OBJECT (editor), "filename");
 }
 
-<<<<<<< HEAD
-/**
- * e_editor_new_activity:
- * @editor: an #EEditor
- *
- * Creates and configures a new #EActivity so its progress is shown in
- * the @editor.  The #EActivity comes pre-loaded with a #CamelOperation.
- *
- * Returns: a new #EActivity for use with @editor
- **/
-EActivity *
-e_editor_new_activity (EEditor *editor)
-{
-       EActivity *activity;
-       EActivityBar *activity_bar;
-       GCancellable *cancellable;
-
-       g_return_val_if_fail (E_IS_EDITOR (editor), NULL);
-
-       activity = e_activity_new ();
-       e_activity_set_alert_sink (activity, E_ALERT_SINK (editor));
-
-       cancellable = camel_operation_new ();
-       e_activity_set_cancellable (activity, cancellable);
-       g_object_unref (cancellable);
-
-       activity_bar = E_ACTIVITY_BAR (editor->priv->activity_bar);
-       e_activity_bar_set_activity (activity_bar, activity);
-
-       return activity;
-}
-
-/**
- * e_editor_pack_above:
- * @editor: an #EEditor
- * @child: a #GtkWidget
- *
- * Inserts @child right between the toolbars and the editor widget itself.
- */
-void
-e_editor_pack_above (EEditor *editor,
-                     GtkWidget *child)
-{
-       g_return_if_fail (E_IS_EDITOR (editor));
-       g_return_if_fail (GTK_IS_WIDGET (child));
-
-       gtk_grid_insert_row (GTK_GRID (editor), editor->priv->editor_layout_row);
-       gtk_grid_attach (GTK_GRID (editor), child, 0, editor->priv->editor_layout_row, 1, 1);
-       editor->priv->editor_layout_row++;
-}
-
-/**
- * e_editor_save:
- * @editor: an #EEditor
- * @filename: file into which to save the content
- * @as_html: whether the content should be saved as HTML or plain text
- * @error:[out] a #GError
- *
- * Saves current content of the #EEditorWidget into given file. When @as_html
- * is @FALSE, the content is first converted into plain text.
- *
- * Returns: @TRUE when content is succesfully saved, @FALSE otherwise.
- */
-gboolean
-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;
@@ -1566,19 +551,6 @@ 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));
-       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");
-=======
        if (as_html) {
                content = e_editor_widget_get_text_html (
                                E_EDITOR_WIDGET (editor));
@@ -1590,7 +562,6 @@ e_editor_save (EEditor *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;
        }
 
@@ -1604,7 +575,3 @@ e_editor_save (EEditor *editor,
 
        return TRUE;
 }
-<<<<<<< HEAD
-
-=======
->>>>>>> Initial import of GtkhtmlEditor class



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