Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
84fbaa87 by wurstsalat at 2023-05-22T21:41:45+02:00
imprv: ChatList: Clear row content when removing history

Fixes #11420

- - - - -


4 changed files:

- gajim/gtk/application.py
- gajim/gtk/chat_list.py
- gajim/gtk/chat_list_row.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/gtk/application.py
=====================================
@@ -851,8 +851,9 @@ def _on_remove_history_action(_action: Gio.SimpleAction,
                                   ) -> None:
         def _remove() -> None:
             app.storage.archive.remove_history(params.account, params.jid)
-            control = app.window.get_control()
 
+            app.window.clear_chat_list_row(params.account, params.jid)
+            control = app.window.get_control()
             if not control.is_loaded(params.account, params.jid):
                 return
 


=====================================
gajim/gtk/chat_list.py
=====================================
@@ -307,6 +307,11 @@ def remove_chats_for_account(self, account: str) -> None:
             self.remove_chat(account, jid)
         self._emit_unread_changed()
 
+    def clear_chat_list_row(self, account: str, jid: JID) -> None:
+        chat = self._chats.get((account, jid))
+        if chat is not None:
+            chat.clear()
+
     def contains_chat(self, account: str, jid: JID) -> bool:
         return self._chats.get((account, jid)) is not None
 


=====================================
gajim/gtk/chat_list_row.py
=====================================
@@ -248,6 +248,13 @@ def set_header_type(self, header_type: 
Optional[RowHeaderType]) -> None:
         else:
             self.set_header(self._conversations_header)
 
+    def clear(self) -> None:
+        self.timestamp = 0
+        self.stanza_id = None
+        self.message_id = None
+        self.set_message_text('')
+        self.set_nick('')
+
     def set_message_id(self, message_id: str) -> None:
         self.message_id = message_id
 


=====================================
gajim/gtk/main.py
=====================================
@@ -993,6 +993,12 @@ def add_private_chat(self,
                                                'pm',
                                                select=select)
 
+    def clear_chat_list_row(self, account: str, jid: JID) -> None:
+        chat_list_stack = self._chat_page.get_chat_list_stack()
+        chat_list = chat_list_stack.find_chat(account, jid)
+        if chat_list is not None:
+            chat_list.clear_chat_list_row(account, jid)
+
     def select_chat(self, account: str, jid: JID) -> None:
         self._app_side_bar.unselect_all()
         self._account_side_bar.unselect_all()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/84fbaa870523f21516846a6282658a3c35b4ff6a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/84fbaa870523f21516846a6282658a3c35b4ff6a
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

Reply via email to