diff options
author | wurstsalat <mailtrash@posteo.de> | 2023-05-07 00:51:07 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2023-11-07 23:39:14 +0300 |
commit | 6767244a98172e1bf148526f72189dd4236d6ea0 (patch) | |
tree | 89d948156ad05a364a1fe91472137c4246face2f | |
parent | 829ee4a2c34f3605093daf99efb21e3120bbbc48 (diff) |
fix: ChatList: Update mute state periodically
Fixes #11456
-rw-r--r-- | gajim/gtk/chat_list.py | 8 | ||||
-rw-r--r-- | gajim/gtk/chat_list_row.py | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gajim/gtk/chat_list.py b/gajim/gtk/chat_list.py index c637e07f3..9ef5de286 100644 --- a/gajim/gtk/chat_list.py +++ b/gajim/gtk/chat_list.py @@ -59,7 +59,7 @@ class ChatList(Gtk.ListBox, EventHelper): EventHelper.__init__(self) self._workspace_id = workspace_id - self._chats: dict[tuple[str, JID], Any] = {} + self._chats: dict[tuple[str, JID], ChatListRow] = {} self._current_filter: str = 'all' self._current_filter_text: str = '' @@ -98,7 +98,7 @@ class ChatList(Gtk.ListBox, EventHelper): self.connect('drag-data-received', self._on_drag_data_received) self.connect('destroy', self._on_destroy) - self._timer_id = GLib.timeout_add_seconds(60, self._update_time) + self._timer_id = GLib.timeout_add_seconds(60, self._update_row_state) self.show_all() @@ -455,9 +455,9 @@ class ChatList(Gtk.ListBox, EventHelper): self.invalidate_sort() self._pinned_order_change = False - def _update_time(self) -> bool: + def _update_row_state(self) -> bool: for row in self._chats.values(): - row.update_time() + row.update_state() return True def _filter_func(self, row: ChatListRow) -> bool: diff --git a/gajim/gtk/chat_list_row.py b/gajim/gtk/chat_list_row.py index 5bb4aa4e0..f8b709550 100644 --- a/gajim/gtk/chat_list_row.py +++ b/gajim/gtk/chat_list_row.py @@ -357,6 +357,10 @@ class ChatListRow(Gtk.ListBoxRow): self._ui.timestamp_label.set_text( get_uf_relative_time(datetime.fromtimestamp(self.timestamp))) + def update_state(self) -> None: + self.update_time() + self._ui.mute_image.set_visible(self.contact.is_muted) + def add_unread(self, text: str) -> None: self._unread_count += 1 self._update_unread() |