From 6767244a98172e1bf148526f72189dd4236d6ea0 Mon Sep 17 00:00:00 2001 From: wurstsalat Date: Sat, 6 May 2023 23:51:07 +0200 Subject: fix: ChatList: Update mute state periodically Fixes #11456 --- gajim/gtk/chat_list.py | 8 ++++---- 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() -- cgit v1.2.3