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.
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.
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.
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.
gboolean swami_plugin_is_loaded (SwamiPlugin *plugin
);
Queries if the plugin is loaded into memory
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.
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.