diff src/conversation.c @ 3802:9bcb42faccc0

[gaim-migrate @ 3945] Rewrote show_im_dialog and show_info_dialog. Ported to gtkspell2. Gtkspell2 is a library available from gtkspell.sf.net. It requires the pspell library. If you want the "highlight misspelled words" feature to work, you must have this library installed. If installed, configure will detect it and link against it. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 26 Oct 2002 06:41:13 +0000
parents 8cc3d7526043
children e403c93110d0
line wrap: on
line diff
--- a/src/conversation.c	Fri Oct 25 11:50:40 2002 +0000
+++ b/src/conversation.c	Sat Oct 26 06:41:13 2002 +0000
@@ -40,10 +40,12 @@
 #include <errno.h>
 #include <ctype.h>
 #include <gtk/gtk.h>
+#ifdef USE_GTKSPELL
+#include <gtkspell/gtkspell.h>
+#endif
 #include "gtkimhtml.h"
 #include <gdk/gdkkeysyms.h>
 #include "convo.h"
-#include "gtkspell.h"
 #include "prpl.h"
 
 #ifdef _WIN32
@@ -512,9 +514,6 @@
 
 	debug_printf("conversation close callback\n");
 
-/*	if (convo_options & OPT_CONVO_CHECK_SPELLING)
-		gtkspell_detach(GTK_TEXT(c->entry));*/
-
 	if (!c->is_chat) {
 		GSList *cn = connections;
 		if (!(misc_options & OPT_MISC_STEALTH_TYPING))
@@ -1511,10 +1510,6 @@
 	GtkTextIter start, end;
 	GtkTextMark *mark_start, *mark_end;
 
-/*	if (convo_options & OPT_CONVO_CHECK_SPELLING) {
-		gtkspell_detach(GTK_TEXT(entry));
-	}*/
-
 	if (gtk_text_buffer_get_selection_bounds(c->entry_buffer, &start, &end)) {
 		remove_tags(c, pre);
 		remove_tags(c, post);
@@ -1535,10 +1530,6 @@
 		gtk_text_buffer_place_cursor(c->entry_buffer, &start);
 	}
 
-/*	if (convo_options & OPT_CONVO_CHECK_SPELLING) {
-		gtkspell_attach(GTK_TEXT(entry));
-	}*/
-
 	gtk_widget_grab_focus(c->entry);
 }
 
@@ -2902,8 +2893,11 @@
 	g_signal_connect(G_OBJECT(c->entry_buffer), "delete_range",
 			   G_CALLBACK(delete_text_callback), c);
 
-/*	if (convo_options & OPT_CONVO_CHECK_SPELLING)
-		gtkspell_attach(GTK_TEXT(c->entry));*/
+#ifdef USE_GTKSPELL
+	if (convo_options & OPT_CONVO_CHECK_SPELLING)
+		gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL);
+#endif
+
 	gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(entry));
 	gtk_widget_show(entry);
 
@@ -3001,32 +2995,22 @@
 
 void toggle_spellchk()
 {
+#ifdef USE_GTKSPELL
 	GList *cnv = conversations;
 	GSList *cht;
 	struct conversation *c;
 	GSList *con = connections;
 	struct gaim_connection *gc;
-
-	if (convo_options & OPT_CONVO_CHECK_SPELLING){
-		/*If ispell fails to start, start aspell. This is the way that
-		  Gabber does it. -- lorien420@myrealbox.com */
-		if (gtkspell_start(NULL, ispell_cmd)<0){
-			debug_printf("gtkspell failed to start when using ispell\n");
-			if (gtkspell_start(NULL, aspell_cmd)<0){
-				debug_printf("gtkspell failed to start when using aspell\n");
-			} else
-				debug_printf("gtkspell started with aspell\n");
-		} else {
-			debug_printf("gtkspell started with ispell\n");
-		}
-	}
-
+	GtkSpell *spell;
+	
 	while (cnv) {
 		c = (struct conversation *)cnv->data;
-/*		if (convo_options & OPT_CONVO_CHECK_SPELLING)
-			gtkspell_attach(GTK_TEXT(c->entry));
-		else
-			gtkspell_detach(GTK_TEXT(c->entry));*/
+		if (convo_options & OPT_CONVO_CHECK_SPELLING) {
+			gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL);
+		} else {
+			spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(c->entry));
+			gtkspell_detach(spell);
+		}
 		cnv = cnv->next;
 	}
 
@@ -3035,17 +3019,17 @@
 		cht = gc->buddy_chats;
 		while (cht) {
 			c = (struct conversation *)cht->data;
-/*			if (convo_options & OPT_CONVO_CHECK_SPELLING)
-				gtkspell_attach(GTK_TEXT(c->entry));
-			else
-				gtkspell_detach(GTK_TEXT(c->entry));*/
+			if (convo_options & OPT_CONVO_CHECK_SPELLING) {
+				gtkspell_new_attach(GTK_TEXT_VIEW(c->entry), NULL, NULL);
+			} else {
+				spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(c->entry));
+				gtkspell_detach(spell);
+			}
 			cht = cht->next;
 		}
 		con = con->next;
 	}
-
-	if (!(convo_options & OPT_CONVO_CHECK_SPELLING))
-		gtkspell_stop();
+#endif
 }
 
 void toggle_timestamps()