comparison src/gtkutils.c @ 12114:2cbb5993c819

[gaim-migrate @ 14414] Killed stylize(). No more gtk in server.c. Next stop: No more server.c. It looks like also the auto-response code was leaking, so that's fixed now. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 16 Nov 2005 16:59:22 +0000
parents 3b52d94437f3
children c7ae1fd0827d
comparison
equal deleted inserted replaced
12113:46fcc0765187 12114:2cbb5993c819
825 } 825 }
826 826
827 return FALSE; 827 return FALSE;
828 } 828 }
829 829
830 /*
831 * TODO: Do we even need this?
832 */
833 char *stylize(const gchar *text, int length)
834 {
835 char *tmp;
836 gchar *buf;
837 const char *font;
838 GdkColor fg_color, bg_color;
839
840 tmp = g_malloc(length);
841 buf = g_malloc(length);
842 g_snprintf(buf, length, "%s", text);
843
844 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
845 {
846 g_snprintf(tmp, length, "<B>%s</B>", buf);
847 strcpy(buf, tmp);
848 }
849
850 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic"))
851 {
852 g_snprintf(tmp, length, "<I>%s</I>", buf);
853 strcpy(buf, tmp);
854 }
855
856 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline"))
857 {
858 g_snprintf(tmp, length, "<U>%s</U>", buf);
859 strcpy(buf, tmp);
860 }
861
862 font = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
863
864 if (strcmp(font, "") != 0)
865 {
866 g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", font, buf);
867 strcpy(buf, tmp);
868 }
869
870 g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>",
871 gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), buf);
872 strcpy(buf, tmp);
873
874 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0)
875 {
876 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
877 &fg_color);
878
879 g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
880 fg_color.red/256, fg_color.green/256,
881 fg_color.blue/256, buf);
882 strcpy(buf, tmp);
883 }
884
885 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
886 {
887 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
888 &bg_color);
889
890 g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
891 bg_color.red/256, bg_color.green/256,
892 bg_color.blue/256, buf);
893 strcpy(buf, tmp);
894 }
895
896 g_free(tmp);
897 return buf;
898 }
899
900 void 830 void
901 gaim_gtk_setup_gtkspell(GtkTextView *textview) 831 gaim_gtk_setup_gtkspell(GtkTextView *textview)
902 { 832 {
903 #ifdef USE_GTKSPELL 833 #ifdef USE_GTKSPELL
904 GError *error = NULL; 834 GError *error = NULL;