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


Commits:
86b854e7 by Philipp Hörist at 2025-11-23T21:48:55+01:00
fix: Application: Don’t allow to rebind escape action

- - - - -


3 changed files:

- gajim/gtk/application.py
- gajim/gtk/const.py
- gajim/gtk/preference/shortcuts.py


Changes:

=====================================
gajim/gtk/application.py
=====================================
@@ -526,10 +526,18 @@ def set_user_shortcuts(self, user_shortcuts: dict[str, 
list[str]]) -> None:
 
     def _load_shortcuts(self) -> None:
         shortcuts = {
-            action_name: shortcut_data.accelerators
-            for action_name, shortcut_data in SHORTCUTS.items()
+            action_name: data.accelerators for action_name, data in 
SHORTCUTS.items()
         }
+        no_rebind_allowed = [
+            action_name
+            for action_name, data in SHORTCUTS.items()
+            if not data.allow_rebind
+        ]
+
         user_shortcuts = self.get_user_shortcuts()
+        for action_name in no_rebind_allowed:
+            shortcuts.pop(action_name, None)
+
         shortcuts.update(user_shortcuts)
 
         for action, accelerators in shortcuts.items():


=====================================
gajim/gtk/const.py
=====================================
@@ -326,6 +326,7 @@ class ShortcutData:
     label: str
     category: str
     accelerators: list[str]
+    allow_rebind: bool = True
 
 
 SHORTCUT_CATEGORIES = {
@@ -396,7 +397,7 @@ class ShortcutData:
         accelerators=["<Primary><Shift>S"],
     ),
     "win.escape": ShortcutData(
-        label=_("Unselect Chat"), category="chats", accelerators=["Escape"]
+        label="Escape", category="chats", accelerators=["Escape"], 
allow_rebind=False
     ),
     "win.close-chat": ShortcutData(
         label=_("Close Chat"), category="chats", accelerators=["<Primary>W"]


=====================================
gajim/gtk/preference/shortcuts.py
=====================================
@@ -64,6 +64,9 @@ def _load_shortcuts(self) -> None:
             self.add(preferences_group)
 
         for action_name, shortcut_data in SHORTCUTS.items():
+            if not shortcut_data.allow_rebind:
+                continue
+
             row = ShortcutsManagerRow(action_name)
             self._connect(row, "activated", self._on_activated)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/86b854e79ce49f3b647bfe59468dc5e5cb604953

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/86b854e79ce49f3b647bfe59468dc5e5cb604953
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