[evolution/webkit-composer: 126/150] EEditor: Remove linked list from "spell-languages-changed" signal.



commit a79c3c3f581b033ea7b6b6d977c020dbb4812abd
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 18 08:43:23 2013 -0500

    EEditor: Remove linked list from "spell-languages-changed" signal.

 e-util/e-editor.c |   44 +++++++++++++++-----------------------------
 e-util/e-editor.h |    3 +--
 2 files changed, 16 insertions(+), 31 deletions(-)
---
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index 91567b2..16d164c 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -425,26 +425,20 @@ editor_update_actions (EEditor *editor,
 }
 
 static void
-editor_spell_languages_changed (EEditor *editor,
-                                GList *dictionaries)
+editor_spell_languages_changed (EEditor *editor)
 {
+	EEditorWidget *editor_widget;
+	ESpellChecker *spell_checker;
 	WebKitWebSettings *settings;
-	GString *languages;
-	const GList *iter;
-
-	languages = g_string_new ("");
-
-	/* Join the languages codes to comma-separated list */
-	for (iter = dictionaries; iter; iter = iter->next) {
-		ESpellDictionary *dictionary = iter->data;
+	gchar *comma_separated;
+	gchar **languages;
 
-		if (languages->len > 0)
-			g_string_append (languages, ",");
+	editor_widget = e_editor_get_editor_widget (editor);
+	spell_checker = e_editor_widget_get_spell_checker (editor_widget);
 
-		g_string_append (
-			languages,
-			e_spell_dictionary_get_code (dictionary));
-	}
+	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 (
@@ -452,7 +446,7 @@ editor_spell_languages_changed (EEditor *editor,
 
 	g_object_set (
 		G_OBJECT (settings),
-		"spell-checking-languages", languages->str,
+		"spell-checking-languages", comma_separated,
 		NULL);
 
 	if (editor->priv->spell_check_dialog != NULL)
@@ -460,7 +454,7 @@ editor_spell_languages_changed (EEditor *editor,
 			E_EDITOR_SPELL_CHECK_DIALOG (
 			editor->priv->spell_check_dialog));
 
-	g_string_free (languages, TRUE);
+	g_free (comma_separated);
 }
 
 static gboolean
@@ -760,9 +754,8 @@ e_editor_class_init (EEditorClass *class)
 		G_SIGNAL_RUN_LAST,
 		G_STRUCT_OFFSET (EEditorClass, spell_languages_changed),
 		NULL, NULL,
-		g_cclosure_marshal_VOID__POINTER,
-		G_TYPE_NONE, 1,
-		G_TYPE_POINTER);
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 }
 
 static void
@@ -1052,14 +1045,7 @@ e_editor_save (EEditor *editor,
 void
 e_editor_emit_spell_languages_changed (EEditor *editor)
 {
-	GList *dictionaries;
-
 	g_return_if_fail (editor != NULL);
 
-	dictionaries = g_list_copy (editor->priv->active_dictionaries);
-
-	g_signal_emit (
-		editor, signals[SPELL_LANGUAGES_CHANGED], 0, dictionaries);
-
-	g_list_free (dictionaries);
+	g_signal_emit (editor, signals[SPELL_LANGUAGES_CHANGED], 0);
 }
diff --git a/e-util/e-editor.h b/e-util/e-editor.h
index 9e49d5f..3e34eb6 100644
--- a/e-util/e-editor.h
+++ b/e-util/e-editor.h
@@ -64,8 +64,7 @@ struct _EEditorClass {
 	void		(*update_actions)	(EEditor *editor,
 						 GdkEventButton *event);
 	void		(*spell_languages_changed)
-						(EEditor *editor,
-						 GList *dictionaries);
+						(EEditor *editor);
 };
 
 GType		e_editor_get_type		(void) G_GNUC_CONST;



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