* Use same height for all banners. Fixes #2770
* Show only one status line in chatwindows, indicate when it is shortened
This commit is contained in:
parent
bb7283de02
commit
8bbc23dfd6
|
@ -133,6 +133,7 @@ class ChatControlBase(MessageControl):
|
|||
|
||||
# Create banner and connect signals
|
||||
widget = self.xml.get_widget('banner_eventbox')
|
||||
widget.set_property('height-request', gajim.config.get('chat_avatar_height'))
|
||||
id = widget.connect('button-press-event',
|
||||
self._on_banner_eventbox_button_press_event)
|
||||
self.handlers[id] = widget
|
||||
|
@ -1117,6 +1118,8 @@ class ChatControl(ChatControlBase):
|
|||
jid = contact.jid
|
||||
|
||||
banner_name_label = self.xml.get_widget('banner_name_label')
|
||||
banner_eventbox = self.xml.get_widget('banner_eventbox')
|
||||
|
||||
name = contact.get_shown_name()
|
||||
if self.resource:
|
||||
name += '/' + self.resource
|
||||
|
@ -1143,8 +1146,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)
|
||||
status = helpers.reduce_chars_newlines(status, max_lines = 2)
|
||||
status = helpers.reduce_chars_newlines(status, max_lines = 1)
|
||||
status_escaped = gobject.markup_escape_text(status)
|
||||
|
||||
font_attrs, font_attrs_small = self.get_font_attrs()
|
||||
|
@ -1177,9 +1182,6 @@ class ChatControl(ChatControlBase):
|
|||
if status_escaped:
|
||||
label_text += '\n<span %s>%s</span>' %\
|
||||
(font_attrs_small, status_escaped)
|
||||
banner_eventbox = self.xml.get_widget('banner_eventbox')
|
||||
self.status_tooltip.set_tip(banner_eventbox, status)
|
||||
self.status_tooltip.enable()
|
||||
else:
|
||||
self.status_tooltip.disable()
|
||||
# setup the label that holds name and jid
|
||||
|
|
|
@ -871,6 +871,8 @@ def reduce_chars_newlines(text, max_chars = 0, max_lines = 0):
|
|||
lines = map(lambda e: _cut_if_long(e), lines)
|
||||
if lines:
|
||||
reduced_text = reduce(lambda e, e1: e + '\n' + e1, lines)
|
||||
if reduced_text != text:
|
||||
reduced_text += '...'
|
||||
else:
|
||||
reduced_text = ''
|
||||
return reduced_text
|
||||
|
|
Loading…
Reference in New Issue