comparison pidgin/gtkconv.c @ 22647:5624eec4da24

merge of '8ac2f1461dd4df5ba43e8c0399b59451b3c549e6' and 'f29197b389e99b8fcdc2b1179c0be21644a4c170'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 13 Apr 2008 17:39:38 +0000
parents f75509f776cc 0c59913dc8a0
children 101d16be1521 69d54f84350a 030185a59a1a
comparison
equal deleted inserted replaced
22646:654f8386f4b3 22647:5624eec4da24
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),