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