pidgin/gtkconv.c

changeset 22807
0c222582d56d
parent 22805
92825aac9549
parent 22792
121982f55f03
child 22829
39aba82e3fb1
child 23696
1049b744d8c8
equal deleted inserted replaced
22806:db2444697cd9 22807:0c222582d56d
6536 markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); 6536 markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE);
6537 } else { 6537 } else {
6538 markup = title; 6538 markup = title;
6539 } 6539 }
6540 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { 6540 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
6541 const char *topic = gtkconv->u.chat->topic_text ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text)) : NULL; 6541 const char *topic = gtkconv->u.chat->topic_text
6542 ? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text))
6543 : NULL;
6542 char *esc = NULL, *tmp; 6544 char *esc = NULL, *tmp;
6543 #if GTK_CHECK_VERSION(2,6,0) 6545 #if GTK_CHECK_VERSION(2,6,0)
6544 esc = topic ? g_markup_escape_text(topic, -1) : NULL; 6546 esc = topic ? g_markup_escape_text(topic, -1) : NULL;
6545 #else 6547 #else
6546 /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude 6548 /* GTK < 2.6 doesn't have auto ellipsization, so we do a crude
6547 * trucation to prevent forcing the window to be as wide as the topic */ 6549 * trucation to prevent forcing the window to be as wide as the topic */
6548 int len = 0; 6550 int len = 0;
6549 char *c; 6551 char *c;
6550 6552
6551 tmp = g_strdup(topic); 6553 if (topic != NULL) {
6552 c = tmp; 6554 tmp = g_strdup(topic);
6553 while(*c && len < 72) { 6555 c = tmp;
6554 c = g_utf8_next_char(c); 6556 while(*c && len < 72) {
6555 len++; 6557 c = g_utf8_next_char(c);
6558 len++;
6559 }
6560 if (len == 72) {
6561 *c = '\0';
6562 c = g_strdup_printf("%s...", tmp);
6563 g_free(tmp);
6564 tmp = c;
6565 }
6566 esc = g_markup_escape_text(tmp, -1);
6567 g_free(tmp);
6556 } 6568 }
6557 if (len == 72) {
6558 *c = '\0';
6559 c = g_strdup_printf("%s...", tmp);
6560 g_free(tmp);
6561 tmp = c;
6562 }
6563 esc = tmp ? g_markup_escape_text(tmp, -1) : NULL;
6564 g_free(tmp);
6565 #endif 6569 #endif
6566 tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1); 6570 tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1);
6567 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>", 6571 markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
6568 tmp, esc && *esc ? "\n" : "", 6572 tmp, esc && *esc ? "\n" : "",
6569 pidgin_get_dim_grey_string(gtkconv->infopane), 6573 pidgin_get_dim_grey_string(gtkconv->infopane),

mercurial