[evolution-patches] Re: [gnome spell] #67804 Adding word to dictionary caused Evo to crash



there's gtkhtml part, which reports broken language settings to the user.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.476
diff -u -p -r1.476 ChangeLog
--- ChangeLog	15 Oct 2004 14:32:25 -0000	1.476
+++ ChangeLog	15 Oct 2004 14:34:14 -0000
@@ -1,5 +1,11 @@
 2004-10-15  Radek Doulik  <rodo ximian com>
 
+	* spell.c (spell_add_to_personal_no_language): new helper method
+	to report broken language settings
+	(spell_add_to_personal): call spell_add_to_personal_no_language if
+	language is null
+	(add_cb): ditto
+
 	* test-html-editor-control.c (save_through_plain_persist_stream):
 	fixed save plain
 
Index: spell.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/spell.c,v
retrieving revision 1.43
diff -u -p -r1.43 spell.c
--- spell.c	8 Dec 2003 18:36:54 -0000	1.43
+++ spell.c	15 Oct 2004 14:34:14 -0000
@@ -101,6 +101,17 @@ spell_add_to_session (GtkHTML *html, con
 	CORBA_exception_free (&ev);
 }
 
+static void
+spell_add_to_personal_no_language ()
+{
+	GtkWidget *info;
+
+	info = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO,
+				       GTK_BUTTONS_OK, _("Unable to add word to dictionary,\nlanguage settings are broken.\n"));
+	gtk_dialog_run (GTK_DIALOG (info));
+	gtk_widget_destroy (info);
+}
+
 void
 spell_add_to_personal (GtkHTML *html, const gchar *word, const gchar *language, gpointer data)
 {
@@ -112,9 +123,12 @@ spell_add_to_personal (GtkHTML *html, co
 	if (!cd->dict)
 		return;
 
-	CORBA_exception_init (&ev);
-	GNOME_Spell_Dictionary_addWordToPersonal (cd->dict, word, language, &ev);
-	CORBA_exception_free (&ev);
+	if (language) {
+		CORBA_exception_init (&ev);
+		GNOME_Spell_Dictionary_addWordToPersonal (cd->dict, word, language, &ev);
+		CORBA_exception_free (&ev);
+	} else
+		spell_add_to_personal_no_language ();
 }
 
 void
@@ -210,14 +224,20 @@ static void 
 add_cb (BonoboListener *listener, const char *event_name, const CORBA_any *arg, CORBA_Environment *ev, gpointer user_data)
 {
 	GtkHTMLControlData *cd = (GtkHTMLControlData *) user_data;
-	gchar *word;
+	gchar *word, *language;
 
 	word = html_engine_get_spell_word (cd->html->engine);
 	g_return_if_fail (word);
 
-	GNOME_Spell_Dictionary_addWordToPersonal (cd->dict, word, BONOBO_ARG_GET_STRING (arg), ev);
+	language = BONOBO_ARG_GET_STRING (arg);
+
+	if (language) {
+		GNOME_Spell_Dictionary_addWordToPersonal (cd->dict, word, language, ev);
+		check_next_word ((GtkHTMLControlData *) user_data, TRUE, TRUE);
+	} else
+		spell_add_to_personal_no_language ();
+
 	g_free (word);
-	check_next_word ((GtkHTMLControlData *) user_data, TRUE, TRUE);
 }
 
 static void 


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