Philipp Hörist pushed to branch master at gajim / gajim
Commits:
278ea276 by Philipp Hörist at 2022-12-08T13:11:46+01:00
refactor: Harmonize groupchat-join/open-chat action
We want the behavior of groupchat-join, but not only for group chats.
This consolidates the code into the open-chat action.
- - - - -
3 changed files:
- gajim/gtk/application.py
- gajim/gtk/const.py
- gajim/gtk/menus.py
Changes:
=====================================
gajim/gtk/application.py
=====================================
@@ -302,7 +302,7 @@ def _open_uris(self, uris: list[str]) -> None:
if cmd == 'join':
if len(accounts) == 1:
self.activate_action(
- 'groupchat-join',
+ 'open-chat',
GLib.Variant('as', [accounts[0], jid]))
else:
self.activate_action(
@@ -418,7 +418,7 @@ def _connect_app_actions(self) -> None:
('remove-history', self._on_remove_history_action),
('create-groupchat', self._on_create_groupchat_action),
('forget-groupchat', self._on_forget_groupchat_action),
- ('groupchat-join', self._on_groupchat_join_action),
+ ('open-chat', self._on_open_chat_action),
('show', self._on_show),
]
@@ -445,7 +445,6 @@ def add_account_actions(self, account: str) -> None:
def _connect_account_actions(self, account: str) -> None:
actions = [
('bookmarks', self._on_bookmarks_action),
- ('open-chat', self._on_open_chat_action),
('add-contact', self._on_add_contact_account_action),
('services', self._on_services_action),
('profile', self._on_profile_action),
@@ -854,12 +853,6 @@ def _on_forget_groupchat_action(_action: Gio.SimpleAction,
app.storage.archive.remove_history(params.account, params.jid)
- @staticmethod
- def _on_groupchat_join_action(_action: Gio.SimpleAction,
- param: GLib.Variant) -> None:
- account, jid = param.get_strv()
- app.window.start_chat_from_jid(account, jid)
-
@staticmethod
def _on_show(_action: Gio.SimpleAction, param: GLib.Variant) -> None:
app.window.show()
=====================================
gajim/gtk/const.py
=====================================
@@ -169,7 +169,6 @@ def __str__(self):
('features', None),
('file-transfer', None),
('forget-groupchat', 'a{sv}'),
- ('groupchat-join', 'as'),
('join-support-chat', None),
('manage-proxies', None),
('open-link', 'as'),
@@ -180,6 +179,7 @@ def __str__(self):
('shortcuts', None),
('show', None),
('start-chat', 'as'),
+ ('open-chat', 'as'),
('xml-console', None),
]
@@ -274,7 +274,6 @@ def __str__(self):
('export-history', 's'),
('import-contacts', 's'),
('mark-as-read', 'a{sv}'),
- ('open-chat', 'as'),
('open-event', 'a{sv}'),
('pep-config', 's'),
('profile', 's'),
@@ -299,7 +298,6 @@ def __str__(self):
'modify-gateway',
'bookmarks',
'import-contacts',
- 'open-chat',
'pep-config',
'profile',
'server-info',
=====================================
gajim/gtk/menus.py
=====================================
@@ -296,7 +296,7 @@ def _xmpp_message_query_context_menu(uri: URI, account:
str) -> UriMenuItemsT:
return [
('copy-text', [uri.source], _('Copy Link Location')),
('copy-text', [jid], _('Copy XMPP Address')),
- (f'{account}-open-chat', [account, jid], _('Start Chat…')),
+ ('open-chat', [account, jid], _('Start Chat…')),
# ^ TODO: pass qparams ^
(f'{account}-add-contact', [account, jid], _('Add to Contact List…')),
]
@@ -306,7 +306,7 @@ def _xmpp_join_query_context_menu(uri: URI, account: str)
-> UriMenuItemsT:
return [
('copy-text', [uri.source], _('Copy Link Location')),
('copy-text', [uri.data['jid']], _('Copy XMPP Address')),
- ('groupchat-join', [account, uri.data['jid']],
+ ('open-chat', [account, uri.data['jid']],
# ^ TODO: pass qparams ^
_('Join Groupchat…')),
]
@@ -352,8 +352,7 @@ def _ambiguous_addr_context_menu(uri: URI, account: str) ->
UriMenuItemsT:
return [
('copy-text', [addr], _('Copy XMPP Address/Email')),
('open-link', ['', mailto], _('Open Email Composer')),
- (f'{account}-open-chat', [account, addr], _('Start Chat…')),
- ('groupchat-join', [account, addr], _('Join Groupchat…')),
+ ('open-chat', [account, addr], _('Start Chat…')),
(f'{account}-add-contact', [account, addr], _('Add to Contact List…')),
]
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/278ea27680f87a36a1d2eb14a7bfe520eb4d7377
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/278ea27680f87a36a1d2eb14a7bfe520eb4d7377
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