Mercurial > pidgin
annotate src/gtkimhtml.c @ 4274:906f61f27479
[gaim-migrate @ 4525]
(01:26:02) Robot101: guess which bugs I fixed
(01:26:14) Me: i can't
(01:26:26) Robot101: really common crash...
(01:26:35) Robot101: I fixed the return from away crash! =)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 10 Jan 2003 06:32:14 +0000 |
parents | f1876640e568 |
children | a723d060620a |
rev | line source |
---|---|
1428 | 1 /* |
2 * GtkIMHtml | |
3 * | |
4 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
23 #include <config.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
24 #endif |
1428 | 25 #include "gtkimhtml.h" |
26 #include <gtk/gtk.h> | |
4046 | 27 #include <gdk/gdkkeysyms.h> |
1428 | 28 #include <string.h> |
29 #include <ctype.h> | |
30 #include <stdio.h> | |
31 #include <math.h> | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
32 #ifdef HAVE_LANGINFO_CODESET |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
33 #include <langinfo.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
34 #include <locale.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
35 #endif |
1428 | 36 |
2349
60c716c32c40
[gaim-migrate @ 2362]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2348
diff
changeset
|
37 |
3922 | 38 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a |
39 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ | |
40 #define MAX_FONT_SIZE 7 | |
41 #define POINT_SIZE(x) (_point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) | |
3928 | 42 static gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; |
2349
60c716c32c40
[gaim-migrate @ 2362]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2348
diff
changeset
|
43 |
3922 | 44 /* The four elements present in a <FONT> tag contained in a struct */ |
45 typedef struct _FontDetail FontDetail; | |
1428 | 46 struct _FontDetail { |
47 gushort size; | |
48 gchar *face; | |
3922 | 49 gchar *fore; |
50 gchar *back; | |
4032 | 51 gchar *sml; |
1428 | 52 }; |
53 | |
4032 | 54 struct _GtkSmileyTree { |
55 GString *values; | |
56 GtkSmileyTree **children; | |
4263 | 57 GtkIMHtmlSmiley *image; |
4032 | 58 }; |
59 | |
60 static GtkSmileyTree* | |
61 gtk_smiley_tree_new () | |
62 { | |
63 return g_new0 (GtkSmileyTree, 1); | |
64 } | |
65 | |
66 static void | |
67 gtk_smiley_tree_insert (GtkSmileyTree *tree, | |
4263 | 68 GtkIMHtmlSmiley *smiley) |
4032 | 69 { |
70 GtkSmileyTree *t = tree; | |
4263 | 71 const gchar *x = smiley->smile; |
4032 | 72 |
73 if (!strlen (x)) | |
74 return; | |
75 | |
76 while (*x) { | |
77 gchar *pos; | |
78 gint index; | |
79 | |
80 if (!t->values) | |
81 t->values = g_string_new (""); | |
82 | |
83 pos = strchr (t->values->str, *x); | |
84 if (!pos) { | |
85 t->values = g_string_append_c (t->values, *x); | |
86 index = t->values->len - 1; | |
87 t->children = g_realloc (t->children, t->values->len * sizeof (GtkSmileyTree *)); | |
88 t->children [index] = g_new0 (GtkSmileyTree, 1); | |
89 } else | |
90 index = (int) pos - (int) t->values->str; | |
91 | |
92 t = t->children [index]; | |
93 | |
94 x++; | |
95 } | |
96 | |
4263 | 97 t->image = smiley; |
4032 | 98 } |
4041 | 99 |
4263 | 100 |
4264 | 101 void gtk_smiley_tree_destroy (GtkSmileyTree *tree) |
4032 | 102 { |
103 GSList *list = g_slist_append (NULL, tree); | |
104 | |
105 while (list) { | |
106 GtkSmileyTree *t = list->data; | |
107 gint i; | |
108 list = g_slist_remove(list, t); | |
109 if (t->values) { | |
110 for (i = 0; i < t->values->len; i++) | |
111 list = g_slist_append (list, t->children [i]); | |
112 g_string_free (t->values, TRUE); | |
113 g_free (t->children); | |
114 } | |
115 g_free (t); | |
116 } | |
117 } | |
118 | |
4263 | 119 |
4032 | 120 static GtkTextViewClass *parent_class = NULL; |
121 | |
122 | |
3922 | 123 /* GtkIMHtml has one signal--URL_CLICKED */ |
1428 | 124 enum { |
125 URL_CLICKED, | |
126 LAST_SIGNAL | |
127 }; | |
128 static guint signals [LAST_SIGNAL] = { 0 }; | |
129 | |
4264 | 130 static gboolean |
131 gtk_smiley_tree_destroy_from_hash(gpointer key, gpointer value, | |
132 gpointer user_data) | |
133 { | |
134 gtk_smiley_tree_destroy(value); | |
135 return TRUE; | |
136 } | |
137 | |
4032 | 138 static void |
139 gtk_imhtml_finalize (GObject *object) | |
140 { | |
141 GtkIMHtml *imhtml = GTK_IMHTML(object); | |
4264 | 142 g_hash_table_foreach_remove(imhtml->smiley_data, gtk_smiley_tree_destroy_from_hash, NULL); |
4138 | 143 g_hash_table_destroy(imhtml->smiley_data); |
4032 | 144 gtk_smiley_tree_destroy(imhtml->default_smilies); |
4138 | 145 gdk_cursor_unref(imhtml->hand_cursor); |
146 gdk_cursor_unref(imhtml->arrow_cursor); | |
4032 | 147 G_OBJECT_CLASS(parent_class)->finalize (object); |
148 } | |
1428 | 149 |
3922 | 150 /* Boring GTK stuff */ |
151 static void gtk_imhtml_class_init (GtkIMHtmlClass *class) | |
1428 | 152 { |
3922 | 153 GtkObjectClass *object_class; |
4032 | 154 GObjectClass *gobject_class; |
3922 | 155 object_class = (GtkObjectClass*) class; |
4032 | 156 gobject_class = (GObjectClass*) class; |
157 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW); | |
3922 | 158 signals[URL_CLICKED] = gtk_signal_new("url_clicked", |
159 GTK_RUN_FIRST, | |
160 GTK_CLASS_TYPE(object_class), | |
161 GTK_SIGNAL_OFFSET(GtkIMHtmlClass, url_clicked), | |
162 gtk_marshal_NONE__POINTER, | |
163 GTK_TYPE_NONE, 1, | |
164 GTK_TYPE_POINTER); | |
4032 | 165 gobject_class->finalize = gtk_imhtml_finalize; |
1428 | 166 } |
167 | |
3922 | 168 static void gtk_imhtml_init (GtkIMHtml *imhtml) |
1428 | 169 { |
3922 | 170 GtkTextIter iter; |
171 imhtml->text_buffer = gtk_text_buffer_new(NULL); | |
172 gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter); | |
173 imhtml->end = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, FALSE); | |
174 gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer); | |
175 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD); | |
176 gtk_text_view_set_editable(GTK_TEXT_VIEW(imhtml), FALSE); | |
177 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(imhtml), 5); | |
178 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), FALSE); | |
179 /*gtk_text_view_set_justification(GTK_TEXT_VIEW(imhtml), GTK_JUSTIFY_FILL);*/ | |
3465 | 180 |
3922 | 181 /* These tags will be used often and can be reused--we create them on init and then apply them by name |
182 * other tags (color, size, face, etc.) will have to be created and applied dynamically */ | |
183 gtk_text_buffer_create_tag(imhtml->text_buffer, "BOLD", "weight", PANGO_WEIGHT_BOLD, NULL); | |
184 gtk_text_buffer_create_tag(imhtml->text_buffer, "ITALICS", "style", PANGO_STYLE_ITALIC, NULL); | |
185 gtk_text_buffer_create_tag(imhtml->text_buffer, "UNDERLINE", "underline", PANGO_UNDERLINE_SINGLE, NULL); | |
186 gtk_text_buffer_create_tag(imhtml->text_buffer, "STRIKE", "strikethrough", TRUE, NULL); | |
187 gtk_text_buffer_create_tag(imhtml->text_buffer, "SUB", "rise", -5000, NULL); | |
188 gtk_text_buffer_create_tag(imhtml->text_buffer, "SUP", "rise", 5000, NULL); | |
189 gtk_text_buffer_create_tag(imhtml->text_buffer, "PRE", "family", "Monospace", NULL); | |
3465 | 190 |
3922 | 191 /* When hovering over a link, we show the hand cursor--elsewhere we show the plain ol' pointer cursor */ |
192 imhtml->hand_cursor = gdk_cursor_new (GDK_HAND2); | |
193 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); | |
2993 | 194 |
4253 | 195 imhtml->show_smileys = TRUE; |
196 imhtml->show_comments = TRUE; | |
197 | |
4032 | 198 imhtml->smiley_data = g_hash_table_new (g_str_hash, g_str_equal); |
199 imhtml->default_smilies = gtk_smiley_tree_new(); | |
2993 | 200 } |
201 | |
3922 | 202 GtkWidget *gtk_imhtml_new(void *a, void *b) |
1428 | 203 { |
3922 | 204 return GTK_WIDGET(gtk_type_new(gtk_imhtml_get_type())); |
1428 | 205 } |
206 | |
3922 | 207 GtkType gtk_imhtml_get_type() |
1428 | 208 { |
3922 | 209 static guint imhtml_type = 0; |
1428 | 210 |
211 if (!imhtml_type) { | |
3922 | 212 GtkTypeInfo imhtml_info = { |
1428 | 213 "GtkIMHtml", |
214 sizeof (GtkIMHtml), | |
215 sizeof (GtkIMHtmlClass), | |
216 (GtkClassInitFunc) gtk_imhtml_class_init, | |
217 (GtkObjectInitFunc) gtk_imhtml_init, | |
218 NULL, | |
219 NULL | |
220 }; | |
3922 | 221 |
222 imhtml_type = gtk_type_unique (gtk_text_view_get_type (), &imhtml_info); | |
1428 | 223 } |
224 | |
225 return imhtml_type; | |
226 } | |
227 | |
3922 | 228 /* The call back for an event on a link tag. */ |
229 void tag_event(GtkTextTag *tag, GObject *arg1, GdkEvent *event, GtkTextIter *arg2, char *url) { | |
230 if (event->type == GDK_BUTTON_RELEASE) { | |
231 /* A link was clicked--we emit the "url_clicked" signal with the URL as the argument */ | |
232 // if ((GdkEventButton)(event)->button == 1) | |
4141
ccec4fde84f4
[gaim-migrate @ 4359]
Christian Hammond <chipx86@chipx86.com>
parents:
4140
diff
changeset
|
233 gtk_signal_emit (GTK_OBJECT(arg1), signals[URL_CLICKED], url); |
3922 | 234 } else if (event->type == GDK_ENTER_NOTIFY) { |
235 /* make a hand cursor and a tooltip timeout -- if GTK worked as it should */ | |
236 } else if (event->type == GDK_LEAVE_NOTIFY) { | |
237 /* clear timeout and make an arrow cursor again --if GTK worked as it should */ | |
1428 | 238 } |
239 } | |
240 | |
4032 | 241 static void |
4263 | 242 gtk_smiley_tree_remove (GtkSmileyTree *tree, |
243 GtkIMHtmlSmiley *smiley) | |
4032 | 244 { |
245 GtkSmileyTree *t = tree; | |
4263 | 246 const gchar *x = smiley->smile; |
4032 | 247 gint len = 0; |
248 | |
249 while (*x) { | |
250 gchar *pos; | |
251 | |
252 if (!t->values) | |
253 return; | |
254 | |
255 pos = strchr (t->values->str, *x); | |
256 if (pos) | |
257 t = t->children [(int) pos - (int) t->values->str]; | |
258 else | |
259 return; | |
260 | |
261 x++; len++; | |
262 } | |
263 | |
4141
ccec4fde84f4
[gaim-migrate @ 4359]
Christian Hammond <chipx86@chipx86.com>
parents:
4140
diff
changeset
|
264 if (t->image) { |
4032 | 265 t->image = NULL; |
4141
ccec4fde84f4
[gaim-migrate @ 4359]
Christian Hammond <chipx86@chipx86.com>
parents:
4140
diff
changeset
|
266 } |
4032 | 267 } |
268 | |
269 static gint | |
270 gtk_smiley_tree_lookup (GtkSmileyTree *tree, | |
271 const gchar *text) | |
272 { | |
273 GtkSmileyTree *t = tree; | |
274 const gchar *x = text; | |
275 gint len = 0; | |
276 | |
277 while (*x) { | |
278 gchar *pos; | |
279 | |
280 if (!t->values) | |
281 break; | |
282 | |
283 pos = strchr (t->values->str, *x); | |
284 if (pos) | |
285 t = t->children [(int) pos - (int) t->values->str]; | |
286 else | |
287 break; | |
288 | |
289 x++; len++; | |
290 } | |
291 | |
292 if (t->image) | |
293 return len; | |
294 | |
295 return 0; | |
296 } | |
297 | |
298 void | |
4263 | 299 gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, |
300 gchar *sml, | |
301 GtkIMHtmlSmiley *smiley) | |
4032 | 302 { |
303 GtkSmileyTree *tree; | |
304 g_return_if_fail (imhtml != NULL); | |
305 g_return_if_fail (GTK_IS_IMHTML (imhtml)); | |
4263 | 306 |
4032 | 307 if (sml == NULL) |
308 tree = imhtml->default_smilies; | |
309 else if ((tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { | |
310 } else { | |
311 tree = gtk_smiley_tree_new(); | |
312 g_hash_table_insert(imhtml->smiley_data, sml, tree); | |
313 } | |
314 | |
4263 | 315 gtk_smiley_tree_insert (tree, smiley); |
4032 | 316 } |
317 | |
318 static gboolean | |
319 gtk_imhtml_is_smiley (GtkIMHtml *imhtml, | |
320 GSList *fonts, | |
321 const gchar *text, | |
322 gint *len) | |
323 { | |
324 GtkSmileyTree *tree; | |
325 FontDetail *font; | |
326 char *sml = NULL; | |
327 | |
328 if (fonts) { | |
329 font = fonts->data; | |
330 sml = font->sml; | |
331 } | |
332 | |
333 if (sml == NULL) | |
334 tree = imhtml->default_smilies; | |
335 else { | |
336 tree = g_hash_table_lookup(imhtml->smiley_data, sml); | |
337 } | |
338 if (tree == NULL) | |
339 return FALSE; | |
340 | |
341 *len = gtk_smiley_tree_lookup (tree, text); | |
342 return (*len > 0); | |
343 } | |
344 | |
4263 | 345 GdkPixbuf* |
4032 | 346 gtk_smiley_tree_image (GtkIMHtml *imhtml, |
347 const gchar *sml, | |
348 const gchar *text) | |
349 { | |
350 GtkSmileyTree *t; | |
351 const gchar *x = text; | |
352 if (sml == NULL) | |
353 t = imhtml->default_smilies; | |
354 else | |
355 t = g_hash_table_lookup(imhtml->smiley_data, sml); | |
356 | |
357 | |
358 if (t == NULL) | |
359 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
360 | |
361 while (*x) { | |
362 gchar *pos; | |
363 | |
364 if (!t->values) { | |
365 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
366 } | |
367 | |
368 pos = strchr (t->values->str, *x); | |
369 if (pos) { | |
370 t = t->children [(int) pos - (int) t->values->str]; | |
371 } else { | |
372 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
373 } | |
374 x++; | |
375 } | |
376 | |
4263 | 377 if (!t->image->icon) |
378 t->image->icon = gdk_pixbuf_new_from_file(t->image->file, NULL); | |
379 | |
380 return t->image->icon; | |
4032 | 381 } |
3922 | 382 #define VALID_TAG(x) if (!g_strncasecmp (string, x ">", strlen (x ">"))) { \ |
383 *tag = g_strndup (string, strlen (x)); \ | |
384 *len = strlen (x) + 1; \ | |
385 return TRUE; \ | |
386 } \ | |
387 (*type)++ | |
1428 | 388 |
3922 | 389 #define VALID_OPT_TAG(x) if (!g_strncasecmp (string, x " ", strlen (x " "))) { \ |
390 const gchar *c = string + strlen (x " "); \ | |
391 gchar e = '"'; \ | |
392 gboolean quote = FALSE; \ | |
393 while (*c) { \ | |
394 if (*c == '"' || *c == '\'') { \ | |
395 if (quote && (*c == e)) \ | |
396 quote = !quote; \ | |
397 else if (!quote) { \ | |
398 quote = !quote; \ | |
399 e = *c; \ | |
400 } \ | |
401 } else if (!quote && (*c == '>')) \ | |
402 break; \ | |
403 c++; \ | |
404 } \ | |
405 if (*c) { \ | |
406 *tag = g_strndup (string, c - string); \ | |
407 *len = c - string + 1; \ | |
408 return TRUE; \ | |
409 } \ | |
410 } \ | |
411 (*type)++ | |
1428 | 412 |
413 | |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
414 static gboolean |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
415 gtk_imhtml_is_amp_escape (const gchar *string, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
416 gchar *replace, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
417 gint *length) |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
418 { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
419 g_return_val_if_fail (string != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
420 g_return_val_if_fail (replace != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
421 g_return_val_if_fail (length != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
422 |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
423 if (!g_strncasecmp (string, "&", 5)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
424 *replace = '&'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
425 *length = 5; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
426 } else if (!g_strncasecmp (string, "<", 4)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
427 *replace = '<'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
428 *length = 4; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
429 } else if (!g_strncasecmp (string, ">", 4)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
430 *replace = '>'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
431 *length = 4; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
432 } else if (!g_strncasecmp (string, " ", 6)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
433 *replace = ' '; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
434 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
435 } else if (!g_strncasecmp (string, "©", 6)) { |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
436 *replace = '©'; /* was: '©' */ |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
437 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
438 } else if (!g_strncasecmp (string, """, 6)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
439 *replace = '\"'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
440 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
441 } else if (!g_strncasecmp (string, "®", 5)) { |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
442 *replace = '®'; /* was: '®' */ |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
443 *length = 5; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
444 } else if (*(string + 1) == '#') { |
2022
199ba82faacb
[gaim-migrate @ 2032]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2002
diff
changeset
|
445 guint pound = 0; |
3004 | 446 if ((sscanf (string, "&#%u;", £) == 1) && pound != 0) { |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
447 if (*(string + 3 + (gint)log10 (pound)) != ';') |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
448 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
449 *replace = (gchar)pound; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
450 *length = 2; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
451 while (isdigit ((gint) string [*length])) (*length)++; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
452 if (string [*length] == ';') (*length)++; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
453 } else { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
454 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
455 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
456 } else { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
457 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
458 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
459 |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
460 return TRUE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
461 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
462 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
463 static gboolean |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
464 gtk_imhtml_is_tag (const gchar *string, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
465 gchar **tag, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
466 gint *len, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
467 gint *type) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
468 { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
469 *type = 1; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
470 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
471 if (!strchr (string, '>')) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
472 return FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
473 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
474 VALID_TAG ("B"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
475 VALID_TAG ("BOLD"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
476 VALID_TAG ("/B"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
477 VALID_TAG ("/BOLD"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
478 VALID_TAG ("I"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
479 VALID_TAG ("ITALIC"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
480 VALID_TAG ("/I"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
481 VALID_TAG ("/ITALIC"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
482 VALID_TAG ("U"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
483 VALID_TAG ("UNDERLINE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
484 VALID_TAG ("/U"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
485 VALID_TAG ("/UNDERLINE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
486 VALID_TAG ("S"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
487 VALID_TAG ("STRIKE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
488 VALID_TAG ("/S"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
489 VALID_TAG ("/STRIKE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
490 VALID_TAG ("SUB"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
491 VALID_TAG ("/SUB"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
492 VALID_TAG ("SUP"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
493 VALID_TAG ("/SUP"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
494 VALID_TAG ("PRE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
495 VALID_TAG ("/PRE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
496 VALID_TAG ("TITLE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
497 VALID_TAG ("/TITLE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
498 VALID_TAG ("BR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
499 VALID_TAG ("HR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
500 VALID_TAG ("/FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
501 VALID_TAG ("/A"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
502 VALID_TAG ("P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
503 VALID_TAG ("/P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
504 VALID_TAG ("H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
505 VALID_TAG ("/H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
506 VALID_TAG ("HTML"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
507 VALID_TAG ("/HTML"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
508 VALID_TAG ("BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
509 VALID_TAG ("/BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
510 VALID_TAG ("FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
511 VALID_TAG ("HEAD"); |
2993 | 512 VALID_TAG ("/HEAD"); |
513 VALID_TAG ("BINARY"); | |
514 VALID_TAG ("/BINARY"); | |
515 | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
516 VALID_OPT_TAG ("HR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
517 VALID_OPT_TAG ("FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
518 VALID_OPT_TAG ("BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
519 VALID_OPT_TAG ("A"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
520 VALID_OPT_TAG ("IMG"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
521 VALID_OPT_TAG ("P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
522 VALID_OPT_TAG ("H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
523 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
524 if (!g_strncasecmp(string, "!--", strlen ("!--"))) { |
2954
f6c4f2187c08
[gaim-migrate @ 2967]
Christian Hammond <chipx86@chipx86.com>
parents:
2898
diff
changeset
|
525 gchar *e = strstr (string + strlen("!--"), "-->"); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
526 if (e) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
527 *len = e - string + strlen ("-->"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
528 *tag = g_strndup (string + strlen ("!--"), *len - strlen ("!---->")); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
529 return TRUE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
530 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
531 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
532 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
533 return FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
534 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
535 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
536 static gchar* |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
537 gtk_imhtml_get_html_opt (gchar *tag, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
538 const gchar *opt) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
539 { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
540 gchar *t = tag; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
541 gchar *e, *a; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
542 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
543 while (g_strncasecmp (t, opt, strlen (opt))) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
544 gboolean quote = FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
545 if (*t == '\0') break; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
546 while (*t && !((*t == ' ') && !quote)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
547 if (*t == '\"') |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
548 quote = ! quote; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
549 t++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
550 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
551 while (*t && (*t == ' ')) t++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
552 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
553 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
554 if (!g_strncasecmp (t, opt, strlen (opt))) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
555 t += strlen (opt); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
556 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
557 return NULL; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
558 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
559 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
560 if ((*t == '\"') || (*t == '\'')) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
561 e = a = ++t; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
562 while (*e && (*e != *(t - 1))) e++; |
2993 | 563 if (*e == '\0') { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
564 return NULL; |
2993 | 565 } else |
566 return g_strndup (a, e - a); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
567 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
568 e = a = t; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
569 while (*e && !isspace ((gint) *e)) e++; |
2993 | 570 return g_strndup (a, e - a); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
571 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
572 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
573 |
3922 | 574 |
575 | |
576 #define NEW_TEXT_BIT 0 | |
577 #define NEW_HR_BIT 1 | |
578 #define NEW_BIT(x) ws [wpos] = '\0'; \ | |
579 mark2 = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, TRUE); \ | |
580 gtk_text_buffer_insert(imhtml->text_buffer, &iter, ws, -1); \ | |
581 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \ | |
582 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &siter, mark2); \ | |
583 gtk_text_buffer_delete_mark(imhtml->text_buffer, mark2); \ | |
584 if (bold) \ | |
585 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "BOLD", &siter, &iter); \ | |
586 if (italics) \ | |
587 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "ITALICS", &siter, &iter); \ | |
588 if (underline) \ | |
589 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "UNDERLINE", &siter, &iter); \ | |
590 if (strike) \ | |
591 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "STRIKE", &siter, &iter); \ | |
592 if (sub) \ | |
593 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "SUB", &siter, &iter); \ | |
594 if (sup) \ | |
595 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "SUP", &siter, &iter); \ | |
596 if (pre) \ | |
597 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "PRE", &siter, &iter); \ | |
598 if (bg) { \ | |
599 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "background", bg, NULL); \ | |
600 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
601 } \ | |
602 if (fonts) { \ | |
603 FontDetail *fd = fonts->data; \ | |
604 if (fd->fore) { \ | |
605 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "foreground", fd->fore, NULL); \ | |
606 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
607 } \ | |
608 if (fd->back) { \ | |
609 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "background", fd->back, NULL); \ | |
610 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
611 } \ | |
612 if (fd->face) { \ | |
613 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "font", fd->face, NULL); \ | |
614 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
615 } \ | |
616 if (fd->size) { \ | |
617 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "size-points", (double)POINT_SIZE(fd->size), NULL); \ | |
618 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
619 } \ | |
620 } \ | |
621 if (url) { \ | |
622 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); \ | |
623 g_signal_connect(G_OBJECT(texttag), "event", G_CALLBACK(tag_event), strdup(url)); \ | |
624 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
625 } \ | |
626 wpos = 0; \ | |
627 ws[0] = 0; \ | |
628 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \ | |
629 | |
630 | |
631 /* if (x == NEW_HR_BIT) { \ | |
632 sep = gtk_hseparator_new(); \ | |
633 gtk_widget_size_request(GTK_WIDGET(imhtml), &req); \ | |
634 gtk_widget_set_size_request(sep, 20, -1); \ | |
635 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, &iter); \ | |
636 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), sep, anchor); \ | |
637 gtk_widget_show(sep); \ | |
638 } */ | |
639 | |
640 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml, | |
641 const gchar *text, | |
642 gint len, | |
643 GtkIMHtmlOptions options) | |
1428 | 644 { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
645 gint pos = 0; |
3922 | 646 GString *str = NULL; |
647 GtkTextIter iter, siter; | |
648 GtkTextMark *mark, *mark2; | |
649 GtkTextTag *texttag; | |
650 gchar *ws; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
651 gchar *tag; |
3922 | 652 gchar *url = NULL; |
653 gchar *bg = NULL; | |
4032 | 654 gint tlen, smilelen, wpos=0; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
655 gint type; |
3922 | 656 const gchar *c; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
657 gchar amp; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
658 |
1428 | 659 guint bold = 0, |
660 italics = 0, | |
661 underline = 0, | |
662 strike = 0, | |
663 sub = 0, | |
664 sup = 0, | |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
665 title = 0, |
3922 | 666 pre = 0; |
1428 | 667 |
3922 | 668 GSList *fonts = NULL; |
1428 | 669 |
670 g_return_val_if_fail (imhtml != NULL, NULL); | |
671 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), NULL); | |
672 g_return_val_if_fail (text != NULL, NULL); | |
3922 | 673 g_return_val_if_fail (len != 0, NULL); |
674 | |
675 c = text; | |
676 if (len == -1) | |
677 len = strlen(text); | |
678 ws = g_malloc(len + 1); | |
679 ws[0] = 0; | |
1428 | 680 |
681 if (options & GTK_IMHTML_RETURN_LOG) | |
3922 | 682 str = g_string_new(""); |
1428 | 683 |
3922 | 684 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); |
685 mark = gtk_text_buffer_create_mark (imhtml->text_buffer, NULL, &iter, /* right grav */ FALSE); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
686 while (pos < len) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
687 if (*c == '<' && gtk_imhtml_is_tag (c + 1, &tag, &tlen, &type)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
688 c++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
689 pos++; |
3922 | 690 switch (type) |
691 { | |
692 case 1: /* B */ | |
693 case 2: /* BOLD */ | |
694 NEW_BIT (NEW_TEXT_BIT); | |
695 bold++; | |
696 break; | |
697 case 3: /* /B */ | |
698 case 4: /* /BOLD */ | |
699 NEW_BIT (NEW_TEXT_BIT); | |
700 if (bold) | |
701 bold--; | |
702 break; | |
703 case 5: /* I */ | |
704 case 6: /* ITALIC */ | |
705 NEW_BIT (NEW_TEXT_BIT); | |
706 italics++; | |
707 break; | |
708 case 7: /* /I */ | |
709 case 8: /* /ITALIC */ | |
710 NEW_BIT (NEW_TEXT_BIT); | |
711 if (italics) | |
712 italics--; | |
713 break; | |
714 case 9: /* U */ | |
715 case 10: /* UNDERLINE */ | |
716 NEW_BIT (NEW_TEXT_BIT); | |
717 underline++; | |
718 break; | |
719 case 11: /* /U */ | |
720 case 12: /* /UNDERLINE */ | |
721 NEW_BIT (NEW_TEXT_BIT); | |
722 if (underline) | |
723 underline--; | |
724 break; | |
725 case 13: /* S */ | |
726 case 14: /* STRIKE */ | |
727 NEW_BIT (NEW_TEXT_BIT); | |
728 strike++; | |
729 break; | |
730 case 15: /* /S */ | |
731 case 16: /* /STRIKE */ | |
732 NEW_BIT (NEW_TEXT_BIT); | |
733 if (strike) | |
734 strike--; | |
735 break; | |
736 case 17: /* SUB */ | |
737 NEW_BIT (NEW_TEXT_BIT); | |
738 sub++; | |
739 break; | |
740 case 18: /* /SUB */ | |
741 NEW_BIT (NEW_TEXT_BIT); | |
742 if (sub) | |
743 sub--; | |
744 break; | |
745 case 19: /* SUP */ | |
746 NEW_BIT (NEW_TEXT_BIT); | |
747 sup++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
748 break; |
3922 | 749 case 20: /* /SUP */ |
750 NEW_BIT (NEW_TEXT_BIT); | |
751 if (sup) | |
752 sup--; | |
753 break; | |
754 case 21: /* PRE */ | |
755 NEW_BIT (NEW_TEXT_BIT); | |
756 pre++; | |
757 break; | |
758 case 22: /* /PRE */ | |
759 NEW_BIT (NEW_TEXT_BIT); | |
760 if (pre) | |
761 pre--; | |
762 break; | |
763 case 23: /* TITLE */ | |
764 NEW_BIT (NEW_TEXT_BIT); | |
765 title++; | |
766 break; | |
767 case 24: /* /TITLE */ | |
768 if (title) { | |
769 if (options & GTK_IMHTML_NO_TITLE) { | |
770 wpos = 0; | |
771 ws [wpos] = '\0'; | |
772 } | |
773 title--; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
774 } |
3922 | 775 break; |
776 case 25: /* BR */ | |
777 ws[wpos] = '\n'; | |
778 wpos++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
779 NEW_BIT (NEW_TEXT_BIT); |
3922 | 780 break; |
781 case 26: /* HR */ | |
782 case 42: /* HR (opt) */ | |
783 ws[wpos++] = '\n'; | |
784 NEW_BIT(NEW_HR_BIT); | |
785 break; | |
786 case 27: /* /FONT */ | |
787 if (fonts) { | |
788 FontDetail *font = fonts->data; | |
789 NEW_BIT (NEW_TEXT_BIT); | |
790 fonts = g_slist_remove (fonts, font); | |
791 if (font->face) | |
792 g_free (font->face); | |
793 if (font->fore) | |
794 g_free (font->fore); | |
795 if (font->back) | |
796 g_free (font->back); | |
4032 | 797 if (font->sml) |
798 g_free (font->sml); | |
3922 | 799 g_free (font); |
800 } | |
801 break; | |
802 case 28: /* /A */ | |
803 if (url) { | |
804 NEW_BIT(NEW_TEXT_BIT); | |
805 g_free(url); | |
806 url = NULL; | |
2993 | 807 break; |
808 } | |
3922 | 809 case 29: /* P */ |
810 case 30: /* /P */ | |
811 case 31: /* H3 */ | |
812 case 32: /* /H3 */ | |
813 case 33: /* HTML */ | |
814 case 34: /* /HTML */ | |
815 case 35: /* BODY */ | |
816 case 36: /* /BODY */ | |
817 case 37: /* FONT */ | |
818 case 38: /* HEAD */ | |
819 case 39: /* /HEAD */ | |
820 break; | |
821 case 40: /* BINARY */ | |
822 case 41: /* /BINARY */ | |
823 break; | |
824 case 43: /* FONT (opt) */ | |
825 { | |
4032 | 826 gchar *color, *back, *face, *size, *sml; |
3922 | 827 FontDetail *font, *oldfont = NULL; |
828 color = gtk_imhtml_get_html_opt (tag, "COLOR="); | |
829 back = gtk_imhtml_get_html_opt (tag, "BACK="); | |
830 face = gtk_imhtml_get_html_opt (tag, "FACE="); | |
831 size = gtk_imhtml_get_html_opt (tag, "SIZE="); | |
4032 | 832 sml = gtk_imhtml_get_html_opt (tag, "SML="); |
833 if (!(color || back || face || size || sml)) | |
3922 | 834 break; |
835 | |
836 NEW_BIT (NEW_TEXT_BIT); | |
837 | |
838 font = g_new0 (FontDetail, 1); | |
839 if (fonts) | |
840 oldfont = fonts->data; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
841 |
3922 | 842 if (color && !(options & GTK_IMHTML_NO_COLOURS)) |
843 font->fore = color; | |
844 else if (oldfont && oldfont->fore) | |
845 font->fore = g_strdup(oldfont->fore); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
846 |
3922 | 847 if (back && !(options & GTK_IMHTML_NO_COLOURS)) |
848 font->back = back; | |
849 else if (oldfont && oldfont->back) | |
850 font->back = g_strdup(oldfont->back); | |
851 | |
852 if (face && !(options & GTK_IMHTML_NO_FONTS)) | |
853 font->face = face; | |
854 else if (oldfont && oldfont->face) | |
855 font->face = g_strdup(oldfont->face); | |
4032 | 856 |
857 if (sml) | |
858 font->sml = sml; | |
859 else if (oldfont && oldfont->sml) | |
860 font->sml = g_strdup(oldfont->sml); | |
861 | |
3922 | 862 if (size && !(options & GTK_IMHTML_NO_SIZES)) { |
863 if (*size == '+') { | |
864 sscanf (size + 1, "%hd", &font->size); | |
865 font->size += 3; | |
866 } else if (*size == '-') { | |
867 sscanf (size + 1, "%hd", &font->size); | |
868 font->size = MAX (0, 3 - font->size); | |
869 } else if (isdigit (*size)) { | |
870 sscanf (size, "%hd", &font->size); | |
871 } | |
872 } else if (oldfont) | |
873 font->size = oldfont->size; | |
874 g_free(size); | |
875 fonts = g_slist_prepend (fonts, font); | |
876 } | |
877 break; | |
878 case 44: /* BODY (opt) */ | |
879 if (!(options & GTK_IMHTML_NO_COLOURS)) { | |
880 char *bgcolor = gtk_imhtml_get_html_opt (tag, "BGCOLOR="); | |
881 if (bgcolor) { | |
882 NEW_BIT(NEW_TEXT_BIT); | |
883 if (bg) | |
884 g_free(bg); | |
885 bg = bgcolor; | |
2885
f72efa29c109
[gaim-migrate @ 2898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2871
diff
changeset
|
886 } |
1428 | 887 } |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
888 break; |
3922 | 889 case 45: /* A (opt) */ |
890 { | |
891 gchar *href = gtk_imhtml_get_html_opt (tag, "HREF="); | |
892 if (href) { | |
893 NEW_BIT (NEW_TEXT_BIT); | |
894 if (url) | |
895 g_free (url); | |
896 url = href; | |
897 } | |
2993 | 898 } |
3922 | 899 break; |
900 case 47: /* P (opt) */ | |
901 case 48: /* H3 (opt) */ | |
2993 | 902 break; |
3922 | 903 case 49: /* comment */ |
904 NEW_BIT (NEW_TEXT_BIT); | |
4253 | 905 if (imhtml->show_comments) |
906 wpos = g_snprintf (ws, len, "%s", tag); | |
3922 | 907 NEW_BIT (NEW_COMMENT_BIT); |
908 break; | |
909 default: | |
910 break; | |
2993 | 911 } |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
912 c += tlen; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
913 pos += tlen; |
4138 | 914 if(tag) |
915 g_free(tag); /* This was allocated back in VALID_TAG() */ | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
916 } else if (*c == '&' && gtk_imhtml_is_amp_escape (c, &, &tlen)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
917 ws [wpos++] = amp; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
918 c += tlen; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
919 pos += tlen; |
1428 | 920 } else if (*c == '\n') { |
921 if (!(options & GTK_IMHTML_NO_NEWLINE)) { | |
3922 | 922 ws[wpos] = '\n'; |
923 wpos++; | |
1428 | 924 NEW_BIT (NEW_TEXT_BIT); |
925 } | |
926 c++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
927 pos++; |
4253 | 928 } else if (imhtml->show_smileys && (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen))) { |
4032 | 929 FontDetail *fd; |
930 gchar *sml = NULL; | |
931 if (fonts) { | |
932 fd = fonts->data; | |
933 sml = fd->sml; | |
934 } | |
935 NEW_BIT (NEW_TEXT_BIT); | |
936 wpos = g_snprintf (ws, smilelen + 1, "%s", c); | |
4263 | 937 gtk_text_buffer_insert_pixbuf(imhtml->text_buffer, &iter, gtk_smiley_tree_image (imhtml, sml, ws)); |
4032 | 938 c += smilelen; |
939 pos += smilelen; | |
940 wpos = 0; | |
941 ws[0] = 0; | |
942 } else if (*c) { | |
1428 | 943 ws [wpos++] = *c++; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
944 pos++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
945 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
946 break; |
1428 | 947 } |
948 } | |
3922 | 949 |
950 NEW_BIT(NEW_TEXT_BIT); | |
1428 | 951 if (url) { |
952 g_free (url); | |
3922 | 953 if (str) |
954 str = g_string_append (str, "</A>"); | |
1428 | 955 } |
3922 | 956 |
4032 | 957 while (fonts) { |
958 FontDetail *font = fonts->data; | |
959 fonts = g_slist_remove (fonts, font); | |
960 if (font->face) | |
961 g_free (font->face); | |
962 if (font->fore) | |
963 g_free (font->fore); | |
964 if (font->back) | |
965 g_free (font->back); | |
966 if (font->sml) | |
967 g_free (font->sml); | |
968 g_free (font); | |
969 if (str) | |
970 str = g_string_append (str, "</FONT>"); | |
971 } | |
972 | |
3922 | 973 if (str) { |
1428 | 974 while (bold) { |
3922 | 975 str = g_string_append (str, "</B>"); |
1428 | 976 bold--; |
977 } | |
978 while (italics) { | |
3922 | 979 str = g_string_append (str, "</I>"); |
1428 | 980 italics--; |
981 } | |
982 while (underline) { | |
3922 | 983 str = g_string_append (str, "</U>"); |
1428 | 984 underline--; |
985 } | |
986 while (strike) { | |
3922 | 987 str = g_string_append (str, "</S>"); |
1428 | 988 strike--; |
989 } | |
990 while (sub) { | |
3922 | 991 str = g_string_append (str, "</SUB>"); |
1428 | 992 sub--; |
993 } | |
994 while (sup) { | |
3922 | 995 str = g_string_append (str, "</SUP>"); |
1428 | 996 sup--; |
997 } | |
998 while (title) { | |
3922 | 999 str = g_string_append (str, "</TITLE>"); |
1428 | 1000 title--; |
1001 } | |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
1002 while (pre) { |
3922 | 1003 str = g_string_append (str, "</PRE>"); |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
1004 pre--; |
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
1005 } |
1428 | 1006 } |
4032 | 1007 g_free (ws); |
1008 if (!(options & GTK_IMHTML_NO_SCROLL)) | |
1009 gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (imhtml), mark, | |
1010 0, TRUE, 0.0, 1.0); | |
3922 | 1011 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark); |
1012 return str; | |
1013 } | |
1014 | |
1015 void gtk_imhtml_set_img_handler (GtkIMHtml *imhtml, | |
1016 GtkIMHtmlImage handler){} | |
1017 | |
1018 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml){} | |
1019 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, | |
4253 | 1020 gboolean show) |
1021 { | |
1022 imhtml->show_smileys = show; | |
1023 } | |
3922 | 1024 |
1025 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, | |
4253 | 1026 gboolean show) |
1027 { | |
1028 imhtml->show_comments = show; | |
1029 } | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1030 |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1031 void |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1032 gtk_imhtml_clear (GtkIMHtml *imhtml) |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1033 { |
3922 | 1034 GtkTextIter start, end; |
2993 | 1035 |
3922 | 1036 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start); |
1037 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end); | |
1038 gtk_text_buffer_delete(imhtml->text_buffer, &start, &end); | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1039 } |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2349
diff
changeset
|
1040 |
4046 | 1041 void gtk_imhtml_page_up (GtkIMHtml *imhtml) |
1042 { | |
1043 | |
1044 } | |
3922 | 1045 void gtk_imhtml_page_down (GtkIMHtml *imhtml){} |