| libswami Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
SwamiPluginInfo;
gboolean (*SwamiPluginInitFunc) (SwamiPlugin *plugin,
GError **err);
void (*SwamiPluginExitFunc) (SwamiPlugin *plugin);
gboolean (*SwamiPluginSaveXmlFunc) (SwamiPlugin *plugin,
GNode *xmlnode,
GError **err);
gboolean (*SwamiPluginLoadXmlFunc) (SwamiPlugin *plugin,
GNode *xmlnode,
GError **err);
SwamiPlugin;
#define SWAMI_PLUGIN_MAGIC
#define SWAMI_PLUGIN_INFO (init, exit)
void swami_plugin_add_path (const char *path);
void swami_plugin_load_all (void);
gboolean swami_plugin_load (const char *filename);
gboolean swami_plugin_load_absolute (const char *filename);
gboolean swami_plugin_load_plugin (SwamiPlugin *plugin);
gboolean swami_plugin_is_loaded (SwamiPlugin *plugin);
SwamiPlugin * swami_plugin_find (const char *name);
GList * swami_plugin_get_list (void);
gboolean swami_plugin_save_xml (SwamiPlugin *plugin,
GNode *xmlnode,
GError **err);
gboolean swami_plugin_load_xml (SwamiPlugin *plugin,
GNode *xmlnode,
GError **err);
"author" gchar* : Read / Write "copyright" gchar* : Read / Write "descr" gchar* : Read / Write "file-name" gchar* : Read "license" gchar* : Read / Write "loaded" gboolean : Read "module" gpointer : Read "name" gchar* : Read / Write "version" gchar* : Read / Write
typedef struct {
char magic[4]; /* magic string to ensure sanity */
char *swami_version; /* version of Swami plugin compiled for */
SwamiPluginInitFunc init; /* called to initialize plugin */
SwamiPluginExitFunc exit; /* called before plugin is unloaded */
} SwamiPluginInfo;
gboolean (*SwamiPluginInitFunc) (SwamiPlugin *plugin, GError **err);
A function type called after a plugin has been loaded.
|
Plugin object being loaded |
|
Location to store error information |
Returns : |
Should return TRUE on success, FALSE otherwise (err should be
set on failure).
|
void (*SwamiPluginExitFunc) (SwamiPlugin *plugin);
A function type called before a plugin is unloaded.
|
Plugin object being unloaded |
gboolean (*SwamiPluginSaveXmlFunc) (SwamiPlugin *plugin, GNode *xmlnode, GError **err);
An optional function type which is called to save a plugin's preference state to
an XML tree. The passed in xmlnode is an XML node created for this plugin.
|
Plugin object to save preference state of |
|
IpatchXmlNode tree to save preferences to |
|
Location to store error info to |
Returns : |
Should return TRUE on success, FALSE otherwise (in which case err
should be set).
|
gboolean (*SwamiPluginLoadXmlFunc) (SwamiPlugin *plugin, GNode *xmlnode, GError **err);
An optional function type which is called to load a plugin's preference state from
an XML tree. The passed in xmlnode is an XML node for this plugin.
|
Plugin object to load preference state to |
|
IpatchXmlNode tree to load preferences from |
|
Location to store error info to |
Returns : |
Should return TRUE on success, FALSE otherwise (in which case err
should be set).
|
void swami_plugin_add_path (const char *path);
Add a directory to the path searched for plugins.
|
The directory to add to the search path |
void swami_plugin_load_all (void);
Load all plugins in the plugin search path.
gboolean swami_plugin_load (const char *filename);
Load the named plugin. Name should be the plugin file name ("libplugin.so" on Linux for example).
|
File name of plugin to load |
Returns : |
Whether the plugin was loaded or not |
gboolean swami_plugin_load_absolute (const char *filename);
Load the named plugin. Name should be the full path and file name of the plugin to load.
|
Name of plugin to load |
Returns : |
whether the plugin was loaded or not |
gboolean swami_plugin_load_plugin (SwamiPlugin *plugin);
Load the given plugin.
|
The plugin to load |
Returns : |
TRUE on success (loaded or already loaded), FALSE otherwise
|
gboolean swami_plugin_is_loaded (SwamiPlugin *plugin);
Queries if the plugin is loaded into memory
|
Plugin to query |
Returns : |
TRUE is loaded, FALSE otherwise
|
SwamiPlugin * swami_plugin_find (const char *name);
Search the list of registered plugins for one with the given plugin name (not file name).
|
Name of plugin to find |
Returns : |
Pointer to the SwamiPlugin if found, NULL otherwise
|
GList * swami_plugin_get_list (void);
get the currently loaded plugins
Returns : |
a GList of SwamiPlugin elements which should be freed with g_list_free when finished with. |
gboolean swami_plugin_save_xml (SwamiPlugin *plugin, GNode *xmlnode, GError **err);
Save a plugin's preferences state to XML. Not all plugins implement this
method. Check if the xml_save field is set for plugin before calling, just
returns TRUE if not implemented.
|
Swami plugin |
|
XML node to save plugin state to |
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE otherwise (in which case err may be set)
|
gboolean swami_plugin_load_xml (SwamiPlugin *plugin, GNode *xmlnode, GError **err);
Load a plugin's preferences state from XML. Not all plugins implement this
method. Check if the xml_load field is set for plugin before calling, just
returns TRUE if not implemented.
|
Swami plugin |
|
XML node to load plugin state from |
|
Location to store error info or NULL to ignore
|
Returns : |
TRUE on success, FALSE otherwise (in which case err may be set)
|