X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=plugins%2FVimish.cs;h=27543eeadb0f15569eaefe7cb1c34f1150a9633b;hb=02acfc22dbfa3d145d265157fdf616a950fa30c6;hp=968fae901eff31a325468e02a88389e9db63b38a;hpb=84890340eccbe66e303780a992fe152356974394;p=WebThing.git diff --git a/plugins/Vimish.cs b/plugins/Vimish.cs index 968fae9..27543ee 100644 --- a/plugins/Vimish.cs +++ b/plugins/Vimish.cs @@ -28,6 +28,10 @@ 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) { @@ -135,6 +139,22 @@ public class Vimish : WebThingPlugin { Options[args[1]] = args[2]; ApplyOptions(); 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(); } @@ -143,7 +163,7 @@ public class Vimish : WebThingPlugin { foreach (string key in Options.Keys) { switch(key) { case "ShowTabs": - bool v = ParseBool(Options[key]); + bool v = Config.ParseBool(Options[key]); wt.Tabs.ShowTabs = v; break; default: @@ -153,18 +173,6 @@ public class Vimish : WebThingPlugin { } } - private bool ParseBool(string v) { - switch(v.ToLower()) { - case "true": - case "t": - case "1": - case "on": - case "yes": - return true; - } - return false; - } - private void Error(string format, params object[] values) { Console.WriteLine(format, values); }