Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
-
5241c4ea
by wurstsalat at 2021-07-05T22:07:49+02:00
2 changed files:
Changes:
| ... | ... | @@ -74,26 +74,16 @@ def create_timestamp_widget(timestamp: datetime) -> Gtk.Label: |
| 74 | 74 |
return label
|
| 75 | 75 |
|
| 76 | 76 |
@staticmethod
|
| 77 |
- def create_name_widget(name: str, kind: str,
|
|
| 78 |
- is_groupchat: bool) -> Gtk.Label:
|
|
| 77 |
+ def create_name_widget(name: str, is_self: bool) -> Gtk.Label:
|
|
| 79 | 78 |
label = Gtk.Label()
|
| 80 | 79 |
label.set_selectable(True)
|
| 81 | 80 |
label.get_style_context().add_class('conversation-nickname')
|
| 81 |
+ label.set_markup(GLib.markup_escape_text(name))
|
|
| 82 | 82 |
|
| 83 |
- name = GLib.markup_escape_text(name)
|
|
| 84 |
- if is_groupchat:
|
|
| 85 |
- rgba = Gdk.RGBA(*text_to_color(name))
|
|
| 86 |
- nick_color = convert_rgba_to_hex(rgba)
|
|
| 87 |
- label.set_markup(
|
|
| 88 |
- f'<span foreground="{nick_color}">{name}</span>')
|
|
| 83 |
+ if is_self:
|
|
| 84 |
+ label.get_style_context().add_class('gajim-outgoing-nickname')
|
|
| 89 | 85 |
else:
|
| 90 |
- if kind in ('incoming', 'incoming_queue'):
|
|
| 91 |
- label.get_style_context().add_class(
|
|
| 92 |
- 'gajim-incoming-nickname')
|
|
| 93 |
- elif kind == 'outgoing':
|
|
| 94 |
- label.get_style_context().add_class(
|
|
| 95 |
- 'gajim-outgoing-nickname')
|
|
| 96 |
- label.set_markup(name)
|
|
| 86 |
+ label.get_style_context().add_class('gajim-incoming-nickname')
|
|
| 97 | 87 |
return label
|
| 98 | 88 |
|
| 99 | 89 |
|
| ... | ... | @@ -87,13 +87,17 @@ def __init__(self, |
| 87 | 87 |
self._message_widget = MessageWidget(account)
|
| 88 | 88 |
self._message_widget.add_content(result)
|
| 89 | 89 |
if self._is_groupchat:
|
| 90 |
- self_contact = self._contact.get_self()
|
|
| 91 |
- if self_contact.name != name:
|
|
| 90 |
+ if self._contact.get_self().name != name:
|
|
| 92 | 91 |
self._check_for_highlight(result)
|
| 93 | 92 |
|
| 93 |
+ if self._is_groupchat:
|
|
| 94 |
+ is_self = name == self._contact.get_self().name
|
|
| 95 |
+ else:
|
|
| 96 |
+ is_self = kind == 'outgoing'
|
|
| 97 |
+ name_widget = self.create_name_widget(name, is_self)
|
|
| 98 |
+ |
|
| 94 | 99 |
self._meta_box = Gtk.Box(spacing=6)
|
| 95 | 100 |
self._meta_box.set_hexpand(True)
|
| 96 |
- name_widget = self.create_name_widget(name, kind, self._is_groupchat)
|
|
| 97 | 101 |
self._meta_box.pack_start(name_widget, False, True, 0)
|
| 98 | 102 |
timestamp_label = self.create_timestamp_widget(self.timestamp)
|
| 99 | 103 |
timestamp_label.set_margin_start(6)
|