pidgin/gtkconv.c

branch
release-2.3.1
changeset 21723
337cd29fb4b0
parent 21722
8b275923f914
child 21735
bb49da9915a6
equal deleted inserted replaced
21722:8b275923f914 21723:337cd29fb4b0
6553 } else { 6553 } else {
6554 markup = title; 6554 markup = title;
6555 } 6555 }
6556 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { 6556 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
6557 const char *topic = gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)); 6557 const char *topic = gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text));
6558 char *esc = topic ? g_markup_escape_text(topic, -1) : NULL; 6558 char *esc = NULL;
6559 #if GTK_CHECK_VERSION(2,6,0)
6560 esc = topic ? g_markup_escape_text(topic, -1) : NULL;
6561 #else
6562 /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude
6563 * trucation to prevent forcing the window to be as wide as the topic */
6564 int len = 0;
6565 char *c, *tmp = g_strdup(topic);
6566 c = tmp;
6567 while(*c && len < 72) {
6568 c = g_utf8_next_char(c);
6569 len++;
6570 }
6571 if (len == 72) {
6572 *c = '\0';
6573 c = g_strdup_printf("%s...", tmp);
6574 g_free(tmp);
6575 tmp = c;
6576 }
6577 esc = tmp ? g_markup_escape_text(tmp, -1) : NULL;
6578 g_free(tmp);
6579 #endif
6559 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>", 6580 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
6560 purple_conversation_get_title(conv), 6581 purple_conversation_get_title(conv),
6561 esc && *esc ? "\n" : "", 6582 esc && *esc ? "\n" : "",
6562 pidgin_get_dim_grey_string(gtkconv->infopane), 6583 pidgin_get_dim_grey_string(gtkconv->infopane),
6563 esc ? esc : ""); 6584 esc ? esc : "");

mercurial