[gedit/gnome-3-2] Clear the tools accel entry on backspace
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-2] Clear the tools accel entry on backspace
- Date: Sat, 3 Dec 2011 10:40:56 +0000 (UTC)
commit 530dd13f593a8525fb832a71628fbe0c6d6748bb
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Dec 3 11:27:18 2011 +0100
Clear the tools accel entry on backspace
To intercept backspace we need to connect to the backspace signal.
Fixes bug #659656
plugins/externaltools/tools/manager.py | 14 +++++++-------
plugins/externaltools/tools/tools.ui | 1 +
2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index d94f5f5..bead7ba 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -287,6 +287,7 @@ class Manager:
'on_accelerator_key_press' : self.on_accelerator_key_press,
'on_accelerator_focus_in' : self.on_accelerator_focus_in,
'on_accelerator_focus_out' : self.on_accelerator_focus_out,
+ 'on_accelerator_backspace' : self.on_accelerator_backspace,
'on_languages_button_clicked' : self.on_languages_button_clicked
}
@@ -801,13 +802,6 @@ class Manager:
entry.set_text(default(self.current_node.shortcut, ''))
self['commands'].grab_focus()
return True
- elif event.keyval == Gdk.KEY_Delete \
- or event.keyval == Gdk.KEY_BackSpace:
- entry.set_text('')
- self.remove_accelerator(self.current_node)
- self.current_node.shortcut = None
- self['commands'].grab_focus()
- return True
elif event.keyval in range(Gdk.KEY_F1, Gdk.KEY_F12 + 1):
# New accelerator
if self.set_accelerator(event.keyval, mask):
@@ -840,6 +834,12 @@ class Manager:
entry.set_text(default(self.current_node.shortcut, ''))
self.tool_changed(self.current_node)
+ def on_accelerator_backspace(self, entry):
+ entry.set_text('')
+ self.remove_accelerator(self.current_node)
+ self.current_node.shortcut = None
+ self['commands'].grab_focus()
+
def on_tool_manager_dialog_response(self, dialog, response):
if response == Gtk.ResponseType.HELP:
Gedit.App.get_default().show_help(self.dialog, 'gedit', 'gedit-plugins-external-tools')
diff --git a/plugins/externaltools/tools/tools.ui b/plugins/externaltools/tools/tools.ui
index c6aad43..8b6e072 100644
--- a/plugins/externaltools/tools/tools.ui
+++ b/plugins/externaltools/tools/tools.ui
@@ -384,6 +384,7 @@
<signal name="key-press-event" handler="on_accelerator_key_press" swapped="no"/>
<signal name="focus-out-event" handler="on_accelerator_focus_out" swapped="no"/>
<signal name="focus-in-event" handler="on_accelerator_focus_in" swapped="no"/>
+ <signal name="backspace" handler="on_accelerator_backspace" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]