Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
1d81a63c by wurstsalat at 2021-10-30T21:25:38+02:00
ConversationView: Read marker improvements
- - - - -
2 changed files:
- gajim/gtk/conversation/rows/read_marker.py
- gajim/gtk/conversation/view.py
Changes:
=====================================
gajim/gtk/conversation/rows/read_marker.py
=====================================
@@ -26,6 +26,7 @@ def __init__(self, account, contact):
BaseRow.__init__(self, account, widget='label')
self.type = 'read_marker'
self.timestamp = datetime.fromtimestamp(0)
+ self._last_incoming_timestamp = datetime.fromtimestamp(0)
contact.connect('nickname-update', self._on_nickname_update)
@@ -43,7 +44,15 @@ def _on_nickname_update(self, contact, _signal_name):
self.label.set_text(text)
def set_timestamp(self, timestamp):
+ if timestamp < self._last_incoming_timestamp:
+ return
+
self.timestamp = timestamp
+
self.changed()
self.set_no_show_all(False)
self.show_all()
+
+ def set_last_incoming_timestamp(self, timestamp):
+ if timestamp > self._last_incoming_timestamp:
+ self._last_incoming_timestamp = timestamp
=====================================
gajim/gtk/conversation/view.py
=====================================
@@ -243,17 +243,24 @@ def add_message(self,
if message.type == 'chat':
self._message_id_row_map[message_id] = message
+
+ if kind == 'incoming':
+ self._read_marker_row.set_last_incoming_timestamp(
+ message.timestamp)
if marker is not None and marker == 'displayed':
self.set_read_marker(message_id)
+
self._insert_message(message)
def _insert_message(self, message):
self.add(message)
self._add_date_row(message.timestamp)
self._check_for_merge(message)
+
if message.kind == 'incoming':
if message.timestamp > self._read_marker_row.timestamp:
self._read_marker_row.hide()
+
GLib.idle_add(message.queue_resize)
def _add_date_row(self, timestamp):
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/1d81a63c2e9b79f25547ee4d2a666ec48f2867aa
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/1d81a63c2e9b79f25547ee4d2a666ec48f2867aa
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits