Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: fc4f9c43 by wurstsalat at 2022-08-16T09:22:05+02:00 cfix: Don’t re-use ReadMarkerRow and ScrollHintRow when switching contacts - - - - - 3 changed files: - gajim/gtk/conversation/rows/read_marker.py - gajim/gtk/conversation/rows/scroll_hint.py - gajim/gtk/conversation/view.py Changes: ===================================== gajim/gtk/conversation/rows/read_marker.py ===================================== @@ -26,8 +26,8 @@ class ReadMarkerRow(BaseRow): - def __init__(self, account: str, contact: ChatContactT) -> None: - BaseRow.__init__(self, account, widget='label') + def __init__(self, contact: ChatContactT) -> None: + BaseRow.__init__(self, contact.account, widget='label') self.set_activatable(False) self.type = 'read_marker' self.timestamp = datetime.fromtimestamp(0) ===================================== gajim/gtk/conversation/rows/scroll_hint.py ===================================== @@ -39,6 +39,7 @@ def __init__(self, account: str) -> None: self.grid.attach(self.label, 0, 1, 1, 1) self.set_history_complete(False) + self.show_all() def set_history_complete(self, complete: bool) -> None: if complete: ===================================== gajim/gtk/conversation/view.py ===================================== @@ -119,24 +119,27 @@ def switch_contact(self, contact: ChatContactT) -> None: account=contact.account, jid=contact.jid) - self._read_marker_row = ReadMarkerRow(contact.account, contact) - self.add(self._read_marker_row) - - self._scroll_hint_row = ScrollHintRow(contact.account) - self.add(self._scroll_hint_row) - def get_row_at_index(self, index: int) -> BaseRow: return cast(BaseRow, Gtk.ListBox.get_row_at_index(self, index)) def reset(self) -> None: - for row in self.get_children()[2:]: - if isinstance(row, ReadMarkerRow): - continue + for row in self.get_children(): row.destroy() self._row_count = 0 self._active_date_rows = set() self._message_id_row_map = {} + self._read_marker_row = None + self._scroll_hint_row = None + + if self._contact is not None: + # These need to be present if ConversationView is reset + # without switch_contact being invoked + self._read_marker_row = ReadMarkerRow(self._contact) + self.add(self._read_marker_row) + + self._scroll_hint_row = ScrollHintRow(self._contact.account) + self.add(self._scroll_hint_row) def get_first_message_row(self) -> Optional[MessageRow]: for row in self.get_children(): View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/fc4f9c43d6224f966de9ade9a68b6cad30ae2c0c -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/fc4f9c43d6224f966de9ade9a68b6cad30ae2c0c You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list Commits@gajim.org https://lists.gajim.org/cgi-bin/listinfo/commits