comparison src/conversation.c @ 206:610b7ffc4821

[gaim-migrate @ 216] Yeah, I ripped off torrey's spell checking code and made it work with GAIM :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Mon, 01 May 2000 10:12:08 +0000
parents 50dc3db25513
children 249e3fd5be29
comparison
equal deleted inserted replaced
205:5531861bf3f5 206:610b7ffc4821
643 } 643 }
644 644
645 void check_everything(GtkWidget *entry) 645 void check_everything(GtkWidget *entry)
646 { 646 {
647 struct conversation *c; 647 struct conversation *c;
648
648 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry)); 649 c = (struct conversation *)gtk_object_get_user_data(GTK_OBJECT(entry));
649 if (!c) return; 650 if (!c) return;
650 if (invert_tags(entry, "<B>", "</B>", 0)) 651 if (invert_tags(entry, "<B>", "</B>", 0))
651 quiet_set(c->bold, TRUE); 652 quiet_set(c->bold, TRUE);
652 else if (count_tag(entry, "<B>", "</B>")) 653 else if (count_tag(entry, "<B>", "</B>"))
797 g_free(buf2); 798 g_free(buf2);
798 } 799 }
799 800
800 801
801 802
803 static void check_spelling( GtkEditable * editable, gchar * new_text,
804 gint length, gint * position,
805 gpointer data )
806 {
807 gtk_signal_handler_block_by_func(GTK_OBJECT(editable),
808 GTK_SIGNAL_FUNC(check_spelling),
809 data);
810 //gtk_editable_insert_text( editable, new_text, length, position );
811 gtk_text_set_point(GTK_TEXT(editable), *position);
812 gtk_text_insert(GTK_TEXT(editable), NULL, &(GTK_WIDGET(editable)->style->fg[0]),
813 NULL, new_text, length );
814 if(isspace(new_text[0]))
815 {
816 gtk_text_freeze(GTK_TEXT(editable));
817 spell_check(GTK_WIDGET(editable));
818 gtk_text_thaw(GTK_TEXT(editable));
819 }
820 gtk_signal_handler_unblock_by_func(GTK_OBJECT(editable),
821 GTK_SIGNAL_FUNC(check_spelling),
822 data);
823 gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert-text");
824 }
802 825
803 826
804 void show_conv(struct conversation *c) 827 void show_conv(struct conversation *c)
805 { 828 {
806 GtkWidget *win; 829 GtkWidget *win;
1065 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); 1088 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name);
1066 gtk_window_set_title(GTK_WINDOW(win), buf); 1089 gtk_window_set_title(GTK_WINDOW(win), buf);
1067 gtk_window_set_focus(GTK_WINDOW(win),entry); 1090 gtk_window_set_focus(GTK_WINDOW(win),entry);
1068 1091
1069 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); 1092 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c);
1093 gtk_signal_connect(GTK_OBJECT(entry), "insert-text", GTK_SIGNAL_FUNC(check_spelling), entry);
1070 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry); 1094 gtk_signal_connect(GTK_OBJECT(entry), "key_press_event", GTK_SIGNAL_FUNC(entry_key_pressed), entry);
1071 1095
1072 gtk_widget_show(win); 1096 gtk_widget_show(win);
1073 1097
1074 } 1098 }