Mercurial > pidgin.yaz
changeset 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 | 7ab20f829190 |
files | src/gtkimhtml.c src/gtkimhtml.h |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkimhtml.c Sun May 23 06:28:29 2004 +0000 +++ b/src/gtkimhtml.c Sun May 23 08:06:38 2004 +0000 @@ -941,6 +941,8 @@ g_list_free(imhtml->scalables); g_slist_free(imhtml->im_images); + if (imhtml->protocol_name) + g_free(imhtml->protocol_name); G_OBJECT_CLASS(parent_class)->finalize (object); } @@ -1383,11 +1385,12 @@ sml = font->sml; } - if (sml == NULL) + if (!sml) + sml = imhtml->protocol_name; + + if (!sml || !(tree = g_hash_table_lookup(imhtml->smiley_data, sml))) tree = imhtml->default_smilies; - else { - tree = g_hash_table_lookup(imhtml->smiley_data, sml); - } + if (tree == NULL) return FALSE; @@ -2379,7 +2382,7 @@ pos += tlen; if(tag) g_free(tag); /* This was allocated back in VALID_TAG() */ - } else if (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen)) { + } else if (gtk_imhtml_is_smiley(imhtml, fonts, c, &smilelen)) { GtkIMHtmlFontDetail *fd; gchar *sml = NULL; @@ -2387,6 +2390,9 @@ fd = fonts->data; sml = fd->sml; } + if (!sml) + sml = imhtml->protocol_name; + gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, wpos); wpos = g_snprintf (ws, smilelen + 1, "%s", c); @@ -2488,8 +2494,10 @@ } void -gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name) { - imhtml->protocol_name = protocol_name; +gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name) { + if (imhtml->protocol_name) + g_free(imhtml->protocol_name); + imhtml->protocol_name = protocol_name ? g_strdup(protocol_name) : NULL; } void
--- a/src/gtkimhtml.h Sun May 23 06:28:29 2004 +0000 +++ b/src/gtkimhtml.h Sun May 23 08:06:38 2004 +0000 @@ -220,7 +220,7 @@ void gtk_imhtml_smiley_shortcuts (GtkIMHtml *imhtml, gboolean allow); -void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, gchar *protocol_name); +void gtk_imhtml_set_protocol_name(GtkIMHtml *imhtml, const gchar *protocol_name); #define gtk_imhtml_append_text(x, y, z) \ gtk_imhtml_append_text_with_images(x, y, z, NULL)