From 7b1d582bf1c614ca50c09b88970cd59915589c84 Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Tue, 2 May 2006 17:55:52 +0000 Subject: [PATCH] Nicer systray tooltip when awaiting events of differents types (don't print gajim twice). Fixes #1053 --- src/tooltips.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/tooltips.py b/src/tooltips.py index e7023c432..f09cccbdd 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -314,32 +314,41 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable): unread_pm += pm_msgs if unread_chat or unread_single_chat or unread_gc or unread_pm: - text = '' + text = 'Gajim ' + awaiting_events = unread_chat + unread_single_chat + unread_gc + unread_pm + if awaiting_events == unread_chat or awaiting_events == unread_single_chat \ + or awaiting_events == unread_gc or awaiting_events == unread_pm: + # This condition is like previous if but with xor... + # Print in one line + text += '-' + else: + # Print in multiple lines + text += '\n ' if unread_chat: text += i18n.ngettext( - 'Gajim - %d unread message', - 'Gajim - %d unread messages', + ' %d unread message', + ' %d unread messages', unread_chat, unread_chat, unread_chat) - text += '\n' + text += '\n ' if unread_single_chat: text += i18n.ngettext( - 'Gajim - %d unread single message', - 'Gajim - %d unread single messages', + ' %d unread single message', + ' %d unread single messages', unread_single_chat, unread_single_chat, unread_single_chat) - text += '\n' + text += '\n ' if unread_gc: text += i18n.ngettext( - 'Gajim - %d unread group chat message', - 'Gajim - %d unread group chat messages', + ' %d unread group chat message', + ' %d unread group chat messages', unread_gc, unread_gc, unread_gc) - text += '\n' + text += '\n ' if unread_pm: text += i18n.ngettext( - 'Gajim - %d unread private message', - 'Gajim - %d unread private messages', + ' %d unread private message', + ' %d unread private messages', unread_pm, unread_pm, unread_pm) - text += '\n' - text = text[:-1] # remove latest \n + text += '\n ' + text = text[:-4] # remove latest '\n ' elif len(accounts) > 1: text = _('Gajim') self.current_current_row = 1