Commit 772c2ea3 authored by Philipp Hörist's avatar Philipp Hörist

Show display markers

parent 57249864
Pipeline #4502 passed with stages
in 3 minutes and 11 seconds
......@@ -233,6 +233,8 @@ class ChatControl(ChatControlBase):
app.ged.register_event_handler(
'receipt-received',
ged.GUI1, self._receipt_received)
app.ged.register_event_handler('displayed-received',
ged.GUI1, self._displayed_received)
app.ged.register_event_handler('message-error',
ged.GUI1, self._on_message_error)
app.ged.register_event_handler('zeroconf-error', ged.GUI1,
......@@ -971,6 +973,10 @@ class ChatControl(ChatControlBase):
def _receipt_received(self, event):
self.conv_textview.show_receipt(event.receipt_id)
@event_filter(['account', 'jid'])
def _displayed_received(self, event):
self.conv_textview.show_displayed(event.marker_id)
def get_tab_label(self):
unread = ''
if self.resource:
......
......@@ -71,10 +71,14 @@ class ChatMarkers(BaseModule):
properties.jid,
properties.marker.id)
jid = properties.jid
if not properties.is_muc_pm and not properties.type.is_groupchat:
jid = properties.jid.getBare()
app.nec.push_outgoing_event(
NetworkEvent(name,
account=self._account,
jid=properties.jid,
jid=jid,
properties=properties,
type=properties.type,
is_muc_pm=properties.is_muc_pm,
......
......@@ -407,6 +407,12 @@ class ConversationTextview(GObject.GObject):
return
line.set_receipt()
def show_displayed(self, id_):
line = self._get_message_line(id_)
if line is None:
return
line.set_displayed()
def show_error(self, id_, error):
line = self._get_message_line(id_)
if line is None:
......@@ -1313,16 +1319,27 @@ class MessageLine:
self.timestamp = timestamp
self.start_mark = start_mark
self._has_receipt = False
self._has_displayed = False
self._message_icons = message_icons
@property
def has_receipt(self):
return self._has_receipt
@property
def has_displayed(self):
return self._has_displayed
def set_receipt(self):
self._has_receipt = True
if self._has_displayed:
return
self._message_icons.set_receipt_icon_visible(True)
def set_displayed(self):
self._has_displayed = True
self._message_icons.set_displayed_icon_visible(True)
def set_correction(self, tooltip):
self._message_icons.set_correction_icon_visible(True)
self._message_icons.set_correction_tooltip(tooltip)
......@@ -1341,12 +1358,12 @@ class MessageIcons(Gtk.Box):
'document-edit-symbolic', Gtk.IconSize.MENU)
self._correction_image.set_no_show_all(True)
self._receipt_image = Gtk.Image.new_from_icon_name(
self._marker_image = Gtk.Image.new_from_icon_name(
'emblem-ok-symbolic', Gtk.IconSize.MENU)
self._receipt_image.get_style_context().add_class(
self._marker_image.get_style_context().add_class(
'receipt-received-color')
self._receipt_image.set_tooltip_text(_('Received'))
self._receipt_image.set_no_show_all(True)
self._marker_image.set_tooltip_text(_('Received'))
self._marker_image.set_no_show_all(True)
self._error_image = Gtk.Image.new_from_icon_name(
'dialog-warning-symbolic', Gtk.IconSize.MENU)
......@@ -1354,14 +1371,22 @@ class MessageIcons(Gtk.Box):
self._error_image.set_no_show_all(True)
self.add(self._correction_image)
self.add(self._receipt_image)
self.add(self._marker_image)
self.add(self._error_image)
self.show_all()
def set_receipt_icon_visible(self, visible):
if not app.config.get('positive_184_ack'):
return
self._receipt_image.set_visible(visible)
self._marker_image.set_visible(visible)
def set_displayed_icon_visible(self, visible):
self._marker_image.set_visible(visible)
self._marker_image.get_style_context().remove_class(
'receipt-received-color')
self._marker_image.get_style_context().add_class(
'displayed-received-color')
self._marker_image.set_tooltip_text(_('Displayed'))
def set_correction_icon_visible(self, visible):
self._correction_image.set_visible(visible)
......
......@@ -248,6 +248,7 @@ button.flat.link { padding: 0; border: 0; }
/*Receipts*/
.receipt-received-color { color: rgb(75, 181, 67) }
.displayed-received-color { color: rgb(106, 0, 242) }
/*Dataforms*/
.field-fixed { font-size: 16px; font-weight: bold; padding-top:5px;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment