/pidgin/main: 76c445e2ab94: other half of fixes for #1441, show ...

Nathan Walp nwalp at pidgin.im
Sat Sep 8 19:20:48 EDT 2012


Changeset: 76c445e2ab9459af11349f915cc689926a56a614
Author:	 Nathan Walp <nwalp at pidgin.im>
Date:	 2012-09-08 13:07 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/76c445e2ab94

Description:

other half of fixes for #1441, show the "real" name of a chat in addition to the alias (if different)

diffstat:

 pidgin/gtkconv.c |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (40 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -7402,15 +7402,28 @@ pidgin_conv_update_fields(PurpleConversa
 			const char *topic = gtkconv->u.chat->topic_text
 				? gtk_entry_get_text(GTK_ENTRY(gtkconv->u.chat->topic_text))
 				: NULL;
-			char *esc = NULL, *tmp;
-			esc = topic ? g_markup_escape_text(topic, -1) : NULL;
-			tmp = g_markup_escape_text(purple_conversation_get_title(conv), -1);
-			markup = g_strdup_printf("%s%s<span color='%s' size='smaller'>%s</span>",
-						tmp, esc  && *esc ? "\n" : "",
+			const char *title = purple_conversation_get_title(conv);
+			const char *name = purple_conversation_get_name(conv);
+
+			char *topic_esc, *unaliased, *unaliased_esc, *title_esc;
+
+			topic_esc = topic ? g_markup_escape_text(topic, -1) : NULL;
+			unaliased = g_utf8_collate(title, name) ? g_strdup_printf("(%s)", name) : NULL;
+			unaliased_esc = unaliased ? g_markup_escape_text(unaliased, -1) : NULL;
+			title_esc = g_markup_escape_text(title, -1);
+
+			markup = g_strdup_printf("%s%s<span size='smaller'>%s</span>%s<span color='%s' size='smaller'>%s</span>",
+						title_esc,
+						unaliased_esc ? " " : "",
+						unaliased_esc ? unaliased_esc : "",
+						topic_esc  && *topic_esc ? "\n" : "",
 						pidgin_get_dim_grey_string(gtkconv->infopane),
-						esc ? esc : "");
-			g_free(tmp);
-			g_free(esc);
+						topic_esc ? topic_esc : "");
+
+			g_free(title_esc);
+			g_free(topic_esc);
+			g_free(unaliased);
+			g_free(unaliased_esc);
 		}
 		gtk_list_store_set(gtkconv->infopane_model, &(gtkconv->infopane_iter),
 				CONV_TEXT_COLUMN, markup, -1);



More information about the Commits mailing list