[Xfce4-commits] <midori:master> Allow cancelling the History List with Escape
Christian Dywan
noreply at xfce.org
Tue May 3 21:40:02 CEST 2011
Updating branch refs/heads/master
to c7e70f68089989e8947c29300e6f4ee2dbe8b014 (commit)
from c370c0ab41d918fe117135c623b023d48c928c31 (commit)
commit c7e70f68089989e8947c29300e6f4ee2dbe8b014
Author: André Stösel <andre at stoesel.de>
Date: Tue May 3 20:24:39 2011 +0200
Allow cancelling the History List with Escape
Just like Alt+Tab.
extensions/history-list.vala | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/extensions/history-list.vala b/extensions/history-list.vala
index eb37627..acacae1 100644
--- a/extensions/history-list.vala
+++ b/extensions/history-list.vala
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2010 André Stösel <andre at stoesel.de>
+ Copyright (C) 2010-2011 André Stösel <andre at 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,13 +177,17 @@ 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 || event_key.keyval == this.escKeyval) {
+ browser.disconnect (this.tmp_sig_ids[0]);
+ browser.disconnect (this.tmp_sig_ids[1]);
if (this.modifier_count == 0) {
- browser.disconnect (this.tmp_sig_ids[0]);
- browser.disconnect (this.tmp_sig_ids[1]);
this.history_window.make_update ();
- this.history_window.destroy ();
- this.history_window = null;
+ } else {
+ this.modifier_count = 0;
}
+ this.history_window.destroy ();
+ this.history_window = null;
}
return false;
}
@@ -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 () {
More information about the Xfce4-commits
mailing list