# HG changeset patch # User Christian Hammond # Date 1054583759 0 # Node ID 2d86a5fa6fefdf69835acacf2dc78c8f5dcf16f3 # Parent 62f57ec16f29ada9ffcfd1100a77759ab9701cc2 [gaim-migrate @ 6092] More conversation preferences have callbacks now. We're almost there. committer: Tailor Script diff -r 62f57ec16f29 -r 2d86a5fa6fef src/gtkconv.c --- a/src/gtkconv.c Mon Jun 02 19:37:23 2003 +0000 +++ b/src/gtkconv.c Mon Jun 02 19:55:59 2003 +0000 @@ -4529,76 +4529,6 @@ /************************************************************************** * Public conversation utility functions **************************************************************************/ -void -gaim_gtkconv_toggle_smileys(void) -{ - GList *cl; - struct gaim_conversation *conv; - struct gaim_gtk_conversation *gtkconv; - - for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { - - conv = (struct gaim_conversation *)cl->data; - - if (!GAIM_IS_GTK_CONVERSATION(conv)) - continue; - - gtkconv = GAIM_GTK_CONVERSATION(conv); - - gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), - gaim_prefs_get_bool("/gaim/gtk/conversations/show_smileys")); - } -} - -void -gaim_gtkconv_toggle_timestamps(void) -{ - GList *cl; - struct gaim_conversation *conv; - struct gaim_gtk_conversation *gtkconv; - - for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { - - conv = (struct gaim_conversation *)cl->data; - - if (!GAIM_IS_GTK_CONVERSATION(conv)) - continue; - - gtkconv = GAIM_GTK_CONVERSATION(conv); - - gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); - } -} - -void -gaim_gtkconv_toggle_spellchk(void) -{ -#ifdef USE_GTKSPELL - GList *cl; - struct gaim_conversation *conv; - struct gaim_gtk_conversation *gtkconv; - GtkSpell *spell; - - for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { - - conv = (struct gaim_conversation *)cl->data; - - if (!GAIM_IS_GTK_CONVERSATION(conv)) - continue; - - gtkconv = GAIM_GTK_CONVERSATION(conv); - - if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) - gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); - else { - spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); - gtkspell_detach(spell); - } - } -#endif -} - static void remove_icon(struct gaim_gtk_conversation *gtkconv) { @@ -4908,29 +4838,6 @@ } void -gaim_gtkconv_hide_buddy_icons(void) -{ - gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); -} - -void -gaim_gtkconv_set_anim(void) -{ - GList *l; - - if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) - return; - - if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { - for (l = gaim_get_ims(); l != NULL; l = l->next) - stop_anim(NULL, (struct gaim_conversation *)l->data); - } else { - for (l = gaim_get_ims(); l != NULL; l = l->next) - start_anim(NULL, (struct gaim_conversation *)l->data); - } -} - -void gaim_gtkconv_update_font_buttons(void) { GList *l; @@ -5344,7 +5251,7 @@ if (!GAIM_IS_GTK_CONVERSATION(conv)) continue; - gtkconv= GAIM_GTK_CONVERSATION(conv); + gtkconv = GAIM_GTK_CONVERSATION(conv); if (value) gtk_widget_show(gtkconv->close); @@ -5353,6 +5260,101 @@ } } +static void +show_timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + GList *l; + struct gaim_conversation *conv; + struct gaim_gtk_conversation *gtkconv; + + for (l = gaim_get_conversations(); l != NULL; l = l->next) { + conv = (struct gaim_conversation *)l->data; + + if (!GAIM_IS_GTK_CONVERSATION(conv)) + continue; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); + } +} + +static void +spellcheck_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ +#ifdef USE_GTKSPELL + GList *cl; + struct gaim_conversation *conv; + struct gaim_gtk_conversation *gtkconv; + GtkSpell *spell; + + for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { + + conv = (struct gaim_conversation *)cl->data; + + if (!GAIM_IS_GTK_CONVERSATION(conv)) + continue; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + if (value) + gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); + else { + spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); + gtkspell_detach(spell); + } + } +#endif +} + +static void +show_smileys_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + GList *cl; + struct gaim_conversation *conv; + struct gaim_gtk_conversation *gtkconv; + + for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { + conv = (struct gaim_conversation *)cl->data; + + if (!GAIM_IS_GTK_CONVERSATION(conv)) + continue; + + gtkconv = GAIM_GTK_CONVERSATION(conv); + + gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), (gboolean)value); + } +} + +static void +show_buddy_icons_pref_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + gaim_conversation_foreach(gaim_gtkconv_update_buddy_icon); +} + +static void +animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, + gpointer value, gpointer data) +{ + GList *l; + + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) + return; + + if (value) { + for (l = gaim_get_ims(); l != NULL; l = l->next) + start_anim(NULL, (struct gaim_conversation *)l->data); + } + else { + for (l = gaim_get_ims(); l != NULL; l = l->next) + stop_anim(NULL, (struct gaim_conversation *)l->data); + } +} + void gaim_gtk_conversation_init(void) { @@ -5416,5 +5418,16 @@ /* Connect callbacks. */ gaim_prefs_connect_callback("/gaim/gtk/conversations/close_on_tabs", close_on_tabs_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/show_smileys", + show_smileys_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/show_timestamps", + show_timestamps_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/spellcheck", + spellcheck_pref_cb, NULL); + + gaim_prefs_connect_callback("/gaim/gtk/conversations/im/animate_buddy_icons", + animate_buddy_icons_pref_cb, NULL); + gaim_prefs_connect_callback("/gaim/gtk/conversations/im/show_buddy_icons", + show_buddy_icons_pref_cb, NULL); } diff -r 62f57ec16f29 -r 2d86a5fa6fef src/gtkconv.h --- a/src/gtkconv.h Mon Jun 02 19:37:23 2003 +0000 +++ b/src/gtkconv.h Mon Jun 02 19:55:59 2003 +0000 @@ -212,21 +212,6 @@ struct gaim_conversation_ui_ops *gaim_get_gtk_conversation_ui_ops(void); /** - * Toggles the display of smileys. - */ -void gaim_gtkconv_toggle_smileys(void); - -/** - * Toggles the display of timestamps. - */ -void gaim_gtkconv_toggle_timestamps(void); - -/** - * Toggles spell checking. - */ -void gaim_gtkconv_toggle_spellchk(void); - -/** * Updates the buddy icon on a conversation. * * @param conv The conversation. @@ -234,17 +219,6 @@ void gaim_gtkconv_update_buddy_icon(struct gaim_conversation *conv); /** - * Hides buddy icons on all conversations. - */ -void gaim_gtkconv_hide_buddy_icons(void); - -/** - * Enables or disables animation on all conversations, based off - * preferences. - */ -void gaim_gtkconv_set_anim(void); - -/** * Updates the font buttons on all conversations to reflect any changed * preferences. */