Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
e4ea33fc by Daniel Brötzmann at 2021-03-10T17:49:55+01:00
ChatList: Implement Add to roster menu entry
- - - - -
2 changed files:
- gajim/gtk/main.py
- gajim/gui_menu_builder.py
Changes:
=====================================
gajim/gtk/main.py
=====================================
@@ -140,6 +140,7 @@ def _add_actions(self):
('remove-chat', 'as', self._remove_chat),
('toggle-chat-pinned', 'as', self._toggle_chat_pinned),
('move-chat-to-workspace', 'as', self._move_chat_to_workspace),
+ ('add-to-roster', 'as', self._add_to_roster),
]
for action in actions:
@@ -441,6 +442,11 @@ def remove_chat(self, account, jid):
self._chat_list_stack.remove_chat(workspace_id, account, jid)
return
+ @staticmethod
+ def _add_to_roster(_action, param):
+ _workspace, account, jid = param.unpack()
+ open_window('AddNewContactWindow', account=account, contact_jid=jid)
+
def chat_exists(self, account, jid):
return self._chat_list_stack.contains_chat(account, jid)
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -820,12 +820,19 @@ def get_roster_menu(account, jid):
def get_chat_list_row_menu(workspace_id, account, jid, pinned):
+ client = app.get_client(account)
+ contact = client.get_module('Contact').get_contact(jid)
+
toggle_label = _('Unpin Chat') if pinned else _('Pin Chat')
+
menu_items = [
('toggle-chat-pinned', toggle_label),
(_('Move Chat'), []),
]
+ if not contact.is_in_roster():
+ menu_items.append(('add-to-roster', _('Add to contact list')))
+
menu = Gio.Menu()
for item in menu_items:
if isinstance(item[1], str):
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4ea33fc2fa7ffec174d15e0680148337fab5df7
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/e4ea33fc2fa7ffec174d15e0680148337fab5df7
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