[evolution/webkit-composer: 111/111] Bug 689631 - Spell check languages are not honored



commit 4b2d8668a26e5f18ba511815b6472e15a0f987d2
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Jan 10 10:10:24 2013 -0500

    Bug 689631 - Spell check languages are not honored

 e-util/e-editor-actions.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/e-util/e-editor-actions.c b/e-util/e-editor-actions.c
index 7dc3e31..e349c32 100644
--- a/e-util/e-editor-actions.c
+++ b/e-util/e-editor-actions.c
@@ -1664,20 +1664,26 @@ static void
 editor_actions_setup_languages_menu (EEditor *editor)
 {
 	ESpellChecker *checker;
+	EEditorWidget *editor_widget;
 	GtkUIManager *manager;
 	GtkActionGroup *action_group;
-	GList *available_dicts, *iter;
+	GList *spell_languages;
+	GList *list, *link;
 	guint merge_id;
 
 	manager = editor->priv->manager;
 	action_group = editor->priv->language_actions;
-	checker = e_editor_widget_get_spell_checker (editor->priv->editor_widget);
-	available_dicts = e_spell_checker_list_available_dicts (checker);
+	editor_widget = editor->priv->editor_widget;
+	checker = e_editor_widget_get_spell_checker (editor_widget);
+	spell_languages = e_editor_widget_get_spell_languages (editor_widget);
 	merge_id = gtk_ui_manager_new_merge_id (manager);
 
-	for (iter = available_dicts; iter; iter = iter->next) {
-		ESpellDictionary *dictionary = iter->data;
+	list = e_spell_checker_list_available_dicts (checker);
+
+	for (link = list; link != NULL; link = g_list_next (link->next)) {
+		ESpellDictionary *dictionary = link->data;
 		GtkToggleAction *action;
+		gboolean active;
 
 		action = gtk_toggle_action_new (
 			e_spell_dictionary_get_code (dictionary),
@@ -1688,6 +1694,10 @@ editor_actions_setup_languages_menu (EEditor *editor)
 			action, "toggled",
 			G_CALLBACK (action_language_cb), editor);
 
+		/* Do this AFTER connecting to the "toggled" signal. */
+		active = (g_list_find (spell_languages, dictionary) != NULL);
+		gtk_toggle_action_set_active (action, active);
+
 		gtk_action_group_add_action (
 			action_group, GTK_ACTION (action));
 
@@ -1701,7 +1711,9 @@ editor_actions_setup_languages_menu (EEditor *editor)
 			GTK_UI_MANAGER_AUTO, FALSE);
 	}
 
-	g_list_free (available_dicts);
+	g_list_free (list);
+
+	g_list_free (spell_languages);
 }
 
 static void



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