// $Id$ For a question, send an email to: Georges.Silber@ens-lyon.fr List of topics: --------------- 1) How to write a plugin for GTK Nestor? ------------------------------------------------------------------------------ Q: How to write a plugin for GTK Nestor? A: The first thing to do is to create a directory in src/plugins with any name you want. Second, copy the Makefile of one of the existing directories under src/plugins, for instance the one under src/plugins/test_plug. A plugin MUST have two functions called plugin_init() and plugin_run(). The first tells gtknestor the name of the plugin, the description, etc... The file src/plugins/test_plug/test_plug.cc gives a good example of a plugin_init() function. For the second function, the first thing to do is to get the tree from the arglist. The tree is the node of the structure that gtknestor passes to the plugin. This is done with the function plug_get_tree(). Then, you can get an optional name for a report file with the function plug_get_report(). Now it is up to you. You can modify the tree, add new things to it, etc... Finally, you must tell gtknestor whether you modified the tree or not. With the method plug_set_tree() you can set the point where the internal structure must be redisplayed by gtknestor (it can be different than the original tree that you get). If you do not set the result tree, gtknestor will assume that you do not modify the tree. Optionally, you can say whether you want the report to be displayed or not by using plug_set_tree(). Example: int plugin_run(struct arglist * args) { NstTree* tree = plug_get_tree(args); char* report_file = plug_get_report(args); // Here, it's up to you. plug_set_report(args, report_file); plug_set_tree(args, tree); return 0; } To compile your plugin, just type 'make' in the main directory of Nestor. You can now test your plugin with 'gtknestor'. ------------------------------------------------------------------------------