Commit 530dd13f authored by Paolo Borelli's avatar Paolo Borelli

Clear the tools accel entry on backspace

To intercept backspace we need to connect to the backspace signal.
Fixes bug #659656
parent 2924e322
......@@ -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')
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment