[evolution] 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] Bug 753911 - Missing "Add to Dictionary" with multiple languages enabled
- Date: Fri, 28 Aug 2015 13:04:24 +0000 (UTC)
commit 91010e09760105f961f4765c8a8b78c221e7fe00
Author: Milan Crha <mcrha redhat com>
Date: Fri Aug 28 15:03:54 2015 +0200
Bug 753911 - Missing "Add to Dictionary" with multiple languages enabled
e-util/e-html-editor-actions.c | 26 +++-----------------------
e-util/e-html-editor.c | 29 ++++++++++++++++++++++++++---
e-util/e-html-editor.h | 3 +++
3 files changed, 32 insertions(+), 26 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 4f03a55..8517935 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -111,26 +111,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;
-
- view = e_html_editor_get_view (editor);
- checker = e_html_editor_view_get_spell_checker (view);
-
- 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
*****************************************************************************/
@@ -754,7 +734,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");
}
@@ -1965,7 +1945,7 @@ editor_actions_setup_spell_check_menu (EHTMLEditor *editor)
/* Visibility is dependent on whether the
* corresponding language action is active. */
- gtk_action_set_visible (action, FALSE);
+ gtk_action_set_visible (action, e_spell_checker_get_language_active (checker, code));
gtk_action_group_add_action (action_group, action);
@@ -2101,7 +2081,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 459d35f..caf57e7 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -154,7 +154,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;
@@ -251,7 +250,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;
@@ -264,7 +263,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);
@@ -304,6 +303,26 @@ 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 = 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,
GdkEventButton *event)
@@ -454,6 +473,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;
}
@@ -462,6 +483,8 @@ html_editor_update_actions (EHTMLEditor *editor,
html_editor_spell_checkers_foreach (editor, languages[ii]);
g_strfreev (languages);
+
+ e_html_editor_update_spell_actions (editor);
}
static void
diff --git a/e-util/e-html-editor.h b/e-util/e-html-editor.h
index 5618cc8..c78d33d 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]