Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
fc4f9c43
by wurstsalat at 2022-08-16T09:22:05+02:00
3 changed files:
- gajim/gtk/conversation/rows/read_marker.py
- gajim/gtk/conversation/rows/scroll_hint.py
- gajim/gtk/conversation/view.py
Changes:
| ... | ... | @@ -26,8 +26,8 @@ |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | class ReadMarkerRow(BaseRow):
|
| 29 | - def __init__(self, account: str, contact: ChatContactT) -> None:
|
|
| 30 | - BaseRow.__init__(self, account, widget='label')
|
|
| 29 | + def __init__(self, contact: ChatContactT) -> None:
|
|
| 30 | + BaseRow.__init__(self, contact.account, widget='label')
|
|
| 31 | 31 | self.set_activatable(False)
|
| 32 | 32 | self.type = 'read_marker'
|
| 33 | 33 | self.timestamp = datetime.fromtimestamp(0)
|
| ... | ... | @@ -39,6 +39,7 @@ def __init__(self, account: str) -> None: |
| 39 | 39 | self.grid.attach(self.label, 0, 1, 1, 1)
|
| 40 | 40 | |
| 41 | 41 | self.set_history_complete(False)
|
| 42 | + self.show_all()
|
|
| 42 | 43 | |
| 43 | 44 | def set_history_complete(self, complete: bool) -> None:
|
| 44 | 45 | if complete:
|
| ... | ... | @@ -119,24 +119,27 @@ def switch_contact(self, contact: ChatContactT) -> None: |
| 119 | 119 | account=contact.account,
|
| 120 | 120 | jid=contact.jid)
|
| 121 | 121 | |
| 122 | - self._read_marker_row = ReadMarkerRow(contact.account, contact)
|
|
| 123 | - self.add(self._read_marker_row)
|
|
| 124 | - |
|
| 125 | - self._scroll_hint_row = ScrollHintRow(contact.account)
|
|
| 126 | - self.add(self._scroll_hint_row)
|
|
| 127 | - |
|
| 128 | 122 | def get_row_at_index(self, index: int) -> BaseRow:
|
| 129 | 123 | return cast(BaseRow, Gtk.ListBox.get_row_at_index(self, index))
|
| 130 | 124 | |
| 131 | 125 | def reset(self) -> None:
|
| 132 | - for row in self.get_children()[2:]:
|
|
| 133 | - if isinstance(row, ReadMarkerRow):
|
|
| 134 | - continue
|
|
| 126 | + for row in self.get_children():
|
|
| 135 | 127 | row.destroy()
|
| 136 | 128 | |
| 137 | 129 | self._row_count = 0
|
| 138 | 130 | self._active_date_rows = set()
|
| 139 | 131 | self._message_id_row_map = {}
|
| 132 | + self._read_marker_row = None
|
|
| 133 | + self._scroll_hint_row = None
|
|
| 134 | + |
|
| 135 | + if self._contact is not None:
|
|
| 136 | + # These need to be present if ConversationView is reset
|
|
| 137 | + # without switch_contact being invoked
|
|
| 138 | + self._read_marker_row = ReadMarkerRow(self._contact)
|
|
| 139 | + self.add(self._read_marker_row)
|
|
| 140 | + |
|
| 141 | + self._scroll_hint_row = ScrollHintRow(self._contact.account)
|
|
| 142 | + self.add(self._scroll_hint_row)
|
|
| 140 | 143 | |
| 141 | 144 | def get_first_message_row(self) -> Optional[MessageRow]:
|
| 142 | 145 | for row in self.get_children():
|