Philipp Hörist pushed to branch master at gajim / gajim
Commits:
65037251 by Philipp Hörist at 2026-01-11T09:24:08+01:00
cfix: MessageInput: Revert to custom action for clearing input
text.clear is only available in Gtk 4.19
- - - - -
4 changed files:
- gajim/gtk/const.py
- gajim/gtk/menus.py
- gajim/gtk/message_input.py
- gajim/gtk/shortcut_manager.py
Changes:
=====================================
gajim/gtk/const.py
=====================================
@@ -195,6 +195,7 @@ def __str__(self):
MAIN_WIN_ACTIONS = [
# action name, variant type, enabled
+ ("input-clear", None, True),
("input-bold", None, True),
("input-italic", None, True),
("input-strike", None, True),
=====================================
gajim/gtk/menus.py
=====================================
@@ -241,7 +241,7 @@ def get_encryption_menu() -> GajimMenu:
def get_message_input_extra_context_menu() -> Gio.Menu:
menuitems: MenuItemListT = [
- (_("Clear"), "text.clear", None),
+ (_("Clear"), "win.input-clear", None),
(_("Paste as Code Block"), "win.input-paste-as-code-block", None),
(_("Paste as Quote"), "win.input-paste-as-quote", None),
]
=====================================
gajim/gtk/message_input.py
=====================================
@@ -127,6 +127,7 @@ def __init__(self, parent: Gtk.Widget) -> None:
def _on_register_actions(self, _event: events.RegisterActions) -> None:
actions = [
+ "input-clear",
"input-focus",
"input-bold",
"input-italic",
@@ -151,6 +152,9 @@ def _on_action(
log.info("Activate action: %s", action_name)
match action_name:
+ case "input-clear":
+ self.clear()
+
case "input-focus":
self.grab_focus_delayed()
@@ -417,7 +421,12 @@ def _apply_formatting(self, formatting: str) -> None:
)
def clear(self, *args: Any) -> None:
- self.activate_action("text.clear")
+ buf = self.get_buffer()
+ buf.delete(*buf.get_bounds())
+
+ # Action only available in Gtk 4.19
+ # Use this as soon we set it as min Gtk
+ # self.activate_action("text.clear")
def undo(self, *args: Any) -> None:
buf = self.get_buffer()
=====================================
gajim/gtk/shortcut_manager.py
=====================================
@@ -527,7 +527,7 @@ def get_for_action(self, action_name: str) -> GajimShortcut:
label=_("Clear Input"),
category="messages",
accelerators=["<Primary>U"],
- action_name="text.clear",
+ action_name="win.input-clear",
),
GajimShortcut(
label=_("Correct Message"),
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/65037251dc891fdf5124da84f5772f3f34d7d03d
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/65037251dc891fdf5124da84f5772f3f34d7d03d
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]