JP Rosevear <jpr@arcavia.com>

This is a quick and dirty tutorial on creating a tool via a plugin.

* Step 1. Create the directory.

Copy the plugins/sample directory to a new directory, say plugins/mytool.

* Step 2. Set up the build process

Add mytool to the SUBDIR list in plugins/Makefile.am.  Next, open 
plugins/mytool/Makefile.am and change "plugin_LTLIBRARIES = libgide_sample.la"
to "plugin_LTLIBRARIES = libgide_mytool.la".  Then change 
"libgide_mytool_la_SOURCES = plugin-sample.c" to "libgide_mytool_la_SOURCES = 
plugin-mytool.c".  Next, copy plugin-sample.c to plugin-mytool.c.

* Step 3. Setup the plugin initialization

The init_plugin function is called when the plugin is loaded.  The following
lines are specific to your tool:

	tool = gI_tool_new( SAMPLE_NAME, (void *) hello_world);
	gI_tool_set_menu_data( TOOL(tool), hello_world_sens, 
			       "Tools/Sample/\"Hello, world!\"", NULL);
	gide_tool_add( TOOL(tool) );

The gI_tool_new function takes the tool name and callback function to 
implement the tool as parameters.  The callback function should take a Tool *
and ToolState * as arguments.  The gI_tool_set_menu_data function sets the menu
info for the tool.  It takes the tool, a sensitivity function and two menu 
paths, one for the main menu set and one for the popup menu.  The sensitivity
function also takes a Tool * and ToolState * as arguments and returns a boolean
indicating whether or not the menu item should be active.  The gide_tool_add
function adds the tool to the application wide list.

* Step 4. Setup the unloadability of the plugin

The can_unload function returns an indicator to the plugin-manager whether
or not the plugin can be unloaded, return 0 for no or 1 for yes.

* Step 5. Setup the plugin cleanup

The cleanup_plugin function is called when the plugin is unloaded. The
gide_tool_remove function removes the tool from the application wide list.





