Daniel Brötzmann pushed to branch storage at gajim / gajim
Commits:
dfc175fc by wurstsalat at 2023-08-11T20:34:20+02:00
imprv: ConversationView: Add icon for showing message state in MUCs
- - - - -
2 changed files:
- gajim/gtk/conversation/rows/message.py
- gajim/gtk/conversation/rows/widgets.py
Changes:
=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -36,6 +36,7 @@
from gajim.common.modules.contacts import GroupchatParticipant
from gajim.common.modules.contacts import ResourceContact
from gajim.common.storage.archive.const import ChatDirection
+from gajim.common.storage.archive.const import MessageState
from gajim.common.storage.archive.const import MessageType
from gajim.common.storage.archive.structs import DbConversationJoinedData
from gajim.common.storage.archive.structs import DbEncryptionRowData
@@ -173,6 +174,10 @@ def update_with_content(self, db_row:
DbConversationJoinedData) -> None:
db_row.marker.received_ts is not None):
self.show_receipt(True)
+ if (self._contact.is_groupchat and
+ db_row.direction == ChatDirection.OUTGOING):
+ self.show_group_chat_message_state(MessageState(db_row.state))
+
if db_row.error is not None:
if db_row.error.text is not None:
error_text = f'{db_row.error.text} ({db_row.error.condition})'
@@ -369,6 +374,9 @@ def _get_encryption_data(self,
def show_receipt(self, show: bool) -> None:
self._message_icons.set_receipt_icon_visible(show)
+ def show_group_chat_message_state(self, state: MessageState) -> None:
+ self._message_icons.set_group_chat_message_state_icon(state)
+
def show_error(self, tooltip: str) -> None:
self._message_icons.set_error_icon_visible(True)
self._message_icons.set_error_tooltip(tooltip)
=====================================
gajim/gtk/conversation/rows/widgets.py
=====================================
@@ -28,8 +28,10 @@
from gajim.common import app
from gajim.common.const import AvatarSize
from gajim.common.const import TRUST_SYMBOL_DATA
+from gajim.common.i18n import _
from gajim.common.i18n import p_
from gajim.common.modules.contacts import GroupchatContact
+from gajim.common.storage.archive.const import MessageState
from gajim.common.types import ChatContactT
from gajim.gtk.menus import get_groupchat_participant_menu
@@ -108,7 +110,9 @@ def __init__(self, name: str, from_us: bool) -> None:
class MessageIcons(Gtk.Box):
def __init__(self) -> None:
- Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
+ Gtk.Box.__init__(self,
+ orientation=Gtk.Orientation.HORIZONTAL,
+ spacing=3)
self._encryption_image = Gtk.Image()
self._encryption_image.set_no_show_all(True)
@@ -125,6 +129,11 @@ def __init__(self) -> None:
self._correction_image.set_no_show_all(True)
self._correction_image.get_style_context().add_class('dim-label')
+ self._group_chat_message_state_image = Gtk.Image()
+ self._group_chat_message_state_image.set_no_show_all(True)
+ self._group_chat_message_state_image.get_style_context().add_class(
+ 'dim-label')
+
self._marker_image = Gtk.Image.new_from_icon_name(
'feather-check-symbolic', Gtk.IconSize.MENU)
self._marker_image.set_no_show_all(True)
@@ -139,6 +148,7 @@ def __init__(self) -> None:
self.add(self._encryption_image)
self.add(self._security_label)
self.add(self._correction_image)
+ self.add(self._group_chat_message_state_image)
self.add(self._marker_image)
self.add(self._error_image)
self.show_all()
@@ -172,6 +182,18 @@ def set_receipt_icon_visible(self, visible: bool) -> None:
return
self._marker_image.set_visible(visible)
+ def set_group_chat_message_state_icon(self, state: MessageState) -> None:
+ if state == MessageState.PENDING:
+ icon_name = 'feather-clock-symbolic'
+ tooltip_text = _('Pending')
+ else:
+ icon_name = 'feather-check-symbolic'
+ tooltip_text = _('Received')
+ self._group_chat_message_state_image.set_from_icon_name(
+ icon_name, Gtk.IconSize.MENU)
+ self._group_chat_message_state_image.set_tooltip_text(tooltip_text)
+ self._group_chat_message_state_image.show()
+
def set_correction_icon_visible(self, visible: bool) -> None:
self._correction_image.set_visible(visible)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/dfc175fc2977eb85b922be237a310eddc832f7bd
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/dfc175fc2977eb85b922be237a310eddc832f7bd
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]