im.pidgin.pidgin.2.3.1: 66cb86d18d8044666dc0ec2d324354ba771d03f9

nosnilmot at pidgin.im nosnilmot at pidgin.im
Sat Dec 1 11:45:41 EST 2007


-----------------------------------------------------------------
Revision: 66cb86d18d8044666dc0ec2d324354ba771d03f9
Ancestor: 9f41d42014773f6e91ad1d1c96020f56f3d6f551
Author: nosnilmot at pidgin.im
Date: 2007-12-01T16:43:53
Branch: im.pidgin.pidgin.2.3.1

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

applied changes from ae553a7b1f48faebd22d107832f5827460d5d656
             through 50e7240a3bbd8a2e7d2d39a93f26d35baf168805

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	d4d86d8874a699f63fe69d2eb72e2cb614dabb1e
+++ pidgin/gtkconv.c	67c25a6fb985618001e1a5a1326098070af2739d
@@ -6555,7 +6555,28 @@ pidgin_conv_update_fields(PurpleConversa
 			}
 		} 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<span color='%s' size='smaller'>%s</span>",
 						purple_conversation_get_title(conv),
 						esc  && *esc ? "\n" : "",


More information about the Commits mailing list