Next Previous Contents

4. Examples

4.1 Available plugins

Simplemusic

Simplemusic, as the name suggests, is a very simple plugin that plays music files. It exposes a simplemusic object that you can use in scripts, and uses the SDL_mixer library to do the playing (thus it supports MP3, OGG, MOD etc.). It also demonstrates how easy it is to make a plugin. See simplemusic.txt and simplemusic.c in plugins/simplemusic for more information.

Filebrowser

Filebrowser is another simple plugin that operates in conjunction with a listbox widget in order to display a list of files for the user to select from. Filebrowser automates the listbox so that selecting a directory browses into that directory, and selecting a file generates an event. See filebrowser.txt and filebrowser.c in plugins/filebrowser for more information.

TestBench

The testbench plugin is a good example of creating widgets at runtime, and also serves to explore the properties available for various different types of widget. This plugin is available for download separately from the eboxy homepage.

Others

You can check out the the latest version of all other plugins not supplied with eboxy itself (at least those distributed by me) from the eboxy CVS repository. The module you need to check out is eboxy-plugins. Once they are a bit more polished these will also be available from the eboxy homepage.

4.2 Plugin skeleton code

Here is a skeleton plugin, containing the bare minimum of code (fill in where appropriate):

#include "eboxyplugin.h"
#include "pluginconstants.h"

int ebplugin_init(void) {
  /* Change these two strings to whatever you want for your plugin (name and
   * version)
   */
  setPluginInfo("my plugin", "1.0");

  /* Do anything else here that you need to do to initialise your plugin
   * Note: if your own initialisation stuff fails here, you should return
   * a non-zero value.
   */

  return 0;     /* returning 0 means plugin has successfully initialised */
}

int ebplugin_message(int msgcode, void *msgdata) {
  /* If your plugin looks for objects on the current page, you should check
   * here for when the current page/file is changed. This will also be called
   * under other circumstances (see pluginconstants.h for values of msgcode)
   */
  return 0;     /* return 0 here for future compatibility */
}

void ebplugin_deinit(void) {
  /* Any cleanup code you need for your plugin goes here */
}


Next Previous Contents