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

Commits:

2 changed files:

Changes:

  • gajim/gtk/main.py
    ... ... @@ -140,6 +140,7 @@ def _add_actions(self):
    140 140
                 ('remove-chat', 'as', self._remove_chat),
    
    141 141
                 ('toggle-chat-pinned', 'as', self._toggle_chat_pinned),
    
    142 142
                 ('move-chat-to-workspace', 'as', self._move_chat_to_workspace),
    
    143
    +            ('add-to-roster', 'as', self._add_to_roster),
    
    143 144
             ]
    
    144 145
     
    
    145 146
             for action in actions:
    
    ... ... @@ -441,6 +442,11 @@ def remove_chat(self, account, jid):
    441 442
                     self._chat_list_stack.remove_chat(workspace_id, account, jid)
    
    442 443
                     return
    
    443 444
     
    
    445
    +    @staticmethod
    
    446
    +    def _add_to_roster(_action, param):
    
    447
    +        _workspace, account, jid = param.unpack()
    
    448
    +        open_window('AddNewContactWindow', account=account, contact_jid=jid)
    
    449
    +
    
    444 450
         def chat_exists(self, account, jid):
    
    445 451
             return self._chat_list_stack.contains_chat(account, jid)
    
    446 452
     
    

  • gajim/gui_menu_builder.py
    ... ... @@ -820,12 +820,19 @@ def get_roster_menu(account, jid):
    820 820
     
    
    821 821
     
    
    822 822
     def get_chat_list_row_menu(workspace_id, account, jid, pinned):
    
    823
    +    client = app.get_client(account)
    
    824
    +    contact = client.get_module('Contact').get_contact(jid)
    
    825
    +
    
    823 826
         toggle_label = _('Unpin Chat') if pinned else _('Pin Chat')
    
    827
    +
    
    824 828
         menu_items = [
    
    825 829
             ('toggle-chat-pinned', toggle_label),
    
    826 830
             (_('Move Chat'), []),
    
    827 831
         ]
    
    828 832
     
    
    833
    +    if not contact.is_in_roster():
    
    834
    +        menu_items.append(('add-to-roster', _('Add to contact list')))
    
    835
    +
    
    829 836
         menu = Gio.Menu()
    
    830 837
         for item in menu_items:
    
    831 838
             if isinstance(item[1], str):