close compose window on escape key
This commit is contained in:
parent
3aaa778194
commit
ab947c2fce
2 changed files with 7 additions and 0 deletions
|
@ -70,6 +70,7 @@ class Application(Gtk.Application):
|
|||
action = Gio.SimpleAction.new('preferences', None)
|
||||
action.connect('activate', self.on_preferences)
|
||||
self.add_action(action)
|
||||
# TODO: this shortcut might need adjustment
|
||||
self.set_accels_for_action('app.preferences',["<Ctrl>,"])
|
||||
|
||||
action = Gio.SimpleAction.new('about', None)
|
||||
|
|
|
@ -73,6 +73,12 @@ class ComposeWindow(Handy.Window):
|
|||
|
||||
self.show_all()
|
||||
|
||||
self.connect('key-release-event', self.on_key_release)
|
||||
|
||||
def on_key_release(self, widget, ev, data=None):
|
||||
if ev.keyval == Gdk.KEY_Escape:
|
||||
self.close()
|
||||
|
||||
def validate(self, widget):
|
||||
self.counter = self.max_length - self.buffer.get_char_count()
|
||||
self.counter_label.set_text(str(self.counter))
|
||||
|
|
Loading…
Reference in a new issue