[evolution/wip/webkit2] Remove some spell-checking related virtual methods in EContentEditorInterface



commit d26cac0a6161861f2a0cbea257734e65b2cc376b
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 9 23:27:11 2016 +0200

    Remove some spell-checking related virtual methods in EContentEditorInterface
    
    ...and replace them with properties.

 e-util/e-content-editor.c                    |   91 ++++++++++++++------------
 e-util/e-content-editor.h                    |   24 ++-----
 e-util/e-html-editor-actions.c               |   29 +++++----
 e-util/e-html-editor-spell-check-dialog.c    |    3 +-
 e-util/e-html-editor.c                       |   26 +++++---
 modules/settings/e-settings-content-editor.c |   23 ++++++-
 modules/webkit-editor/e-webkit-editor.c      |   51 +++++++++-----
 7 files changed, 145 insertions(+), 102 deletions(-)
---
diff --git a/e-util/e-content-editor.c b/e-util/e-content-editor.c
index cb3157b..1e2b0e7 100644
--- a/e-util/e-content-editor.c
+++ b/e-util/e-content-editor.c
@@ -395,6 +395,21 @@ e_content_editor_default_init (EContentEditorInterface *iface)
                        G_PARAM_STATIC_STRINGS));
 
        /**
+        * EContentEditor:spell-check-enabled
+        *
+        * Holds whether the spell checking is enabled.
+        */
+       g_object_interface_install_property (
+               iface,
+               g_param_spec_boolean (
+                       "spell-check-enabled",
+                       NULL,
+                       NULL,
+                       FALSE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_STATIC_STRINGS));
+
+       /**
         * EContentEditor:spell-checker:
         *
         * The #ESpellChecker used for spell checking.
@@ -498,6 +513,18 @@ e_content_editor_default_init (EContentEditorInterface *iface)
                G_TYPE_UINT);
 }
 
+ESpellChecker *
+e_content_editor_ref_spell_checker (EContentEditor *editor)
+{
+       ESpellChecker *spell_checker = NULL;
+
+       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), NULL);
+
+       g_object_get (G_OBJECT (editor), "spell-checker", &spell_checker, NULL);
+
+       return spell_checker;
+}
+
 gboolean
 e_content_editor_can_cut (EContentEditor *editor)
 {
@@ -582,6 +609,27 @@ e_content_editor_is_indented (EContentEditor *editor)
 }
 
 gboolean
+e_content_editor_get_spell_check_enabled (EContentEditor *editor)
+{
+       gboolean value = FALSE;
+
+       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
+
+       g_object_get (G_OBJECT (editor), "spell-check-enabled", &value, NULL);
+
+       return value;
+}
+
+void
+e_content_editor_set_spell_check_enabled (EContentEditor *editor,
+                                         gboolean enable)
+{
+       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
+
+       g_object_set (G_OBJECT (editor), "spell-check-enabled", enable, NULL);
+}
+
+gboolean
 e_content_editor_is_editable (EContentEditor *editor)
 {
        gboolean value = FALSE;
@@ -1446,20 +1494,6 @@ e_content_editor_clear_undo_redo_history (EContentEditor *editor)
        iface->clear_undo_redo_history (editor);
 }
 
-ESpellChecker *
-e_content_editor_get_spell_checker (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_val_if_fail (iface != NULL, FALSE);
-       g_return_val_if_fail (iface->get_spell_checker != NULL, FALSE);
-
-       return iface->get_spell_checker (editor);
-}
-
 void
 e_content_editor_set_spell_checking_languages (EContentEditor *editor,
                                                const gchar **languages)
@@ -1476,35 +1510,6 @@ e_content_editor_set_spell_checking_languages (EContentEditor *editor,
 }
 
 void
-e_content_editor_set_spell_check (EContentEditor *editor,
-                                  gboolean enable)
-{
-       EContentEditorInterface *iface;
-
-       g_return_if_fail (E_IS_CONTENT_EDITOR (editor));
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_if_fail (iface != NULL);
-       g_return_if_fail (iface->set_spell_check != NULL);
-
-       iface->set_spell_check (editor, enable);
-}
-
-gboolean
-e_content_editor_get_spell_check (EContentEditor *editor)
-{
-       EContentEditorInterface *iface;
-
-       g_return_val_if_fail (E_IS_CONTENT_EDITOR (editor), FALSE);
-
-       iface = E_CONTENT_EDITOR_GET_IFACE (editor);
-       g_return_val_if_fail (iface != NULL, FALSE);
-       g_return_val_if_fail (iface->get_spell_check != NULL, FALSE);
-
-       return iface->get_spell_check (editor);
-}
-
-void
 e_content_editor_select_all (EContentEditor *editor)
 {
        EContentEditorInterface *iface;
diff --git a/e-util/e-content-editor.h b/e-util/e-content-editor.h
index aa7e787..ee6eb07 100644
--- a/e-util/e-content-editor.h
+++ b/e-util/e-content-editor.h
@@ -89,16 +89,9 @@ struct _EContentEditorInterface {
 
        void            (*clear_undo_redo_history)      (EContentEditor *editor);
 
-       ESpellChecker * (*get_spell_checker)            (EContentEditor *editor);
-
        void            (*set_spell_checking_languages) (EContentEditor *editor,
                                                         const gchar **languages);
 
-       void            (*set_spell_check)              (EContentEditor *editor,
-                                                        gboolean enable);
-
-       gboolean        (*get_spell_check)              (EContentEditor *editor);
-
        gchar *         (*get_selected_text)            (EContentEditor *editor);
 
        gchar *         (*get_caret_word)               (EContentEditor *editor);
@@ -446,12 +439,19 @@ struct _EContentEditorInterface {
 
 /* Properties */
 
+ESpellChecker *        e_content_editor_ref_spell_checker
+                                               (EContentEditor *editor);
 gboolean       e_content_editor_can_cut        (EContentEditor *editor);
 gboolean       e_content_editor_can_copy       (EContentEditor *editor);
 gboolean       e_content_editor_can_paste      (EContentEditor *editor);
 gboolean       e_content_editor_can_undo       (EContentEditor *editor);
 gboolean       e_content_editor_can_redo       (EContentEditor *editor);
 gboolean       e_content_editor_is_indented    (EContentEditor *editor);
+gboolean       e_content_editor_get_spell_check_enabled
+                                               (EContentEditor *editor);
+void           e_content_editor_set_spell_check_enabled
+                                               (EContentEditor *editor,
+                                                gboolean enable);
 gboolean       e_content_editor_is_editable    (EContentEditor *editor);
 void           e_content_editor_set_editable   (EContentEditor *editor,
                                                 gboolean editable);
@@ -562,20 +562,10 @@ void              e_content_editor_redo           (EContentEditor *editor);
 void           e_content_editor_clear_undo_redo_history
                                                (EContentEditor *editor);
 
-ESpellChecker *        e_content_editor_get_spell_checker
-                                               (EContentEditor *editor);
-
 void           e_content_editor_set_spell_checking_languages
                                                (EContentEditor *editor,
                                                 const gchar **languages);
 
-void           e_content_editor_set_spell_check
-                                               (EContentEditor *editor,
-                                                gboolean enable);
-
-gboolean       e_content_editor_get_spell_check
-                                               (EContentEditor *editor);
-
 void           e_content_editor_select_all     (EContentEditor *editor);
 
 gchar *                e_content_editor_get_selected_text
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 91b9e97..005d2ec 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -215,11 +215,12 @@ action_context_spell_add_cb (GtkAction *action,
        gchar *word;
 
        cnt_editor = e_html_editor_get_content_editor (editor);
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        word = e_content_editor_get_caret_word (cnt_editor);
        if (word && *word)
                e_spell_checker_learn_word (spell_checker, word);
        g_free (word);
+       g_clear_object (&spell_checker);
 }
 
 static void
@@ -231,11 +232,12 @@ action_context_spell_ignore_cb (GtkAction *action,
        gchar *word;
 
        cnt_editor = e_html_editor_get_content_editor (editor);
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        word = e_content_editor_get_caret_word (cnt_editor);
        if (word && *word)
                e_spell_checker_ignore_word (spell_checker, word);
        g_free (word);
+       g_clear_object (&spell_checker);
 }
 
 static void
@@ -413,7 +415,7 @@ static void
 action_language_cb (GtkToggleAction *toggle_action,
                     EHTMLEditor *editor)
 {
-       ESpellChecker *checker;
+       ESpellChecker *spell_checker;
        EContentEditor *cnt_editor;
        const gchar *language_code;
        GtkAction *add_action;
@@ -421,11 +423,12 @@ action_language_cb (GtkToggleAction *toggle_action,
        gboolean active;
 
        cnt_editor = e_html_editor_get_content_editor (editor);
-       checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        language_code = gtk_action_get_name (GTK_ACTION (toggle_action));
 
        active = gtk_toggle_action_get_active (toggle_action);
-       e_spell_checker_set_language_active (checker, language_code, active);
+       e_spell_checker_set_language_active (spell_checker, language_code, active);
+       g_clear_object (&spell_checker);
 
        /* Update "Add Word To" context menu item visibility. */
        action_name = g_strdup_printf ("context-spell-add-%s", language_code);
@@ -1562,7 +1565,7 @@ static GtkActionEntry spell_context_entries[] = {
 static void
 editor_actions_setup_languages_menu (EHTMLEditor *editor)
 {
-       ESpellChecker *checker;
+       ESpellChecker *spell_checker;
        EContentEditor *cnt_editor;
        GtkUIManager *manager;
        GtkActionGroup *action_group;
@@ -1572,10 +1575,10 @@ editor_actions_setup_languages_menu (EHTMLEditor *editor)
        manager = editor->priv->manager;
        action_group = editor->priv->language_actions;
        cnt_editor = e_html_editor_get_content_editor (editor);
-       checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        merge_id = gtk_ui_manager_new_merge_id (manager);
 
-       list = e_spell_checker_list_available_dicts (checker);
+       list = e_spell_checker_list_available_dicts (spell_checker);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                ESpellDictionary *dictionary = link->data;
@@ -1600,7 +1603,7 @@ editor_actions_setup_languages_menu (EHTMLEditor *editor)
                 * We're not prepared to invoke the signal handler yet.
                 * The "Add Word To" actions have not yet been added. */
                active = e_spell_checker_get_language_active (
-                       checker, e_spell_dictionary_get_code (dictionary));
+                       spell_checker, e_spell_dictionary_get_code (dictionary));
                gtk_toggle_action_set_active (action, active);
 
                g_signal_connect (
@@ -1621,13 +1624,14 @@ editor_actions_setup_languages_menu (EHTMLEditor *editor)
        }
 
        g_list_free (list);
+       g_clear_object (&spell_checker);
 }
 
 static void
 editor_actions_setup_spell_check_menu (EHTMLEditor *editor)
 {
        EContentEditor *cnt_editor;
-       ESpellChecker *checker;
+       ESpellChecker *spell_checker;
        GtkUIManager *manager;
        GtkActionGroup *action_group;
        GList *available_dicts = NULL, *iter;
@@ -1636,8 +1640,8 @@ editor_actions_setup_spell_check_menu (EHTMLEditor *editor)
        manager = editor->priv->manager;
        action_group = editor->priv->spell_check_actions;;
        cnt_editor = e_html_editor_get_content_editor (editor);
-       checker = e_content_editor_get_spell_checker (cnt_editor);
-       available_dicts = e_spell_checker_list_available_dicts (checker);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
+       available_dicts = e_spell_checker_list_available_dicts (spell_checker);
        merge_id = gtk_ui_manager_new_merge_id (manager);
 
        for (iter = available_dicts; iter; iter = iter->next) {
@@ -1707,6 +1711,7 @@ editor_actions_setup_spell_check_menu (EHTMLEditor *editor)
        }
 
        g_list_free (available_dicts);
+       g_clear_object (&spell_checker);
 }
 
 void
diff --git a/e-util/e-html-editor-spell-check-dialog.c b/e-util/e-html-editor-spell-check-dialog.c
index e67da4a..d7447e0 100644
--- a/e-util/e-html-editor-spell-check-dialog.c
+++ b/e-util/e-html-editor-spell-check-dialog.c
@@ -525,7 +525,7 @@ e_html_editor_spell_check_dialog_update_dictionaries (EHTMLEditorSpellCheckDialo
 
        editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
        cnt_editor = e_html_editor_get_content_editor (editor);
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
 
        languages = e_spell_checker_list_active_languages (
                spell_checker, &n_languages);
@@ -573,5 +573,6 @@ e_html_editor_spell_check_dialog_update_dictionaries (EHTMLEditorSpellCheckDialo
        gtk_combo_box_set_active (combo_box, 0);
 
        g_object_unref (store);
+       g_clear_object (&spell_checker);
 }
 
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index 497403f..212df01 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -130,7 +130,7 @@ html_editor_inline_spelling_suggestions (EHTMLEditor *editor)
        if (word == NULL || *word == '\0')
                return;
 
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        suggestions = e_spell_checker_get_guesses_for_word (spell_checker, word);
 
        path = "/context-menu/context-spell-suggest/";
@@ -201,6 +201,7 @@ html_editor_inline_spelling_suggestions (EHTMLEditor *editor)
 
        g_free (word);
        g_strfreev (suggestions);
+       g_clear_object (&spell_checker);
 }
 
 /* Helper for html_editor_update_actions() */
@@ -224,7 +225,7 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
        if (word == NULL || *word == '\0')
                return;
 
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
 
        dictionary = e_spell_checker_ref_dictionary (
                spell_checker, language_code);
@@ -292,7 +293,7 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
        }
 
        g_list_free_full (list, (GDestroyNotify) g_free);
-
+       g_clear_object (&spell_checker);
        g_free (path);
        g_free (word);
 }
@@ -300,21 +301,23 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
 void
 e_html_editor_update_spell_actions (EHTMLEditor *editor)
 {
-       ESpellChecker *checker;
+       ESpellChecker *spell_checker;
        EContentEditor *cnt_editor;
        guint count;
 
        cnt_editor = e_html_editor_get_content_editor (editor);
-       checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
 
-       count = e_spell_checker_count_active_languages (checker);
+       count = e_spell_checker_count_active_languages (spell_checker);
 
        gtk_action_set_visible (ACTION (CONTEXT_SPELL_ADD), count == 1);
        gtk_action_set_visible (ACTION (CONTEXT_SPELL_ADD_MENU), count > 1);
        gtk_action_set_visible (ACTION (CONTEXT_SPELL_IGNORE), count > 0);
 
        gtk_action_set_sensitive (ACTION (SPELL_CHECK), count > 0);
-       gtk_action_set_sensitive (ACTION (LANGUAGE_MENU), e_spell_checker_count_available_dicts (checker) > 
0);
+       gtk_action_set_sensitive (ACTION (LANGUAGE_MENU), e_spell_checker_count_available_dicts 
(spell_checker) > 0);
+
+       g_clear_object (&spell_checker);
 }
 
 static void
@@ -401,7 +404,7 @@ html_editor_update_actions (EHTMLEditor *editor)
                list = g_list_delete_link (list, list);
        }
 
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
        languages = e_spell_checker_list_active_languages (
                spell_checker, &n_languages);
 
@@ -420,6 +423,8 @@ html_editor_update_actions (EHTMLEditor *editor)
        action_group = editor->priv->spell_check_actions;
        gtk_action_group_set_visible (action_group, visible);
 
+       g_clear_object (&spell_checker);
+
        /* Exit early if spell checking items are invisible. */
        if (!visible) {
                g_strfreev (languages);
@@ -455,7 +460,7 @@ html_editor_spell_languages_changed (EHTMLEditor *editor)
        gchar **languages;
 
        cnt_editor = e_html_editor_get_content_editor (editor);
-       spell_checker = e_content_editor_get_spell_checker (cnt_editor);
+       spell_checker = e_content_editor_ref_spell_checker (cnt_editor);
 
        languages = e_spell_checker_list_active_languages (spell_checker, NULL);
 
@@ -467,8 +472,9 @@ html_editor_spell_languages_changed (EHTMLEditor *editor)
                        E_HTML_EDITOR_SPELL_CHECK_DIALOG (
                        editor->priv->spell_check_dialog));
 
-       e_content_editor_set_spell_check (cnt_editor, languages && *languages);
+       e_content_editor_set_spell_check_enabled (cnt_editor, languages && *languages);
 
+       g_clear_object (&spell_checker);
        g_strfreev (languages);
 }
 
diff --git a/modules/settings/e-settings-content-editor.c b/modules/settings/e-settings-content-editor.c
index 8726f70..a6a378e 100644
--- a/modules/settings/e-settings-content-editor.c
+++ b/modules/settings/e-settings-content-editor.c
@@ -42,6 +42,19 @@ G_DEFINE_DYNAMIC_TYPE (
        E_TYPE_EXTENSION)
 
 static void
+settings_content_editor_inline_spelling_changed (ESettingsContentEditor *extension,
+                                                gboolean spell_check_enabled)
+{
+       EExtensible *extensible;
+       EContentEditor *cnt_editor;
+
+       extensible = e_extension_get_extensible (E_EXTENSION (extension));
+       cnt_editor = e_html_editor_get_content_editor (E_HTML_EDITOR (extensible));
+
+       e_content_editor_set_spell_check_enabled (cnt_editor, spell_check_enabled);
+}
+
+static void
 settings_content_editor_load_style (ESettingsContentEditor *extension)
 {
        EExtensible *extensible;
@@ -68,7 +81,10 @@ settings_content_editor_changed_cb (GSettings *settings,
                else
                        g_hash_table_remove (extension->priv->old_settings, key);
 
-               settings_content_editor_load_style (extension);
+               if (g_strcmp0 (key, "composer-inline-spelling") == 0)
+                       settings_content_editor_inline_spelling_changed (extension, g_settings_get_boolean 
(settings, key));
+               else
+                       settings_content_editor_load_style (extension);
        } else if (new_value) {
                g_variant_unref (new_value);
        }
@@ -82,6 +98,7 @@ settings_content_editor_html_editor_realize_cb (GtkWidget *html_editor,
 
        settings = extension->priv->settings;
 
+       settings_content_editor_inline_spelling_changed (extension, g_settings_get_boolean (settings, 
"composer-inline-spelling"));
        settings_content_editor_load_style (extension);
 
        /* Reload the web view when certain settings change. */
@@ -105,6 +122,10 @@ settings_content_editor_html_editor_realize_cb (GtkWidget *html_editor,
        g_signal_connect (
                settings, "changed::citation-color",
                G_CALLBACK (settings_content_editor_changed_cb), extension);
+
+       g_signal_connect (
+               settings, "changed::composer-inline-spelling",
+               G_CALLBACK (settings_content_editor_changed_cb), extension);
 }
 
 static void
diff --git a/modules/webkit-editor/e-webkit-editor.c b/modules/webkit-editor/e-webkit-editor.c
index 2b6404c..6669b1b 100644
--- a/modules/webkit-editor/e-webkit-editor.c
+++ b/modules/webkit-editor/e-webkit-editor.c
@@ -44,6 +44,7 @@ enum {
        PROP_CHANGED,
        PROP_EDITABLE,
        PROP_HTML_MODE,
+       PROP_SPELL_CHECK_ENABLED,
        PROP_SPELL_CHECKER,
 
        PROP_ALIGNMENT,
@@ -117,6 +118,7 @@ struct _EWebKitEditorPrivate {
        EContentEditorContentFlags content_flags;
 
        ESpellChecker *spell_checker;
+       gboolean spell_check_enabled;
 
        gulong owner_change_primary_clipboard_cb_id;
        gulong owner_change_clipboard_cb_id;
@@ -1760,11 +1762,9 @@ webkit_editor_copy (EContentEditor *editor)
 }
 
 static ESpellChecker *
-webkit_editor_get_spell_checker (EContentEditor *editor)
+webkit_editor_get_spell_checker (EWebKitEditor *wk_editor)
 {
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       g_return_val_if_fail (E_IS_WEBKIT_EDITOR (wk_editor), NULL);
 
        return wk_editor->priv->spell_checker;
 }
@@ -1810,26 +1810,28 @@ webkit_editor_set_spell_checking_languages (EContentEditor *editor,
 }
 
 static void
-webkit_editor_set_spell_check (EContentEditor *editor,
-                                       gboolean enable)
+webkit_editor_set_spell_check_enabled (EWebKitEditor *wk_editor,
+                                      gboolean enable)
 {
-       EWebKitEditor *wk_editor;
+       g_return_if_fail (E_IS_WEBKIT_EDITOR (wk_editor));
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       if ((wk_editor->priv->spell_check_enabled ? 1 : 0) == (enable ? 1 : 0))
+               return;
+
+       wk_editor->priv->spell_check_enabled = enable;
 
        webkit_editor_call_simple_extension_function (
                wk_editor, enable ? "DOMForceSpellCheck" : "DOMTurnSpellCheckOff");
+
+       g_object_notify (G_OBJECT (wk_editor), "spell-check-enabled");
 }
 
 static gboolean
-webkit_editor_get_spell_check (EContentEditor *editor)
+webkit_editor_get_spell_check_enabled (EWebKitEditor *wk_editor)
 {
-       EWebKitEditor *wk_editor;
-
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       g_return_val_if_fail (E_IS_WEBKIT_EDITOR (wk_editor), FALSE);
 
-       return g_settings_get_boolean (
-               wk_editor->priv->mail_settings, "composer-inline-spelling");
+       return wk_editor->priv->spell_check_enabled;
 }
 
 static gboolean
@@ -5169,6 +5171,12 @@ webkit_editor_set_property (GObject *object,
                                E_WEBKIT_EDITOR (object),
                                g_value_get_boolean (value));
                        return;
+
+               case PROP_SPELL_CHECK_ENABLED:
+                       webkit_editor_set_spell_check_enabled (
+                               E_WEBKIT_EDITOR (object),
+                               g_value_get_boolean (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -5327,11 +5335,18 @@ webkit_editor_get_property (GObject *object,
                                        E_WEBKIT_EDITOR (object)));
                        return;
 
+               case PROP_SPELL_CHECK_ENABLED:
+                       g_value_set_boolean (
+                               value,
+                               webkit_editor_get_spell_check_enabled (
+                                       E_WEBKIT_EDITOR (object)));
+                       return;
+
                case PROP_SPELL_CHECKER:
                        g_value_set_object (
                                value,
                                webkit_editor_get_spell_checker (
-                                       E_CONTENT_EDITOR (object)));
+                                       E_WEBKIT_EDITOR (object)));
                        return;
        }
 
@@ -5761,6 +5776,8 @@ e_webkit_editor_class_init (EWebKitEditorClass *class)
        g_object_class_override_property (
                object_class, PROP_UNDERLINE, "underline");
        g_object_class_override_property (
+               object_class, PROP_SPELL_CHECK_ENABLED, "spell-check-enabled");
+       g_object_class_override_property (
                object_class, PROP_SPELL_CHECKER, "spell-checker");
 }
 
@@ -5772,6 +5789,7 @@ e_webkit_editor_init (EWebKitEditor *wk_editor)
 
        wk_editor->priv = E_WEBKIT_EDITOR_GET_PRIVATE (wk_editor);
 
+       wk_editor->priv->spell_check_enabled = TRUE;
        wk_editor->priv->spell_checker = e_spell_checker_new ();
        wk_editor->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
(GDestroyNotify) g_variant_unref);
 
@@ -5870,10 +5888,7 @@ e_webkit_editor_content_editor_init (EContentEditorInterface *iface)
        iface->undo = webkit_editor_undo;
        iface->redo = webkit_editor_redo;
        iface->clear_undo_redo_history = webkit_editor_clear_undo_redo_history;
-       iface->get_spell_checker = webkit_editor_get_spell_checker;
        iface->set_spell_checking_languages = webkit_editor_set_spell_checking_languages;
-       iface->set_spell_check = webkit_editor_set_spell_check;
-       iface->get_spell_check = webkit_editor_get_spell_check;
 //     iface->get_selected_text = webkit_editor_get_selected_text; /* FIXME WK2 */
        iface->get_caret_word = webkit_editor_get_caret_word;
        iface->replace_caret_word = webkit_editor_replace_caret_word;


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