[evolution/wip/webkit2] Bug 753911 - Missing "Add to Dictionary" with multiple languages enabled
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 753911 - Missing "Add to Dictionary" with multiple languages enabled
- Date: Tue, 1 Mar 2016 10:55:35 +0000 (UTC)
commit 8e757d781c8edaf2ecf6bacb7a84cd459aff6b4b
Author: Milan Crha <mcrha redhat com>
Date: Tue Mar 1 11:19:22 2016 +0100
Bug 753911 - Missing "Add to Dictionary" with multiple languages enabled
e-util/e-html-editor-actions.c | 24 ++----------------------
e-util/e-html-editor.c | 31 ++++++++++++++++++++++++++++---
e-util/e-html-editor.h | 3 +++
3 files changed, 33 insertions(+), 25 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 24e5b5f..08765cd 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -103,26 +103,6 @@ insert_text_file_ready_cb (GFile *file,
g_object_unref (editor);
}
-static void
-editor_update_static_spell_actions (EHTMLEditor *editor)
-{
- ESpellChecker *checker;
- EHTMLEditorView *view;
- guint count = 0;
-
- view = e_html_editor_get_view (editor);
- checker = e_html_editor_view_get_spell_checker (view);
-/* FIXME WK2
- count = e_spell_checker_count_active_languages (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_visible (ACTION (SPELL_CHECK), count > 0);
- gtk_action_set_visible (ACTION (LANGUAGE_MENU), count > 0);
-}
-
/*****************************************************************************
* Action Callbacks
*****************************************************************************/
@@ -447,7 +427,7 @@ action_language_cb (GtkToggleAction *toggle_action,
gtk_action_set_visible (add_action, active);
g_free (action_name);
- editor_update_static_spell_actions (editor);
+ e_html_editor_update_spell_actions (editor);
g_signal_emit_by_name (editor, "spell-languages-changed");
}
@@ -1777,7 +1757,7 @@ editor_actions_init (EHTMLEditor *editor)
gtk_ui_manager_insert_action_group (manager, action_group, 0);
/* Do this after all language actions are initialized. */
- editor_update_static_spell_actions (editor);
+ e_html_editor_update_spell_actions (editor);
/* Fine Tuning */
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index 4a77610..7bdadb2 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -155,7 +155,6 @@ html_editor_inline_spelling_suggestions (EHTMLEditor *editor)
threshold = MAX_LEVEL1_SUGGESTIONS;
}
- ii = 0;
for (ii = 0; suggestions && suggestions[ii]; ii++) {
gchar *suggestion = suggestions[ii];
gchar *action_name;
@@ -253,7 +252,7 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
"/context-menu/context-spell-suggest/"
"context-spell-suggest-%s-menu", language_code);
- for (link = list; link != NULL; link = g_list_next (link)) {
+ for (link = list; link != NULL; link = g_list_next (link), ii++) {
gchar *suggestion = link->data;
gchar *action_name;
gchar *action_label;
@@ -266,7 +265,7 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
"suggest-%s-%d", language_code, ii);
action_label = g_markup_printf_escaped (
- "<b>%s</b>", suggestion);
+ "%s", suggestion);
action = gtk_action_new (
action_name, action_label, NULL, NULL);
@@ -306,6 +305,28 @@ html_editor_spell_checkers_foreach (EHTMLEditor *editor,
g_free (word);
}
+void
+e_html_editor_update_spell_actions (EHTMLEditor *editor)
+{
+ ESpellChecker *checker;
+ EHTMLEditorView *view;
+ guint count;
+
+ view = e_html_editor_get_view (editor);
+ checker = e_html_editor_view_get_spell_checker (view);
+
+ count = 0;
+/* FIXME WK2
+ count = e_spell_checker_count_active_languages (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_visible (ACTION (SPELL_CHECK), count > 0);
+ gtk_action_set_visible (ACTION (LANGUAGE_MENU), count > 0);
+}
+
static void
html_editor_update_actions (EHTMLEditor *editor)
{
@@ -439,6 +460,8 @@ html_editor_update_actions (EHTMLEditor *editor)
if (n_languages == 1) {
html_editor_inline_spelling_suggestions (editor);
g_strfreev (languages);
+
+ e_html_editor_update_spell_actions (editor);
return;
}
@@ -447,6 +470,8 @@ html_editor_update_actions (EHTMLEditor *editor)
html_editor_spell_checkers_foreach (editor, languages[ii]);
#endif
g_strfreev (languages);
+
+ e_html_editor_update_spell_actions (editor);
}
#if 0 /* FIXME WK2 */
static void
diff --git a/e-util/e-html-editor.h b/e-util/e-html-editor.h
index a8e06e8..59cfd1c 100644
--- a/e-util/e-html-editor.h
+++ b/e-util/e-html-editor.h
@@ -93,6 +93,9 @@ EActivityBar * e_html_editor_get_activity_bar (EHTMLEditor *editor);
EActivity * e_html_editor_new_activity (EHTMLEditor *editor);
void e_html_editor_pack_above (EHTMLEditor *editor,
GtkWidget *child);
+void e_html_editor_update_spell_actions
+ (EHTMLEditor *editor);
+
/*****************************************************************************
* High-Level Editing Interface
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]