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


Commits:
0de2e6ed by wurstsalat at 2025-03-25T21:28:42+01:00
imprv: Start chat: Add 'Execute Command…' menu item

Fixes #12246

- - - - -


2 changed files:

- gajim/gtk/menus.py
- gajim/gtk/start_chat.py


Changes:

=====================================
gajim/gtk/menus.py
=====================================
@@ -501,11 +501,25 @@ def get_start_chat_button_menu() -> GajimMenu:
     return GajimMenu.from_list(menuitems)
 
 
-def get_start_chat_row_menu(account: str, jid: JID) -> GajimMenu:
-    params = AccountJidParam(account=account, jid=jid)
-    menuitems: MenuItemListT = [
-        (_("Forget this Group Chat"), "app.forget-groupchat", params),
-    ]
+def get_start_chat_row_menu(account: str, jid: JID | None) -> GajimMenu | None:
+    if jid is None:
+        return None
+
+    client = app.get_client(account)
+    contact = client.get_module("Contacts").get_contact(jid)
+
+    menuitems: MenuItemListT = []
+
+    command_params = GLib.Variant("(sas)", (account, [str(jid)]))
+    menuitems.append(
+        (_("Execute Command…"), f"app.{account}-execute-command", 
command_params)
+    )
+
+    if isinstance(contact, GroupchatContact):
+        account_jid_params = AccountJidParam(account=account, jid=jid)
+        menuitems.append(
+            (_("Forget this Group Chat"), "app.forget-groupchat", 
account_jid_params)
+        )
 
     return GajimMenu.from_list(menuitems)
 


=====================================
gajim/gtk/start_chat.py
=====================================
@@ -1035,9 +1035,7 @@ def __init__(
             show = contact.show
             is_self = contact.is_self
 
-        menu = None
-        if groupchat:
-            menu = get_start_chat_row_menu(account, jid)
+        menu = get_start_chat_row_menu(account, jid)
 
         is_new = jid is None
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/0de2e6ed31e281a6b3eb564e0fc9b1174d1d5c18

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/0de2e6ed31e281a6b3eb564e0fc9b1174d1d5c18
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to