From 5c92566a1d5d7525d70b55b6d84c1e1f4f63132c Mon Sep 17 00:00:00 2001
From: Stephan Erb <steve-e@h3c.de>
Date: Thu, 29 Nov 2007 20:33:10 +0000
Subject: [PATCH] Hide status/topic label when there is nothing to show.
 Disable empty tooltips.

---
 src/chat_control.py      | 11 +++++++----
 src/groupchat_control.py |  4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/chat_control.py b/src/chat_control.py
index eca07ad3e6..acf53fe4fe 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -1205,12 +1205,10 @@ class ChatControl(ChatControlBase):
 
 		status = contact.status
 		if status is not None:
-			self.status_tooltip.set_tip(banner_eventbox, status)
-			self.status_tooltip.enable()
 			banner_name_label.set_ellipsize(pango.ELLIPSIZE_END)
 			self.banner_status_label.set_ellipsize(pango.ELLIPSIZE_END)
-			status = helpers.reduce_chars_newlines(status, max_lines = 1)
-		status_escaped = gobject.markup_escape_text(status)
+			status_reduced = helpers.reduce_chars_newlines(status, max_lines = 1)
+		status_escaped = gobject.markup_escape_text(status_reduced)
 
 		font_attrs, font_attrs_small = self.get_font_attrs()
 		st = gajim.config.get('displayed_chat_state_notifications')
@@ -1246,9 +1244,14 @@ class ChatControl(ChatControlBase):
 				status_text = '<span %s>%s</span>' % (font_attrs_small, status_text)
 			else:
 				status_text = '<span %s>%s</span>' % (font_attrs_small, status_escaped)
+			self.status_tooltip.set_tip(banner_eventbox, status)
+			self.banner_status_label.show()
+			self.banner_status_label.set_no_show_all(False)
 		else:
 			status_text = ''
 			self.status_tooltip.disable()
+			self.banner_status_label.hide()
+			self.banner_status_label.set_no_show_all(True)
 
 		self.banner_status_label.set_markup(status_text)
 		# setup the label that holds name and jid
diff --git a/src/groupchat_control.py b/src/groupchat_control.py
index 3c7a4f42fd..63f718a541 100644
--- a/src/groupchat_control.py
+++ b/src/groupchat_control.py
@@ -517,9 +517,13 @@ class GroupchatControl(ChatControlBase):
 
 			# tooltip must always hold ALL the subject
 			self.subject_tooltip.set_tip(self.event_box, self.subject)
+			self.banner_status_label.show()
+			self.banner_status_label.set_no_show_all(False)
 		else:
 			subject_text = ''
 			self.subject_tooltip.disable()
+			self.banner_status_label.hide()
+			self.banner_status_label.set_no_show_all(True)
 
 		self.banner_status_label.set_markup(subject_text)
 
-- 
GitLab