Plugin Development
~~~~~~~~~~~~~~~~~~

Here is an outline of the Plugin Writing process. Hopefully I will be able to
write a more extensive document when I get time.

Step 1) #include "../emelfm.h"  <- You need this to get access to all the 
                                   functions and data structures of emelFM

Step 2) Write the function that does what you want your plugin to do when
        activated. For example, if you want a plugin that prints "Hello World",
        then you would write this function.

void hello_world()
{
  status_message("Hello World\n");
}

* The restricions for this function are that it must return void and can take
  no parameters.

Step 3) Write an init_plugin function something like this:

gint init_plugin(Plugin *p)
{
  p->name = "Hello World";
  p->description = "Prints \"Hello World\" on the output window.";
  p->plugin_cb = hello_world; /* This is whatever you named the function */
                              /* in Step 2                               */
  return TRUE;
}

* This function *must* be called init_plugin, take a Plugin * argument, and 
  return gint.

Step 4) If your plugin needs any cleaning up when it is unloaded you can
        *optionally* implement an unload_plugin function as follows:

void unload_plugin(Plugin *p)
{
  status_message("I'm being unloaded\n");
}

* This function *must* be called unload_plugin, take a Plugin * argument, and
  return void.

Step 5) Add your plugin to the "OBJS = " line in the Makfile. For example, if
        the source file for your plugin is hello_world.c, then you would add
        hello_world.so to the "OBJS = " list in the Makefile.


emelFM Internals
~~~~~~~~~~~~~~~~

There are four major data structures that you will probably need to understand.

FileView:
The backbone of emelFM is the FileView structure. These structures hold
everything that makes up the two panels in the interface.

FileInfo:
This is a simple data structure that corresponds to a single row in the panel
file list. They contain two fields, the filename and a stat struct that holds
the information retrieved from calling lstat on the file.

App:
The App data structure encompasses the entire user interface of emelFM. It 
includes two FileView objects, corresponding to the right and left panels, and
numerous GtkWidget objects needed for the interface.

Config:
The Config data structure holds all the configuration information including
filetypes, bookmarks, plugins, etc.

When emelFM is started it creates a global App object called 'app' and a global
Config object called 'cfg'. It then creates two pointers to FileView objects
called 'curr_view' and 'other_view'. At any given time 'curr_view' will point
to the panel that currently has focus and 'other_view' will point to the other
panel.

Important functions:

GList *get_selection(FileView *view);

This will return a GList of FileInfo objects coresponding to the files selected
(or tagged) in the panel corresponding to view. For example if you called
get_selection(curr_view) it would return the selected files in the active
panel. There are numerous examples in the source of how to use the GList
returned by this function.

