Getting useful...
[WebThing.git] / plugins / FFNav.cs
diff --git a/plugins/FFNav.cs b/plugins/FFNav.cs
new file mode 100644 (file)
index 0000000..1a3145c
--- /dev/null
@@ -0,0 +1,31 @@
+using System;
+using Gtk;
+using bytex64.WebThing;
+
+public class Plugin {
+       WebThing wt;
+
+       public Plugin(WebThing wt) {
+               this.wt = wt;
+               wt.WebView.KeyPressEvent += WebView_KeyPress;
+       }
+
+       private void WebView_KeyPress(object o, KeyPressEventArgs e) {
+               if ((e.Event.State & Gdk.ModifierType.Mod1Mask) != 0) {
+                       switch(e.Event.Key) {
+                       case Gdk.Key.Left:
+                               wt.WebView.GoBack();
+                               break;
+                       case Gdk.Key.Right:
+                               wt.WebView.GoForward();
+                               break;
+                       }
+               } else {
+                       switch(e.Event.Key) {
+                       case Gdk.Key.BackSpace:
+                               wt.WebView.GoBack();
+                               break;
+                       }
+               }
+       }
+}