Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 9029:697e169dac12
[gaim-migrate @ 9805]
This should fix bug #953066 and #958331, where we would show the wrong
smileys in the text entry when they were inserted without the usual
<font sml="> tags (e.g. pasted, ctrl-up).
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sun, 23 May 2004 08:06:38 +0000 |
parents | 6fd7de357672 |
children | bbb8733c7818 |
comparison
equal
deleted
inserted
replaced
9028:6fd7de357672 | 9029:697e169dac12 |
---|---|
939 g_free(imhtml->clipboard_html_string); | 939 g_free(imhtml->clipboard_html_string); |
940 } | 940 } |
941 | 941 |
942 g_list_free(imhtml->scalables); | 942 g_list_free(imhtml->scalables); |
943 g_slist_free(imhtml->im_images); | 943 g_slist_free(imhtml->im_images); |
944 if (imhtml->protocol_name) | |
945 g_free(imhtml->protocol_name); | |
944 G_OBJECT_CLASS(parent_class)->finalize (object); | 946 G_OBJECT_CLASS(parent_class)->finalize (object); |
945 } | 947 } |
946 | 948 |
947 /* Boring GTK stuff */ | 949 /* Boring GTK stuff */ |
948 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) | 950 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) |
1381 if (fonts) { | 1383 if (fonts) { |
1382 font = fonts->data; | 1384 font = fonts->data; |
1383 sml = font->sml; | 1385 sml = font->sml; |
1384 } | 1386 } |
1385 | 1387 |
1386 if (sml == NULL) | 1388 if (!sml) |
1389 sml = imhtml->protocol_name; | |
1390 | |
1391 if (!sml || !(tree = g_hash_table_lookup(imhtml->smiley_data, sml))) | |
1387 tree = imhtml->default_smilies; | 1392 tree = imhtml->default_smilies; |
1388 else { | 1393 |
1389 tree = g_hash_table_lookup(imhtml->smiley_data, sml); | |
1390 } | |
1391 if (tree == NULL) | 1394 if (tree == NULL) |
1392 return FALSE; | 1395 return FALSE; |
1393 | 1396 |
1394 *len = gtk_smiley_tree_lookup (tree, text); | 1397 *len = gtk_smiley_tree_lookup (tree, text); |
1395 return (*len > 0); | 1398 return (*len > 0); |
2377 } | 2380 } |
2378 c += tlen; | 2381 c += tlen; |
2379 pos += tlen; | 2382 pos += tlen; |
2380 if(tag) | 2383 if(tag) |
2381 g_free(tag); /* This was allocated back in VALID_TAG() */ | 2384 g_free(tag); /* This was allocated back in VALID_TAG() */ |
2382 } else if (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen)) { | 2385 } else if (gtk_imhtml_is_smiley(imhtml, fonts, c, &smilelen)) { |
2383 GtkIMHtmlFontDetail *fd; | 2386 GtkIMHtmlFontDetail *fd; |
2384 | 2387 |
2385 gchar *sml = NULL; | 2388 gchar *sml = NULL; |
2386 if (fonts) { | 2389 if (fonts) { |
2387 fd = fonts->data; | 2390 fd = fonts->data; |
2388 sml = fd->sml; | 2391 sml = fd->sml; |
2389 } | 2392 } |
2393 if (!sml) | |
2394 sml = imhtml->protocol_name; | |
2395 | |
2390 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); | 2396 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); |
2391 wpos = g_snprintf (ws, smilelen + 1, "%s", c); | 2397 wpos = g_snprintf (ws, smilelen + 1, "%s", c); |
2392 | 2398 |
2393 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, ws, iter); | 2399 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, ws, iter); |
2394 | 2400 |
2486 { | 2492 { |
2487 imhtml->smiley_shortcuts = allow; | 2493 imhtml->smiley_shortcuts = allow; |
2488 } | 2494 } |
2489 | 2495 |
2490 void | 2496 void |
2491 gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name) { | 2497 gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name) { |
2492 imhtml->protocol_name = protocol_name; | 2498 if (imhtml->protocol_name) |
2499 g_free(imhtml->protocol_name); | |
2500 imhtml->protocol_name = protocol_name ? g_strdup(protocol_name) : NULL; | |
2493 } | 2501 } |
2494 | 2502 |
2495 void | 2503 void |
2496 gtk_imhtml_clear (GtkIMHtml *imhtml) | 2504 gtk_imhtml_clear (GtkIMHtml *imhtml) |
2497 { | 2505 { |