From aedc06ae11d52c95a1a67d21526078241ee395b3 Mon Sep 17 00:00:00 2001 From: wurstsalat <mailtrash@posteo.de> Date: Thu, 29 Apr 2021 23:07:33 +0200 Subject: [PATCH] MUCUserStatus: Add styling --- .../gtk/conversation/rows/muc_user_status.py | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/gajim/gtk/conversation/rows/muc_user_status.py b/gajim/gtk/conversation/rows/muc_user_status.py index 1ecdbb1eda..26c3e13a33 100644 --- a/gajim/gtk/conversation/rows/muc_user_status.py +++ b/gajim/gtk/conversation/rows/muc_user_status.py @@ -20,10 +20,15 @@ from gajim.common.i18n import _ from gajim.common.const import AvatarSize from gajim.common import helpers +from gajim.common.styling import process from .widgets import SimpleLabel from .base import BaseRow +from ..message_widget import MessageWidget + +from ...avatar import get_show_circle + class MUCUserStatus(BaseRow): def __init__(self, account, user_contact, is_self): @@ -38,15 +43,26 @@ def __init__(self, account, user_contact, is_self): avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1) self.grid.attach(avatar_placeholder, 0, 0, 1, 1) - icon_name = 'feather-info-symbolic' - icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU) - self.grid.attach(icon, 1, 0, 1, 1) + show_icon = Gtk.Image() + show_icon.set_opacity(0.6) + surface = get_show_circle( + user_contact.show.value, + AvatarSize.SHOW_CIRCLE, + self.get_scale_factor()) + show_icon.set_from_surface(surface) + self.grid.attach(show_icon, 1, 0, 1, 1) self._label = SimpleLabel() - self._label.set_text(self._make_text(user_contact, is_self)) + self._label.set_text(self._make_show_text(user_contact, is_self)) self._label.get_style_context().add_class('gajim-status-message') self.grid.attach(self._label, 2, 0, 1, 1) + if user_contact.status is not None: + result = process(user_contact.status) + message_widget = MessageWidget(account) + message_widget.add_content(result) + self.grid.attach(message_widget, 2, 1, 1, 1) + timestamp_widget = self.create_timestamp_widget(self.timestamp) timestamp_widget.set_hexpand(True) timestamp_widget.set_halign(Gtk.Align.END) @@ -56,18 +72,14 @@ def __init__(self, account, user_contact, is_self): self.show_all() @staticmethod - def _make_text(user_contact, is_self): + def _make_show_text(user_contact, is_self): nick = user_contact.name - status = user_contact.status - status = '' if status is None else ' - %s' % status show = helpers.get_uf_show(user_contact.show.value) if is_self: - message = _('You are now {show}{status}').format(show=show, - status=status) + message = _('You are now {show}').format(show=show) else: - message = _('{nick} is now {show}{status}').format(nick=nick, - show=show, - status=status) + message = _('{nick} is now {show}').format(nick=nick, + show=show) return message -- GitLab