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

Commits:

4 changed files:

Changes:

  • gajim/gtk/chat_list.py
    ... ... @@ -35,6 +35,11 @@ def select_chat(self, account, jid):
    35 35
             row = self._chats[(account, jid)]
    
    36 36
             self.select_row(row)
    
    37 37
     
    
    38
    +    def remove_chat(self, account, jid):
    
    39
    +        row = self._chats.pop((account, jid))
    
    40
    +        self.remove(row)
    
    41
    +        row.destroy()
    
    42
    +
    
    38 43
         def _on_row_selected(self, _listbox, row):
    
    39 44
             if row is None:
    
    40 45
                 self._chat_stack.clear()
    

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

  • gajim/gtk/chat_stack.py
    ... ... @@ -33,6 +33,11 @@ def add_chat(self, account, jid):
    33 33
             self.add_named(chat_control.widget, f'{account}:{jid}')
    
    34 34
             chat_control.widget.show_all()
    
    35 35
     
    
    36
    +    def remove_chat(self, account, jid):
    
    37
    +        control = self._controls[account].pop(jid)
    
    38
    +        control.shutdown()
    
    39
    +        self.remove(control)
    
    40
    +
    
    36 41
         def show_chat(self, account, jid):
    
    37 42
             self.set_visible_child_name(f'{account}:{jid}')
    
    38 43
     
    

  • gajim/gtk/main.py
    ... ... @@ -68,6 +68,11 @@ def add_chat_for_workspace(self, workspace_id, account, jid):
    68 68
                 self._chat_list_stack.select_chat(workspace_id, account, jid)
    
    69 69
                 self._chat_list_stack.store_open_chats(workspace_id)
    
    70 70
     
    
    71
    +    def remove_chat(self, workspace_id, account, jid):
    
    72
    +        self._chat_stack.remove_chat(account, jid)
    
    73
    +        self._chat_list_stack.remove_chat(workspace_id, account, jid)
    
    74
    +        self._chat_list_stack.store_open_chats(workspace_id)
    
    75
    +
    
    71 76
         def get_control(self, account, jid):
    
    72 77
             return self._chat_stack.get_control(account, jid)
    
    73 78