using LAview, Core, Plugins, GObject.Plugins; extern const string GETTEXT_PACKAGE; namespace LAview.Core.Plugins { /** * Plugin of type A1. */ public class PluginObjectExample : PluginObject { ObjectExampleDialog object_dialog = null; ObjectExample.PreferencesDialog preferences_dialog = null; /** * Constructs a new ``PluginObjectExample``. */ construct { stdout.puts ("PluginObjectExample init () called\n"); ObjectExample.AppDirs.init (); } /** * Destroys the ``PluginObjectExample``. */ ~PluginObjectExample () { stdout.puts ("PluginObjectExample deinit () called\n"); } /** * Gets a name of the plugin. */ public override string get_name () { return "ProtObjEx"; } /** * Gets readable name of the plugin. */ public override string get_readable_name () { stdout.puts ("PluginObjectExample.get_readable_name () called\n"); stdout.puts ("Call IHostCore.get_cache_dir () from PluginObjectExample:\n "); var cache_dir = (host as IHostCore).get_cache_dir (); stdout.printf ("cache dir = %s\n", cache_dir); return _("Protocol Object Example"); } /** * Compose the object. */ public override bool compose (Object parent, Gee.HashMap answers) throws Error { if (object_dialog == null) object_dialog = new ObjectExampleDialog (parent); object_dialog.show_all (); PluginDataExample data_obj_ex = (host as IHostCore).get_data_object ("DataExample") as PluginDataExample; stdout.puts ("Compose() called\n"); foreach (var a in answers.entries) { switch (a.key) { case "MainChart": break; case "arr1d": if (a.value is AnswerArray1D) (a.value as AnswerArray1D).value = data_obj_ex.get_array1d_data (a.key); break; case "arr2d": if (a.value is AnswerArray2D) (a.value as AnswerArray2D).value = data_obj_ex.get_array2d_data (a.key); break; case "AnotherRequest": case "SampleRequest": case "Manual.SampleRequest": if (a.value is AnswerString) (a.value as AnswerString).value = data_obj_ex.get_string_data (a.key); break; default: break; } } return object_dialog.composed; } /** * Open Preferences. */ public override void preferences (Object parent) throws Error { if (preferences_dialog == null) preferences_dialog = new ObjectExample.PreferencesDialog (parent); preferences_dialog.show_all (); } } } [ModuleInit] Type plugin_init (GLib.TypeModule type_module) { stdout.puts ("---ModuleInit called()---\n"); return typeof (PluginObjectExample); }