From 00f00f3dcdacf16a1bea0acaa5cc3c47075a6441 Mon Sep 17 00:00:00 2001
From: Jean-Marie Traissard <jim@lapin.org>
Date: Sun, 24 Sep 2006 20:37:02 +0000
Subject: [PATCH] Modified gc-tooltip : Don't show role (it's already known),
 show affiliation only if different from none, always show nick as title,
 don't print "Status:" but print status directly after nick and other fields
 (if any) after an Horizontal bar. Please comment in #2110. Roster tooltip
 will be modified accordingly.

---
 src/tooltips.py | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/tooltips.py b/src/tooltips.py
index 53915df8ab..a32be25216 100644
--- a/src/tooltips.py
+++ b/src/tooltips.py
@@ -365,18 +365,13 @@ class GCTooltip(BaseTooltip):
 		vcard_current_row = 1
 		properties = []
 		
-		if contact.jid.strip() != '':
-			jid_markup = '<span weight="bold">' + contact.jid + '</span>' 
-		else:
-			jid_markup = '<span weight="bold">' + \
+
+		nick_markup = '<span weight="bold">' + \
 			gtkgui_helpers.escape_for_pango_markup(contact.get_shown_name()) \
 			+ '</span>'
-		properties.append((jid_markup, None))	
-		properties.append((_('Role: '), helpers.get_uf_role(contact.role)))
-		properties.append((_('Affiliation: '), contact.affiliation.capitalize()))
-		if hasattr(contact, 'resource') and contact.resource.strip() != '':
-			properties.append((_('Resource: '), 
-				gtkgui_helpers.escape_for_pango_markup(contact.resource) ))
+		properties.append((nick_markup, None))
+
+		# status :
 		show = helpers.get_uf_show(contact.show)
 		if contact.status:
 			status = contact.status.strip()
@@ -384,7 +379,15 @@ class GCTooltip(BaseTooltip):
 				# escape markup entities
 				status = gtkgui_helpers.reduce_chars_newlines(status, 200, 5)
 				show += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
-		properties.append((_('Status: '), show))
+		properties.append((show, None))
+
+		if contact.jid.strip() != '':
+			properties.append((_('JID: '), contact.jid))	
+		if contact.affiliation != "none":
+			properties.append((_('Affiliation: '), contact.affiliation.capitalize()))
+		if hasattr(contact, 'resource') and contact.resource.strip() != '':
+			properties.append((_('Resource: '), 
+				gtkgui_helpers.escape_for_pango_markup(contact.resource) ))
 		
 		# Add avatar
 		puny_name = helpers.sanitize_filename(contact.name)
@@ -403,6 +406,12 @@ class GCTooltip(BaseTooltip):
 		while properties:
 			property = properties.pop(0)
 			vcard_current_row += 1
+			if vcard_current_row == 4:
+			# horizontal separator after status, if something after
+				h_separator = gtk.HSeparator()
+				vcard_table.attach(h_separator, 1, 3, vcard_current_row, vcard_current_row + 1,\
+							 gtk.FILL, vertical_fill, 0)
+				vcard_current_row += 1
 			vertical_fill = gtk.FILL
 			if not properties:
 				vertical_fill |= gtk.EXPAND
@@ -421,7 +430,7 @@ class GCTooltip(BaseTooltip):
 			else:
 				label.set_markup(property[0])
 				vcard_table.attach(label, 1, 3, vcard_current_row, vcard_current_row + 1, 
-															gtk.FILL, vertical_fill, 0)
+										gtk.FILL, vertical_fill, 0)
 		
 		self.avatar_image.set_alignment(0, 0)
 		vcard_table.attach(self.avatar_image, 3, 4, 2, vcard_current_row +1, 
-- 
GitLab