Hide tabs by default, add code to Vimish to show/hide tabs
authorChip Black <bytex64@bytex64.net>
Fri, 5 Jun 2009 07:05:51 +0000 (02:05 -0500)
committerChip Black <bytex64@bytex64.net>
Fri, 5 Jun 2009 07:05:51 +0000 (02:05 -0500)
WebThing.cs
plugins/Vimish.cs

index 7855ae3..5e4ca34 100644 (file)
@@ -90,6 +90,7 @@ namespace bytex64.WebThing {
             _Window.Add(WidgetGrid);
 
             _Tabs = new Gtk.Notebook();
+            _Tabs.ShowBorder = false;
             _Tabs.SwitchPage += Tabs_SwitchPage;
             WidgetGrid.Attach(_Tabs, 1, 2, 1, 2);
 
index 8de862a..0b699d8 100644 (file)
@@ -10,6 +10,7 @@ public class Vimish : WebThingPlugin {
 
     public override void Init(WebThing wt) {
         this.wt = wt;
+        wt.Tabs.ShowTabs = false;
 
         wt.Window.KeyPressEvent += Window_KeyPress;
 
@@ -30,9 +31,15 @@ public class Vimish : WebThingPlugin {
         case Gdk.Key.o:
             CommandStart("open ");
             break;
+        case Gdk.Key.O:
+            CommandStart("open " + wt.WebView.MainFrame.Uri);
+            break;
         case Gdk.Key.t:
             CommandStart("tabopen ");
             break;
+        case Gdk.Key.T:
+            CommandStart("tabopen " + wt.WebView.MainFrame.Uri);
+            break;
         case Gdk.Key.colon:
             CommandlineShow();
             break;
@@ -115,10 +122,34 @@ public class Vimish : WebThingPlugin {
         case "q":
             wt.Quit();
             break;
+        case "set":
+            if (args.Length == 2)
+                SetVar(args[1], "");
+            else
+                SetVar(args[1], args[2]);
+            break;
         }
         CommandlineHide();
     }
 
+    public void SetVar(string key, string val) {
+        switch(key) {
+        case "showtabs":
+            wt.Tabs.ShowTabs = true;
+            break;
+        case "hidetabs":
+            wt.Tabs.ShowTabs = false;
+            break;
+        default:
+            Error("No variable {0}", key);
+            break;
+        }
+    }
+
+    private void Error(string format, params object[] values) {
+        Console.WriteLine(format, values);
+    }
+
     private void command_KeyPress(object o, KeyPressEventArgs e) {
         if (e.Event.Key == Gdk.Key.Escape)
             CommandlineHide();