| libhildondesktop Reference Manual | ||||
|---|---|---|---|---|
#include <libhildondesktop/libhildondesktop.h>
HDPluginManager;
HDPluginManager* hd_plugin_manager_new (HDConfigFile *config_file);
void hd_plugin_manager_run (HDPluginManager *manager);
GKeyFile* hd_plugin_manager_get_plugin_config_key_file
(HDPluginManager *manager);
guint (*HDLoadPriorityFunc) (const gchar *plugin_id,
GKeyFile *keyfile,
gpointer data);
void hd_plugin_manager_set_load_priority_func
(HDPluginManager *manager,
HDLoadPriorityFunc load_priority_func,
gpointer data,
GDestroyNotify destroy);
A HDPluginManager manages plugins defined in configuration files.
The configuration is read from the configuration file specified on creation of the HDPluginManager instance.
To use the HDPluginManager connect to the "plugin-added" and "plugin-removed" signals. These signals are emitted if a plugin should be added or removed from the application.
Calling hd_plugin_manager_run() results in an initial read of the configuration files
in which the "plugin-added" is emitted for each plugin which
is loaded.
HDPluginManager* hd_plugin_manager_new (HDConfigFile *config_file);
This function creates a new HDPluginManager instance.
config_file : |
a HDConfigFile which specify the configuration file. |
| Returns : | a new HDPluginManager instance. |
void hd_plugin_manager_run (HDPluginManager *manager);
This function should be called after the callback signals
are connected to manager. It does an initial read of the configuration
files, loads the plugins according to the configuration and emits the
appropiate callback signals.
manager : |
a HDPluginManager |
GKeyFile* hd_plugin_manager_get_plugin_config_key_file
(HDPluginManager *manager);
This function can be used in the HDPluginManager::plugin-added and HDPluginManager::plugin-configuration-loaded to get a reference of the plugin configuration key file.
manager : |
a HDPluginManager |
| Returns : | a reference to the plugin configuration key file. It is owned by the manager and must not be freed. |
guint (*HDLoadPriorityFunc) (const gchar *plugin_id,
GKeyFile *keyfile,
gpointer data);
plugin_id : |
|
keyfile : |
|
data : |
|
| Returns : |
void hd_plugin_manager_set_load_priority_func
(HDPluginManager *manager,
HDLoadPriorityFunc load_priority_func,
gpointer data,
GDestroyNotify destroy);
This function allows it to specify a function which calculates the priority in which plugins
are loaded. The lower the unsigned integer returned by load_priority_func is the earlier
the plugin is loaded.
manager : |
a HDPluginManager |
load_priority_func : |
a HDLoadPriorityFunc which should be used to calculate the load priority of a plugin |
data : |
data which is passed to load_priority_func
|
destroy : |
function to call when data should be destroyed
|
"plugin-added" signalvoid user_function (HDPluginManager *manager, GObject *plugin, gpointer user_data) : Run First
Emitted if a new plugin instance is created (loaded).
manager : |
a HDPluginManager. |
plugin : |
the new plugin. |
user_data : |
user data set when the signal handler was connected. |
"plugin-removed" signalvoid user_function (HDPluginManager *manager, GObject *plugin, gpointer user_data) : Run Last
Emitted if a plugin instance is removed.
manager : |
a HDPluginManager. |
plugin : |
the plugin. |
user_data : |
user data set when the signal handler was connected. |