Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
aab830ad by wurstsalat at 2025-06-21T11:03:25+02:00
imprv: Debug console: Add shortcut Ctrl+L for clearing logs window

- - - - -


2 changed files:

- gajim/data/gui/debug_console.ui
- gajim/gtk/debug_console.py


Changes:

=====================================
gajim/data/gui/debug_console.ui
=====================================
@@ -187,6 +187,7 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="clear_button">
+                    <property name="action-name">win.clear-window</property>
                     <property name="focusable">1</property>
                     <property name="receives-default">1</property>
                     <property name="tooltip-text" 
translatable="yes">Clear</property>


=====================================
gajim/gtk/debug_console.py
=====================================
@@ -97,11 +97,21 @@ def __init__(self) -> None:
         assert header_bar is not None
         header_bar.set_title_widget(self._ui.header_box)
         self._set_title()
-
         self.set_child(self._ui.stack)
 
         
self._ui.paned.set_position(self._ui.paned.get_property("max-position"))
 
+        action = Gio.SimpleAction.new("clear-window")
+        self._connect(action, "activate", self._on_clear_window)
+        self.window.add_action(action)
+
+        shortcut_controller = Gtk.ShortcutController()
+        callback_action = Gtk.CallbackAction.new(self._on_clear_window)  # 
type: ignore
+        shortcut_trigger = Gtk.ShortcutTrigger.parse_string("<Control>l")
+        shortcut = Gtk.Shortcut.new(shortcut_trigger, callback_action)
+        shortcut_controller.add_shortcut(shortcut)
+        self.window.add_controller(shortcut_controller)
+
         accounts = self._get_accounts()
         self._account_dropdown = GajimDropDown(fixed_width=15, data=accounts)
         if accounts:
@@ -122,7 +132,6 @@ def __init__(self) -> None:
         self._connect(
             self._ui.filter_options_button, "clicked", self._on_filter_options
         )
-        self._connect(self._ui.clear_button, "clicked", self._on_clear)
         self._connect(self._ui.paste, "clicked", self._on_paste_previous)
         self._connect(
             self._ui.stanza_presets_listbox, "row-activated", 
self._on_row_activated
@@ -551,7 +560,7 @@ def _on_filter_options(self, _button: Gtk.Button) -> None:
     def _on_filter_destroyed(self, _widget: Gtk.Widget) -> None:
         self._filter_dialog = None
 
-    def _on_clear(self, _button: Gtk.Button) -> None:
+    def _on_clear_window(self, *args: Any) -> None:
         self._ui.protocol_view.get_buffer().set_text("")
 
     def _apply_filters(self) -> None:



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

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