Get rid of Vimish configuration autosave. It was a silly idea.
[WebThing.git] / plugins / Vimish.cs
index bcb1546..65490f8 100644 (file)
@@ -28,10 +28,6 @@ public class Vimish : WebThingPlugin {
         wv.KeyPressEvent += WebView_KeyPress;
     }
 
-    public override void Deinit(WebThing wt) {
-        SaveConfig();
-    }
-
     private void Window_KeyPress(object o, KeyPressEventArgs e) {
         if ((Gdk.ModifierType.ControlMask & e.Event.State) != 0) {
             switch(e.Event.Key) {
@@ -139,6 +135,25 @@ public class Vimish : WebThingPlugin {
                 Options[args[1]] = args[2];
             ApplyOptions();
             break;
+        case "save":
+            SaveConfig();
+            break;
+        default:
+            bool found;
+            if (args.Length > 1) {
+                string[] callargs = new string[args.Length - 1];
+                Array.Copy(args, 1, callargs, 0, args.Length - 1);
+                found = wt.Plugins.Call(args[0], callargs);
+                if (!found)
+                    Error("No function {0}({1}) found", args[0], String.Join(", ", callargs));
+            } else {
+                found = wt.Plugins.Call(args[0]);
+                if (!found)
+                    Error("No function {0}() found", args[0]);
+            }
+            if (found)
+                Console.WriteLine("Plugin function {0} called successfully", args[0]);
+            break;
         }
         CommandlineHide();
     }