# HG changeset patch # User Stu Tomlinson # Date 1196527384 0 # Node ID ef855b0026d1e6409755502f34af880c457c336b # Parent b2c2e935a150063071269a9b418cafd2b0734dc0 Truncate the topic to an arbitrary 72 characters in the infopane when using GTK < 2.6 which has no ellipsization support. Fixes #4196 diff -r b2c2e935a150 -r ef855b0026d1 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Dec 01 09:08:43 2007 +0000 +++ b/pidgin/gtkconv.c Sat Dec 01 16:43:04 2007 +0000 @@ -6477,7 +6477,28 @@ } } 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%s", purple_conversation_get_title(conv), esc && *esc ? "\n" : "",