Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d1f57886 by Philipp Hörist at 2022-12-13T20:29:56+01:00
refactor: Menus: Port component search menu to GajimMenu
- - - - -
1 changed file:
- gajim/gtk/menus.py
Changes:
=====================================
gajim/gtk/menus.py
=====================================
@@ -636,26 +636,17 @@ def get_groupchat_participant_menu(account: str,
return menu
-def get_component_search_menu(jid: Optional[str], copy_text: str) -> Gio.Menu:
- menu_items: list[tuple[str, str]] = [
- ('app.copy-text', _('Copy')),
+def get_component_search_menu(jid: Optional[str], copy_text: str) -> GajimMenu:
+ menuitems: MenuItemListT = [
+ (_('Copy'), 'app.copy-text', copy_text),
]
+
if jid is not None:
- menu_items.append(
- ('app.start-chat', _('Start Chat…')))
-
- menu = Gio.Menu()
- for item in menu_items:
- action, label = item
- menuitem = Gio.MenuItem.new(label, action)
- if action == 'app.copy-text':
- data = copy_text
- else:
- data = jid
- variant = GLib.Variant('s', data)
- menuitem.set_action_and_target_value(action, variant)
- menu.append_item(menuitem)
- return menu
+ menuitems.append(
+ (_('Start Chat…'), 'app.start-chat', jid)
+ )
+
+ return GajimMenu.from_list(menuitems)
def get_chat_row_menu(contact: types.ChatContactT,
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d1f57886eedd4b9c787183a17294d549aaf890f4
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d1f57886eedd4b9c787183a17294d549aaf890f4
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