comparison src/gtkprefs.c @ 11271:b33eccbc3a10

[gaim-migrate @ 13454] Add a clear formatting button to the GtkImHTML toolbar (to fulfill a request from SimGuy and Bleeter) and remove the ugly clear formatting button from the prefs. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 15 Aug 2005 06:52:45 +0000
parents 1cbe76d30e81
children ffc86d9ad8b7
comparison
equal deleted inserted replaced
11270:da0dc44368ba 11271:b33eccbc3a10
816 gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", color); 816 gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", color);
817 g_free(color); 817 g_free(color);
818 } 818 }
819 } 819 }
820 820
821 static void
822 formatting_reset_cb(GtkWidget *w, GtkWidget *imhtml) {
823 gtk_imhtml_clear_formatting(GTK_IMHTML(imhtml));
824 }
825
826 static GtkWidget * 821 static GtkWidget *
827 list_page() 822 list_page()
828 { 823 {
829 GtkWidget *ret; 824 GtkWidget *ret;
830 GtkWidget *vbox; 825 GtkWidget *vbox;
871 866
872 static GtkWidget * 867 static GtkWidget *
873 conv_page() 868 conv_page()
874 { 869 {
875 GtkWidget *ret; 870 GtkWidget *ret;
876 GtkWidget *vbox, *vbox2; 871 GtkWidget *vbox;
877 GtkWidget *hbox;
878 GtkWidget *label; 872 GtkWidget *label;
879 GList *names = NULL; 873 GList *names = NULL;
880 GtkWidget *frame; 874 GtkWidget *frame;
881 GtkWidget *imhtml; 875 GtkWidget *imhtml;
882 GtkWidget *toolbar; 876 GtkWidget *toolbar;
883 GtkWidget *button; 877 GtkWidget *hbox;
878 GtkWidget *vbox2;
884 879
885 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); 880 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE);
886 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER); 881 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER);
887 882
888 vbox = gaim_gtk_make_frame(ret, _("Conversations")); 883 vbox = gaim_gtk_make_frame(ret, _("Conversations"));
900 #ifdef USE_GTKSPELL 895 #ifdef USE_GTKSPELL
901 gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"), 896 gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"),
902 "/gaim/gtk/conversations/spellcheck", vbox); 897 "/gaim/gtk/conversations/spellcheck", vbox);
903 #endif 898 #endif
904 899
905 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
906 gtk_container_add(GTK_CONTAINER(vbox), hbox);
907
908 frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar); 900 frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar);
909 gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml"); 901 gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml");
910 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); 902 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE);
911 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml), 903 gtk_imhtml_set_format_functions(GTK_IMHTML(imhtml),
912 GTK_IMHTML_BOLD | 904 GTK_IMHTML_BOLD |
919 GTK_IMHTML_BACKCOLOR | 911 GTK_IMHTML_BACKCOLOR |
920 GTK_IMHTML_BACKGROUND); 912 GTK_IMHTML_BACKGROUND);
921 913
922 gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting. :)"), 0); 914 gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting. :)"), 0);
923 915
924 gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); 916 gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);
925
926 vbox2 = gtk_vbox_new(FALSE, 0);
927 gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0);
928 button = gtk_button_new_with_mnemonic(_("_Clear Formatting"));
929 gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
930 917
931 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) 918 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold"))
932 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml)); 919 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml));
933 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) 920 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic"))
934 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml)); 921 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml));
937 924
938 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); 925 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), gaim_prefs_get_int("/gaim/gtk/conversations/font_size"));
939 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor")); 926 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"));
940 gtk_imhtml_toggle_background(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor")); 927 gtk_imhtml_toggle_background(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"));
941 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); 928 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face"));
942
943 g_signal_connect(G_OBJECT(button), "clicked",
944 G_CALLBACK(formatting_reset_cb), imhtml);
945 929
946 g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle", 930 g_signal_connect_after(G_OBJECT(imhtml), "format_function_toggle",
947 G_CALLBACK(formatting_toggle_cb), toolbar); 931 G_CALLBACK(formatting_toggle_cb), toolbar);
948 932
949 933