Mercurial > pidgin
comparison src/gtkimhtml.c @ 11267:477e5cca8287
[gaim-migrate @ 13449]
Combining the Message Text tab in the preferences into the Conversation tab.
Along the way, I found and fixed a number of bugs relating to the formatting toolbar, etc.
This also includes part of patch #1240388 from Sadrul. I'm still seeing a couple bugs with the backcolor stuff, but I confirmed they were there before this change. Hopefully I haven't introduced any new bugs. Holler at me if I did.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 15 Aug 2005 04:15:22 +0000 |
parents | 2ab2de8add8b |
children | 1cbe76d30e81 |
comparison
equal
deleted
inserted
replaced
11266:a0e769ca84cf | 11267:477e5cca8287 |
---|---|
106 static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *mark, GtkIMHtml *imhtml); | 106 static void mark_set_cb(GtkTextBuffer *buffer, GtkTextIter *arg1, GtkTextMark *mark, GtkIMHtml *imhtml); |
107 static void hijack_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data); | 107 static void hijack_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data); |
108 static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data); | 108 static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data); |
109 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data); | 109 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data); |
110 static void imhtml_paste_insert(GtkIMHtml *imhtml, const char *text, gboolean plaintext); | 110 static void imhtml_paste_insert(GtkIMHtml *imhtml, const char *text, gboolean plaintext); |
111 static void imhtml_toggle_bold(GtkIMHtml *imhtml); | |
112 static void imhtml_toggle_italic(GtkIMHtml *imhtml); | |
113 static void imhtml_toggle_strike(GtkIMHtml *imhtml); | |
114 static void imhtml_toggle_underline(GtkIMHtml *imhtml); | |
115 static void imhtml_font_grow(GtkIMHtml *imhtml); | |
116 static void imhtml_font_shrink(GtkIMHtml *imhtml); | |
111 | 117 |
112 /* POINT_SIZE converts from AIM font sizes to a point size scale factor. */ | 118 /* POINT_SIZE converts from AIM font sizes to a point size scale factor. */ |
113 #define MAX_FONT_SIZE 7 | 119 #define MAX_FONT_SIZE 7 |
114 #define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) | 120 #define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) |
115 static gdouble _point_sizes [] = { .69444444, .8333333, 1, 1.2, 1.44, 1.728, 2.0736}; | 121 static gdouble _point_sizes [] = { .69444444, .8333333, 1, 1.2, 1.44, 1.728, 2.0736}; |
950 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, gtk_text_buffer_get_insert(imhtml->text_buffer)); | 956 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, gtk_text_buffer_get_insert(imhtml->text_buffer)); |
951 if (!imhtml->wbfo && !plaintext) | 957 if (!imhtml->wbfo && !plaintext) |
952 gtk_imhtml_close_tags(imhtml, &iter); | 958 gtk_imhtml_close_tags(imhtml, &iter); |
953 | 959 |
954 gtk_imhtml_insert_html_at_iter(imhtml, text, flags, &iter); | 960 gtk_imhtml_insert_html_at_iter(imhtml, text, flags, &iter); |
955 if (!imhtml->wbfo && !plaintext) | 961 if (!imhtml->wbfo && !plaintext) |
956 gtk_imhtml_close_tags(imhtml, &iter); | 962 gtk_imhtml_close_tags(imhtml, &iter); |
957 gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &iter); | 963 gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &iter); |
958 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(imhtml), gtk_text_buffer_get_insert(imhtml->text_buffer), | 964 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(imhtml), gtk_text_buffer_get_insert(imhtml->text_buffer), |
959 0, FALSE, 0.0, 0.0); | 965 0, FALSE, 0.0, 0.0); |
960 } | 966 } |
961 | 967 |
962 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data) | 968 static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data) |
1110 if (!(imhtml->format_functions & buttons)) | 1116 if (!(imhtml->format_functions & buttons)) |
1111 return; | 1117 return; |
1112 | 1118 |
1113 switch (buttons) { | 1119 switch (buttons) { |
1114 case GTK_IMHTML_BOLD: | 1120 case GTK_IMHTML_BOLD: |
1115 gtk_imhtml_toggle_bold(imhtml); | 1121 imhtml_toggle_bold(imhtml); |
1116 break; | 1122 break; |
1117 case GTK_IMHTML_ITALIC: | 1123 case GTK_IMHTML_ITALIC: |
1118 gtk_imhtml_toggle_italic(imhtml); | 1124 imhtml_toggle_italic(imhtml); |
1119 break; | 1125 break; |
1120 case GTK_IMHTML_UNDERLINE: | 1126 case GTK_IMHTML_UNDERLINE: |
1121 gtk_imhtml_toggle_underline(imhtml); | 1127 imhtml_toggle_underline(imhtml); |
1128 break; | |
1129 case GTK_IMHTML_STRIKE: | |
1130 imhtml_toggle_strike(imhtml); | |
1122 break; | 1131 break; |
1123 case GTK_IMHTML_SHRINK: | 1132 case GTK_IMHTML_SHRINK: |
1124 gtk_imhtml_font_shrink(imhtml); | 1133 imhtml_font_shrink(imhtml); |
1125 break; | 1134 break; |
1126 case GTK_IMHTML_GROW: | 1135 case GTK_IMHTML_GROW: |
1127 gtk_imhtml_font_grow(imhtml); | 1136 imhtml_font_grow(imhtml); |
1128 break; | 1137 break; |
1129 default: | 1138 default: |
1130 break; | 1139 break; |
1131 } | 1140 } |
1132 } | 1141 } |
3797 return g_strdup(imhtml->edit.backcolor); | 3806 return g_strdup(imhtml->edit.backcolor); |
3798 else | 3807 else |
3799 return NULL; | 3808 return NULL; |
3800 } | 3809 } |
3801 | 3810 |
3811 char * | |
3812 gtk_imhtml_get_current_background(GtkIMHtml *imhtml) | |
3813 { | |
3814 if (imhtml->edit.background) | |
3815 return g_strdup(imhtml->edit.background); | |
3816 else | |
3817 return NULL; | |
3818 } | |
3819 | |
3802 gint | 3820 gint |
3803 gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml) | 3821 gtk_imhtml_get_current_fontsize(GtkIMHtml *imhtml) |
3804 { | 3822 { |
3805 return imhtml->edit.fontsize; | 3823 return imhtml->edit.fontsize; |
3806 } | 3824 } |
3884 } | 3902 } |
3885 | 3903 |
3886 g_slist_free(tags); | 3904 g_slist_free(tags); |
3887 } | 3905 } |
3888 | 3906 |
3889 gboolean gtk_imhtml_toggle_bold(GtkIMHtml *imhtml) | 3907 static void imhtml_toggle_bold(GtkIMHtml *imhtml) |
3890 { | 3908 { |
3891 GObject *object; | |
3892 GtkTextIter start, end; | 3909 GtkTextIter start, end; |
3893 | 3910 |
3894 imhtml->edit.bold = !imhtml->edit.bold; | 3911 imhtml->edit.bold = !imhtml->edit.bold; |
3895 | 3912 |
3896 if (imhtml->wbfo) { | 3913 if (imhtml->wbfo) { |
3904 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "BOLD", &start, &end); | 3921 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "BOLD", &start, &end); |
3905 else | 3922 else |
3906 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "BOLD", &start, &end); | 3923 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "BOLD", &start, &end); |
3907 | 3924 |
3908 } | 3925 } |
3926 } | |
3927 | |
3928 void gtk_imhtml_toggle_bold(GtkIMHtml *imhtml) | |
3929 { | |
3930 GObject *object; | |
3931 | |
3932 g_return_if_fail(imhtml != NULL); | |
3933 | |
3909 object = g_object_ref(G_OBJECT(imhtml)); | 3934 object = g_object_ref(G_OBJECT(imhtml)); |
3935 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_BOLD); | |
3910 g_object_unref(object); | 3936 g_object_unref(object); |
3911 | 3937 } |
3912 return (imhtml->edit.bold != FALSE); | 3938 |
3913 } | 3939 static void imhtml_toggle_italic(GtkIMHtml *imhtml) |
3914 | 3940 { |
3915 gboolean gtk_imhtml_toggle_italic(GtkIMHtml *imhtml) | |
3916 { | |
3917 GObject *object; | |
3918 GtkTextIter start, end; | 3941 GtkTextIter start, end; |
3919 | 3942 |
3920 imhtml->edit.italic = !imhtml->edit.italic; | 3943 imhtml->edit.italic = !imhtml->edit.italic; |
3921 | 3944 |
3922 if (imhtml->wbfo) { | 3945 if (imhtml->wbfo) { |
3929 if (imhtml->edit.italic) | 3952 if (imhtml->edit.italic) |
3930 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "ITALICS", &start, &end); | 3953 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "ITALICS", &start, &end); |
3931 else | 3954 else |
3932 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "ITALICS", &start, &end); | 3955 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "ITALICS", &start, &end); |
3933 } | 3956 } |
3957 } | |
3958 | |
3959 void gtk_imhtml_toggle_italic(GtkIMHtml *imhtml) | |
3960 { | |
3961 GObject *object; | |
3962 | |
3963 g_return_if_fail(imhtml != NULL); | |
3964 | |
3934 object = g_object_ref(G_OBJECT(imhtml)); | 3965 object = g_object_ref(G_OBJECT(imhtml)); |
3935 g_object_unref(object); | 3966 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_ITALIC); |
3936 | 3967 g_object_unref(object);} |
3937 return imhtml->edit.italic != FALSE; | 3968 |
3938 } | 3969 static void imhtml_toggle_underline(GtkIMHtml *imhtml) |
3939 | 3970 { |
3940 gboolean gtk_imhtml_toggle_underline(GtkIMHtml *imhtml) | |
3941 { | |
3942 GObject *object; | |
3943 GtkTextIter start, end; | 3971 GtkTextIter start, end; |
3944 | 3972 |
3945 imhtml->edit.underline = !imhtml->edit.underline; | 3973 imhtml->edit.underline = !imhtml->edit.underline; |
3946 | 3974 |
3947 if (imhtml->wbfo) { | 3975 if (imhtml->wbfo) { |
3954 if (imhtml->edit.underline) | 3982 if (imhtml->edit.underline) |
3955 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "UNDERLINE", &start, &end); | 3983 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "UNDERLINE", &start, &end); |
3956 else | 3984 else |
3957 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "UNDERLINE", &start, &end); | 3985 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "UNDERLINE", &start, &end); |
3958 } | 3986 } |
3987 } | |
3988 | |
3989 void gtk_imhtml_toggle_underline(GtkIMHtml *imhtml) | |
3990 { | |
3991 GObject *object; | |
3992 | |
3993 g_return_if_fail(imhtml != NULL); | |
3994 | |
3959 object = g_object_ref(G_OBJECT(imhtml)); | 3995 object = g_object_ref(G_OBJECT(imhtml)); |
3996 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_UNDERLINE); | |
3960 g_object_unref(object); | 3997 g_object_unref(object); |
3961 | 3998 } |
3962 return imhtml->edit.underline != FALSE; | 3999 |
3963 } | 4000 static void imhtml_toggle_strike(GtkIMHtml *imhtml) |
3964 | 4001 { |
3965 gboolean gtk_imhtml_toggle_strike(GtkIMHtml *imhtml) | |
3966 { | |
3967 GObject *object; | |
3968 GtkTextIter start, end; | 4002 GtkTextIter start, end; |
3969 | 4003 |
3970 imhtml->edit.strike = !imhtml->edit.strike; | 4004 imhtml->edit.strike = !imhtml->edit.strike; |
3971 | 4005 |
3972 if (imhtml->wbfo) { | 4006 if (imhtml->wbfo) { |
3979 if (imhtml->edit.strike) | 4013 if (imhtml->edit.strike) |
3980 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "STRIKE", &start, &end); | 4014 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "STRIKE", &start, &end); |
3981 else | 4015 else |
3982 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "STRIKE", &start, &end); | 4016 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "STRIKE", &start, &end); |
3983 } | 4017 } |
4018 } | |
4019 | |
4020 void gtk_imhtml_toggle_strike(GtkIMHtml *imhtml) | |
4021 { | |
4022 GObject *object; | |
4023 | |
4024 g_return_if_fail(imhtml != NULL); | |
4025 | |
3984 object = g_object_ref(G_OBJECT(imhtml)); | 4026 object = g_object_ref(G_OBJECT(imhtml)); |
4027 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_STRIKE); | |
3985 g_object_unref(object); | 4028 g_object_unref(object); |
3986 | |
3987 return imhtml->edit.strike != FALSE; | |
3988 } | 4029 } |
3989 | 4030 |
3990 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size) | 4031 void gtk_imhtml_font_set_size(GtkIMHtml *imhtml, gint size) |
3991 { | 4032 { |
3992 GObject *object; | 4033 GObject *object; |
3993 GtkTextIter start, end; | 4034 GtkTextIter start, end; |
3994 GtkIMHtmlButtons b = 0; | |
3995 | 4035 |
3996 imhtml->edit.fontsize = size; | 4036 imhtml->edit.fontsize = size; |
3997 | |
3998 | 4037 |
3999 if (imhtml->wbfo) { | 4038 if (imhtml->wbfo) { |
4000 gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end); | 4039 gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end); |
4001 remove_font_size(imhtml, &start, &end, TRUE); | 4040 remove_font_size(imhtml, &start, &end, TRUE); |
4002 gtk_text_buffer_apply_tag(imhtml->text_buffer, | 4041 gtk_text_buffer_apply_tag(imhtml->text_buffer, |
4006 gtk_text_buffer_apply_tag(imhtml->text_buffer, | 4045 gtk_text_buffer_apply_tag(imhtml->text_buffer, |
4007 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); | 4046 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); |
4008 } | 4047 } |
4009 | 4048 |
4010 object = g_object_ref(G_OBJECT(imhtml)); | 4049 object = g_object_ref(G_OBJECT(imhtml)); |
4011 b |= GTK_IMHTML_SHRINK; | 4050 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_SHRINK | GTK_IMHTML_GROW); |
4012 b |= GTK_IMHTML_GROW; | |
4013 g_object_unref(object); | 4051 g_object_unref(object); |
4014 } | 4052 } |
4015 | 4053 |
4016 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml) | 4054 static void imhtml_font_shrink(GtkIMHtml *imhtml) |
4017 { | 4055 { |
4018 GObject *object; | |
4019 GtkTextIter start, end; | 4056 GtkTextIter start, end; |
4020 | 4057 |
4021 if (imhtml->edit.fontsize == 1) | 4058 if (imhtml->edit.fontsize == 1) |
4022 return; | 4059 return; |
4023 | 4060 |
4034 } else if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { | 4071 } else if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { |
4035 remove_font_size(imhtml, &start, &end, FALSE); | 4072 remove_font_size(imhtml, &start, &end, FALSE); |
4036 gtk_text_buffer_apply_tag(imhtml->text_buffer, | 4073 gtk_text_buffer_apply_tag(imhtml->text_buffer, |
4037 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); | 4074 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); |
4038 } | 4075 } |
4076 } | |
4077 | |
4078 void gtk_imhtml_font_shrink(GtkIMHtml *imhtml) | |
4079 { | |
4080 GObject *object; | |
4081 | |
4082 g_return_if_fail(imhtml != NULL); | |
4083 | |
4039 object = g_object_ref(G_OBJECT(imhtml)); | 4084 object = g_object_ref(G_OBJECT(imhtml)); |
4085 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_SHRINK); | |
4040 g_object_unref(object); | 4086 g_object_unref(object); |
4041 } | 4087 } |
4042 | 4088 |
4043 void gtk_imhtml_font_grow(GtkIMHtml *imhtml) | 4089 static void imhtml_font_grow(GtkIMHtml *imhtml) |
4044 { | 4090 { |
4045 GObject *object; | |
4046 GtkTextIter start, end; | 4091 GtkTextIter start, end; |
4047 | 4092 |
4048 if (imhtml->edit.fontsize == MAX_FONT_SIZE) | 4093 if (imhtml->edit.fontsize == MAX_FONT_SIZE) |
4049 return; | 4094 return; |
4050 | 4095 |
4061 } else if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { | 4106 } else if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { |
4062 remove_font_size(imhtml, &start, &end, FALSE); | 4107 remove_font_size(imhtml, &start, &end, FALSE); |
4063 gtk_text_buffer_apply_tag(imhtml->text_buffer, | 4108 gtk_text_buffer_apply_tag(imhtml->text_buffer, |
4064 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); | 4109 find_font_size_tag(imhtml, imhtml->edit.fontsize), &start, &end); |
4065 } | 4110 } |
4111 } | |
4112 | |
4113 void gtk_imhtml_font_grow(GtkIMHtml *imhtml) | |
4114 { | |
4115 GObject *object; | |
4116 | |
4117 g_return_if_fail(imhtml != NULL); | |
4118 | |
4066 object = g_object_ref(G_OBJECT(imhtml)); | 4119 object = g_object_ref(G_OBJECT(imhtml)); |
4120 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, GTK_IMHTML_GROW); | |
4067 g_object_unref(object); | 4121 g_object_unref(object); |
4068 } | 4122 } |
4069 | 4123 |
4070 #define gtk_imhtml_toggle_str_tag(imhtml, color, edit_field, remove_func, find_func) { \ | 4124 #define gtk_imhtml_toggle_str_tag(imhtml, color, edit_field, remove_func, find_func, button) { \ |
4071 GObject *object; \ | 4125 GObject *object; \ |
4072 GtkTextIter start, end; \ | 4126 GtkTextIter start, end; \ |
4073 \ | 4127 \ |
4074 g_free(edit_field); \ | 4128 g_free(edit_field); \ |
4075 edit_field = NULL; \ | 4129 edit_field = NULL; \ |
4099 remove_func(imhtml, &start, &end, TRUE); \ | 4153 remove_func(imhtml, &start, &end, TRUE); \ |
4100 } \ | 4154 } \ |
4101 } \ | 4155 } \ |
4102 \ | 4156 \ |
4103 object = g_object_ref(G_OBJECT(imhtml)); \ | 4157 object = g_object_ref(G_OBJECT(imhtml)); \ |
4158 g_signal_emit(object, signals[TOGGLE_FORMAT], 0, button); \ | |
4104 g_object_unref(object); \ | 4159 g_object_unref(object); \ |
4105 \ | 4160 \ |
4106 return edit_field != NULL; \ | 4161 return edit_field != NULL; \ |
4107 } | 4162 } |
4108 | 4163 |
4109 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color) | 4164 gboolean gtk_imhtml_toggle_forecolor(GtkIMHtml *imhtml, const char *color) |
4110 { | 4165 { |
4111 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.forecolor, remove_font_forecolor, find_font_forecolor_tag); | 4166 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.forecolor, remove_font_forecolor, find_font_forecolor_tag, GTK_IMHTML_FORECOLOR); |
4112 } | 4167 } |
4113 | 4168 |
4114 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color) | 4169 gboolean gtk_imhtml_toggle_backcolor(GtkIMHtml *imhtml, const char *color) |
4115 { | 4170 { |
4116 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.backcolor, remove_font_backcolor, find_font_backcolor_tag); | 4171 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.backcolor, remove_font_backcolor, find_font_backcolor_tag, GTK_IMHTML_BACKCOLOR); |
4117 } | 4172 } |
4118 | 4173 |
4119 gboolean gtk_imhtml_toggle_background(GtkIMHtml *imhtml, const char *color) | 4174 gboolean gtk_imhtml_toggle_background(GtkIMHtml *imhtml, const char *color) |
4120 { | 4175 { |
4121 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.background, remove_font_background, find_font_background_tag); | 4176 gtk_imhtml_toggle_str_tag(imhtml, color, imhtml->edit.background, remove_font_background, find_font_background_tag, GTK_IMHTML_BACKGROUND); |
4122 } | 4177 } |
4123 | 4178 |
4124 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face) | 4179 gboolean gtk_imhtml_toggle_fontface(GtkIMHtml *imhtml, const char *face) |
4125 { | 4180 { |
4126 gtk_imhtml_toggle_str_tag(imhtml, face, imhtml->edit.fontface, remove_font_face, find_font_face_tag); | 4181 gtk_imhtml_toggle_str_tag(imhtml, face, imhtml->edit.fontface, remove_font_face, find_font_face_tag, GTK_IMHTML_FACE); |
4127 } | 4182 } |
4128 | 4183 |
4129 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url) | 4184 void gtk_imhtml_toggle_link(GtkIMHtml *imhtml, const char *url) |
4130 { | 4185 { |
4131 GObject *object; | 4186 GObject *object; |
4134 static guint linkno = 0; | 4189 static guint linkno = 0; |
4135 gchar str[48]; | 4190 gchar str[48]; |
4136 GdkColor *color = NULL; | 4191 GdkColor *color = NULL; |
4137 | 4192 |
4138 imhtml->edit.link = NULL; | 4193 imhtml->edit.link = NULL; |
4139 | |
4140 | |
4141 | 4194 |
4142 if (url) { | 4195 if (url) { |
4143 g_snprintf(str, sizeof(str), "LINK %d", linkno++); | 4196 g_snprintf(str, sizeof(str), "LINK %d", linkno++); |
4144 str[47] = '\0'; | 4197 str[47] = '\0'; |
4145 | 4198 |