From a6f9f83f3130f9d829f093ff74d0bdcb1863ffad Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Sun, 31 Jul 2005 21:16:20 +0000 Subject: [PATCH] fixed "Pan Taduesz; Ksiega I" problem --- src/dialogs.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dialogs.py b/src/dialogs.py index 910a5ebc2..3cac54319 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -623,9 +623,17 @@ class StatusTable: if status: status = status.strip() if status != '': + status = self.strip_text(status, 50) str_status += ' - ' + status return gtkgui_helpers.escape_for_pango_markup(str_status) - + + # "Pan Taduesz; Ksiega I" problem, reported by koorek + def strip_text(self, text, max_length): + text = text.strip() + if len(text) > max_length: + text = text[:max_length - 3] + '...' + return text + def add_status_row(self, file_path, show, str_status): ''' appends a new row with status icon to the table ''' self.current_row += 1 @@ -700,9 +708,11 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable): iconset = 'sun' file_path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') for acct in accounts: + mesage = gtkgui_helpers.escape_for_pango_markup(acct['message']) + mesage = self.strip_text(mesage, 50) self.add_status_row(file_path, acct['show'], '' + gtkgui_helpers.escape_for_pango_markup(acct['name']) + '' - + ' - ' + gtkgui_helpers.escape_for_pango_markup(acct['message'])) + + ' - ' + mesage) elif len(accounts) == 1: text = _('Gajim - %s') % accounts[0]['status_line']