Philipp Hörist pushed to branch mainwindow at gajim / gajim


Commits:
8447b316 by lovetox at 2021-01-17T22:08:23+01:00
Add remove_chat()

- - - - -


4 changed files:

- gajim/gtk/chat_list.py
- gajim/gtk/chat_list_stack.py
- gajim/gtk/chat_stack.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/gtk/chat_list.py
=====================================
@@ -35,6 +35,11 @@ def select_chat(self, account, jid):
         row = self._chats[(account, jid)]
         self.select_row(row)
 
+    def remove_chat(self, account, jid):
+        row = self._chats.pop((account, jid))
+        self.remove(row)
+        row.destroy()
+
     def _on_row_selected(self, _listbox, row):
         if row is None:
             self._chat_stack.clear()


=====================================
gajim/gtk/chat_list_stack.py
=====================================
@@ -48,3 +48,7 @@ def store_open_chats(self, workspace_id):
         open_chats = chat_list.get_open_chats()
         app.settings.set_workspace_setting(
             workspace_id, 'open_chats', open_chats)
+
+    def remove_chat(self, workspace_id, account, jid):
+        chat_list = self._chat_lists[workspace_id]
+        chat_list.remove_chat(account, jid)


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -33,6 +33,11 @@ def add_chat(self, account, jid):
         self.add_named(chat_control.widget, f'{account}:{jid}')
         chat_control.widget.show_all()
 
+    def remove_chat(self, account, jid):
+        control = self._controls[account].pop(jid)
+        control.shutdown()
+        self.remove(control)
+
     def show_chat(self, account, jid):
         self.set_visible_child_name(f'{account}:{jid}')
 


=====================================
gajim/gtk/main.py
=====================================
@@ -68,6 +68,11 @@ def add_chat_for_workspace(self, workspace_id, account, jid):
             self._chat_list_stack.select_chat(workspace_id, account, jid)
             self._chat_list_stack.store_open_chats(workspace_id)
 
+    def remove_chat(self, workspace_id, account, jid):
+        self._chat_stack.remove_chat(account, jid)
+        self._chat_list_stack.remove_chat(workspace_id, account, jid)
+        self._chat_list_stack.store_open_chats(workspace_id)
+
     def get_control(self, account, jid):
         return self._chat_stack.get_control(account, jid)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/8447b3162023ab36fbc76eafc61c3649f101db73

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