diff options
author | Stu Tomlinson <nosnilmot@pidgin.im> | 2007-12-01 16:43:53 +0000 |
---|---|---|
committer | Stu Tomlinson <nosnilmot@pidgin.im> | 2007-12-01 16:43:53 +0000 |
commit | 1aec1a9aeaa4a7bd9fa4aa46aebb4a2861798386 (patch) | |
tree | c8ea88a42745e244f988cc211b92a6968fee3c5b | |
parent | e5b9c38353265e7f8e428f085f590a55f6da6f2d (diff) | |
download | pidgin-1aec1a9aeaa4a7bd9fa4aa46aebb4a2861798386.tar.gz |
applied changes from ae553a7b1f48faebd22d107832f5827460d5d656
through 50e7240a3bbd8a2e7d2d39a93f26d35baf168805
-rw-r--r-- | pidgin/gtkconv.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 381b76d1d2..7a5de0384e 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -6555,7 +6555,28 @@ pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) } } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { const char *topic = gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)); - char *esc = topic ? g_markup_escape_text(topic, -1) : NULL; + char *esc = NULL; +#if GTK_CHECK_VERSION(2,6,0) + esc = topic ? g_markup_escape_text(topic, -1) : NULL; +#else + /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude + * trucation to prevent forcing the window to be as wide as the topic */ + int len = 0; + char *c, *tmp = g_strdup(topic); + c = tmp; + while(*c && len < 72) { + c = g_utf8_next_char(c); + len++; + } + if (len == 72) { + *c = '\0'; + c = g_strdup_printf("%s...", tmp); + g_free(tmp); + tmp = c; + } + esc = tmp ? g_markup_escape_text(tmp, -1) : NULL; + g_free(tmp); +#endif markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>", purple_conversation_get_title(conv), esc && *esc ? "\n" : "", |