Mercurial > pidgin
changeset 12651:a74cb5952db4
[gaim-migrate @ 14992]
Activate a GtkSpell on the status box. If your message contains a word
that GtkSpell doesn't recognize then it will have red squiggles underneath
it FOREVER. Is that going to annoy people?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 25 Dec 2005 01:36:31 +0000 |
parents | 2926e3c3185e |
children | e739ace2688b |
files | src/gtkstatusbox.c src/gtkutils.c |
diffstat | 2 files changed, 36 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkstatusbox.c Sat Dec 24 20:10:25 2005 +0000 +++ b/src/gtkstatusbox.c Sun Dec 25 01:36:31 2005 +0000 @@ -37,6 +37,13 @@ #include "gtkstatusbox.h" #include "gtkutils.h" +#ifdef USE_GTKSPELL +# include <gtkspell/gtkspell.h> +# ifdef _WIN32 +# include "wspell.h" +# endif +#endif + #define TYPING_TIMEOUT 4000 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data); @@ -72,7 +79,7 @@ }; GtkComboBoxClass *parent_class = NULL; - + static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass); static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box); @@ -213,7 +220,7 @@ statusbox, GAIM_CALLBACK(account_status_changed_cb)); statusbox->status_changed_signal = 0; } - gaim_prefs_disconnect_by_handle(statusbox); + gaim_prefs_disconnect_by_handle(statusbox); G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -227,7 +234,7 @@ GtkContainerClass *container_class = (GtkContainerClass*)klass; parent_class = g_type_class_peek_parent(klass); - + combo_class = (GtkComboBoxClass*)klass; combo_class->changed = gtk_gaim_status_box_changed; @@ -593,6 +600,24 @@ update_size(status_box); } +static void +spellcheck_prefs_cb(const char *name, GaimPrefType type, + gpointer value, gpointer data) +{ +#ifdef USE_GTKSPELL + GtkGaimStatusBox *status_box = (GtkGaimStatusBox *)data; + + if (value) + gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); + else + { + GtkSpell *spell; + spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(status_box->imhtml)); + gtkspell_detach(spell); + } +#endif +} + #if 0 static gboolean button_released_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) { @@ -701,6 +726,10 @@ G_CALLBACK(imhtml_remove_focus), status_box); g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box); gtk_imhtml_set_editable(GTK_IMHTML(status_box->imhtml), TRUE); +#ifdef USE_GTKSPELL + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) + gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(status_box->imhtml)); +#endif gtk_widget_set_parent(status_box->vbox, GTK_WIDGET(status_box)); gtk_widget_set_parent(status_box->toggle_button, GTK_WIDGET(status_box)); GTK_BIN(status_box)->child = status_box->toggle_button; @@ -726,7 +755,8 @@ current_status_pref_changed_cb, status_box); gaim_prefs_connect_callback(status_box, "/gaim/gtk/blist/show_buddy_icons", buddy_list_details_pref_changed_cb, status_box); - + gaim_prefs_connect_callback(status_box, "/gaim/gtk/conversations/spellcheck", + spellcheck_prefs_cb, status_box); } static void
--- a/src/gtkutils.c Sat Dec 24 20:10:25 2005 +0000 +++ b/src/gtkutils.c Sun Dec 25 01:36:31 2005 +0000 @@ -146,8 +146,10 @@ gtk_imhtml_set_editable(GTK_IMHTML(imhtml), editable); gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), GTK_IMHTML_ALL ^ GTK_IMHTML_IMAGE); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR); +#ifdef USE_GTKSPELL if (editable && gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(imhtml)); +#endif gtk_widget_show(imhtml); if (editable) {