gtkhtml r8686 - trunk/components/html-editor



Author: msuman
Date: Tue Jan 15 04:42:19 2008
New Revision: 8686
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=8686&view=rev

Log:
Patch from Irene Huang  <Irene Huang sun com> ** Fix for bug #343972 (Add 'Replace All' option for Spell check)

Modified:
   trunk/components/html-editor/ChangeLog
   trunk/components/html-editor/spellchecker.c

Modified: trunk/components/html-editor/spellchecker.c
==============================================================================
--- trunk/components/html-editor/spellchecker.c	(original)
+++ trunk/components/html-editor/spellchecker.c	Tue Jan 15 04:42:19 2008
@@ -212,6 +212,23 @@
 	check_next_word (cd, FALSE, TRUE);
 }
 
+static void 
+replace_all_cb (BonoboListener *listener, const char *event_name, const CORBA_any *arg, CORBA_Environment *ev, gpointer user_data)
+{
+	GtkHTMLControlData *cd = (GtkHTMLControlData *) user_data;
+	const gchar * err_word = NULL;
+
+	err_word = html_engine_get_spell_word (cd->html->engine);
+	g_return_if_fail (err_word);
+
+	html_engine_replace_spell_word_with (cd->html->engine, BONOBO_ARG_GET_STRING (arg)); 
+	while (!next_word (cd, TRUE))	
+		if (!strcmp (err_word, html_engine_get_spell_word (cd->html->engine)))
+			html_engine_replace_spell_word_with (cd->html->engine, BONOBO_ARG_GET_STRING (arg));
+	html_engine_beginning_of_document (cd->html->engine);
+	check_next_word (cd, FALSE, TRUE);
+}
+
 static void
 skip_cb (BonoboListener *listener, const char *event_name, const CORBA_any *arg, CORBA_Environment *ev, gpointer user_data)
 {
@@ -323,6 +340,7 @@
 	bonobo_property_bag_client_set_value_gboolean (cd->spell_control_pb, "single", !whole_document, NULL);
 
 	bonobo_event_source_client_add_listener (cd->spell_control_pb, replace_cb, "Bonobo/Property:change:replace", NULL, cd);
+	bonobo_event_source_client_add_listener (cd->spell_control_pb, replace_all_cb, "Bonobo/Property:change:repall", NULL, cd);
 	bonobo_event_source_client_add_listener (cd->spell_control_pb, add_cb, "Bonobo/Property:change:add", NULL, cd);
 	bonobo_event_source_client_add_listener (cd->spell_control_pb, ignore_cb, "Bonobo/Property:change:ignore", NULL, cd);
 	bonobo_event_source_client_add_listener (cd->spell_control_pb, skip_cb, "Bonobo/Property:change:skip", NULL, cd);



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