Allow cancelling the History List with Escape

Just like Alt+Tab.
This commit is contained in:
André Stösel 2011-05-03 20:24:39 +02:00 committed by Christian Dywan
parent c370c0ab41
commit c7e70f6808

View file

@ -1,5 +1,5 @@
/*
Copyright (C) 2010 André Stösel <andre@stoesel.de>
Copyright (C) 2010-2011 André Stösel <andre@stoesel.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -164,6 +164,7 @@ private class NewTabWindow : TabWindow {
}
private class HistoryList : Midori.Extension {
protected uint escKeyval;
protected uint modifier_count;
protected HistoryWindow? history_window;
protected ulong[] tmp_sig_ids = new ulong[2];
@ -176,14 +177,18 @@ private class HistoryList : Midori.Extension {
public bool key_release (Gdk.EventKey event_key, Browser browser) {
if (event_key.is_modifier > 0) {
this.modifier_count--;
if (this.modifier_count == 0) {
}
if (this.modifier_count == 0 || event_key.keyval == this.escKeyval) {
browser.disconnect (this.tmp_sig_ids[0]);
browser.disconnect (this.tmp_sig_ids[1]);
if (this.modifier_count == 0) {
this.history_window.make_update ();
} else {
this.modifier_count = 0;
}
this.history_window.destroy ();
this.history_window = null;
}
}
return false;
}
public void walk (Gtk.Action action, Browser browser, Type type, int step) {
@ -358,6 +363,9 @@ private class HistoryList : Midori.Extension {
activate.connect (activated);
deactivate.connect (deactivated);
}
construct {
this.escKeyval = Gdk.keyval_from_name ("Escape");
}
}
public Midori.Extension extension_init () {