![]() |
![]() |
![]() |
Ethos Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#define ETHOS_PLUGIN_INFO_CONST (obj) struct EthosPluginInfo; struct EthosPluginInfoClass; gboolean ethos_plugin_info_get_active (EthosPluginInfo *plugin_info
); gchar ** ethos_plugin_info_get_authors (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_copyright (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_dependencies (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_description (EthosPluginInfo *plugin_info
); GList * ethos_plugin_info_get_errors (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_filename (EthosPluginInfo *plugin_info
); guint ethos_plugin_info_get_iage (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_icon_name (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_id (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_loader (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_module (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_name (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_version (EthosPluginInfo *plugin_info
); const gchar * ethos_plugin_info_get_website (EthosPluginInfo *plugin_info
); gboolean ethos_plugin_info_has_errors (EthosPluginInfo *plugin_info
); gboolean ethos_plugin_info_load_from_data (EthosPluginInfo *plugin_info
,const gchar *group
,const gchar *data
,gsize length
,GError **error
); gboolean ethos_plugin_info_load_from_file (EthosPluginInfo *plugin_info
,const gchar *group
,const gchar *filename
,GError **error
); gboolean ethos_plugin_info_load_from_key_file (EthosPluginInfo *plugin_info
,const gchar *group
,GKeyFile *key_file
,GError **error
); EthosPluginInfo * ethos_plugin_info_new (void
); void ethos_plugin_info_set_active (EthosPluginInfo *plugin_info
,gboolean active
); void ethos_plugin_info_set_filename (EthosPluginInfo *plugin_info
,const gchar *filename
); void ethos_plugin_info_set_id (EthosPluginInfo *plugin_info
,const gchar *id
);
"active" gboolean : Read "authors" GStrv : Read "copyright" gchar* : Read "dependencies" gchar* : Read "description" gchar* : Read "filename" gchar* : Read / Write "icon-name" gchar* : Read "id" gchar* : Read / Write "loader" gchar* : Read "module" gchar* : Read "name" gchar* : Read "version" gchar* : Read "website" gchar* : Read
EthosPluginInfo encapsulates information about a plugin during runtime. The data for an EthosPluginInfo is read from a plugin description file such as "my-plugin.example-plugin". This includes information about the plugin module to load, what EthosPluginLoader should be used, the author, description, and the icon for the plugin.
The naming of the plugin description files is derived from the name of the application or
the name set using ethos_manager_set_app_name()
. It is all lowercase and is named such as
"name.appname-plugin" where appname is lowercase. Therfore, if the application was named
"Marina" and the plugin was named "foo", an apt name for the description file would be
"foo.marina-plugin".
The plugin description file consists of a simple GKeyFile format. The header for key-file is also derived from the application name. Therefore, if the application was named "Marina", the header for the key file would be "[Marina Plugin]".
A plugin for an application named "Sample" may look like:
# example.sample-plugin [Sample Plugin] Name=Example Loader=python Module=example IAge=1 Authors=Foo;Bar;Baz Copyright=MIT X11 Website=http://example.com
#define ETHOS_PLUGIN_INFO_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ETHOS_TYPE_PLUGIN_INFO, EthosPluginInfo const))
struct EthosPluginInfoClass { GObjectClass parent_class; void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); void (*reserved4) (void); };
gboolean ethos_plugin_info_get_active (EthosPluginInfo *plugin_info
);
Retrieves whether or not the plugin is currently activated.
|
An EthosPluginInfo |
Returns : |
TRUE if the plugin is currently active |
gchar ** ethos_plugin_info_get_authors (EthosPluginInfo *plugin_info
);
Retreives the authors of the plugin.
|
An EthosPluginInfo |
Returns : |
A NULL terminated array of strings that contain the authors.
This value should not be modified or freed. |
const gchar * ethos_plugin_info_get_copyright (EthosPluginInfo *plugin_info
);
Retrieves the copyright of the plugin
|
An EthosPluginInfo |
Returns : |
A string containing the copyright. The string should not be modified or freed. |
const gchar * ethos_plugin_info_get_dependencies (EthosPluginInfo *plugin_info
);
Retrieves the list of dependencies as a string. The string is a set of checks that must pass before the plugin can be loaded.
Such as:
"network >= 0.1 xmpp"
Would require the network plugin 0.1 or greater and any version of the xmpp plugin.
|
An EthosPluginInfo |
Returns : |
A string containing the dependencies or NULL . |
const gchar * ethos_plugin_info_get_description (EthosPluginInfo *plugin_info
);
Retrieves the description of the plugin
|
An EthosPluginInfo |
Returns : |
A string containing the description. The string should not be modified or freed. |
GList * ethos_plugin_info_get_errors (EthosPluginInfo *plugin_info
);
Retrieves a list of errors that occurred while trying to load the
plugin. If no errors have occurred, NULL is returned. The list
is a copy however the GErrors contained are not. You should
free the list with g_list_free()
.
|
An EthosPluginInfo |
Returns : |
A GList containing GErrors that should be freed
with g_list_free() . |
const gchar * ethos_plugin_info_get_filename (EthosPluginInfo *plugin_info
);
Retreives the filename that was used to load the plugin_info
.
|
An EthosPluginInfo |
Returns : |
A string or NULL
|
guint ethos_plugin_info_get_iage (EthosPluginInfo *plugin_info
);
Retreives the interface age that the plugin conforms to.
|
An EthosPluginInfo |
Returns : |
a guint containing the age. |
const gchar * ethos_plugin_info_get_icon_name (EthosPluginInfo *plugin_info
);
Retrieves the icon field for the EthosPluginInfo
|
An EthosPluginInfo |
Returns : |
A string containing the icon name or NULL . This value
should not be modified or freed. |
const gchar * ethos_plugin_info_get_id (EthosPluginInfo *plugin_info
);
Retreives the unique id of the plugin.
|
An EthosPluginInfo |
Returns : |
The unique id of the plugin which should not be modified or freed. |
const gchar * ethos_plugin_info_get_loader (EthosPluginInfo *plugin_info
);
Retrieves the name of the EthosPluginLoader that should load the plugin.
|
An EthosPluginInfo |
Returns : |
The loader to use to load the plugin. This value should not be modified or freed. |
const gchar * ethos_plugin_info_get_module (EthosPluginInfo *plugin_info
);
Retreives the module that implements an EthosPlugin.
|
An EthosPluginInfo |
Returns : |
The module of the plugin. This value should not be modified or freed. |
const gchar * ethos_plugin_info_get_name (EthosPluginInfo *plugin_info
);
Retrieves the name of the plugin.
|
An EthosPluginInfo |
Returns : |
The name of the plugin. This value should not be freed or modified. |
const gchar * ethos_plugin_info_get_version (EthosPluginInfo *plugin_info
);
Retrieves the version of the plugin
|
An EthosPluginInfo |
Returns : |
the version of the plugin |
const gchar * ethos_plugin_info_get_website (EthosPluginInfo *plugin_info
);
Retrieves the website url of the plugin
|
An EthosPluginInfo |
Returns : |
A string containing the website. The string should not be modified or freed. |
gboolean ethos_plugin_info_has_errors (EthosPluginInfo *plugin_info
);
Checks whether or not the plugin has had any errors.
|
An EthosPluginInfo |
Returns : |
TRUE if the plugin had an error loading. |
gboolean ethos_plugin_info_load_from_data (EthosPluginInfo *plugin_info
,const gchar *group
,const gchar *data
,gsize length
,GError **error
);
Loads the plugin information from a buffer of information. The data should be in GKeyFile format.
|
A EthosPluginInfo |
|
the group to load information from |
|
a buffer of data |
|
length of buffer to use |
|
A location for a GError or NULL
|
Returns : |
TRUE on success. error is set on failure. |
gboolean ethos_plugin_info_load_from_file (EthosPluginInfo *plugin_info
,const gchar *group
,const gchar *filename
,GError **error
);
Loads the plugin information found within filename
. If there is an
error, FALSE
is returned and error
will be set.
|
An EthosPluginInfo |
|
the keyfile group to extract information from |
|
A path to the file containing the plugin info |
|
A location for a GError or NULL
|
Returns : |
TRUE if the data was loaded successfully |
gboolean ethos_plugin_info_load_from_key_file (EthosPluginInfo *plugin_info
,const gchar *group
,GKeyFile *key_file
,GError **error
);
Loads the plugin information from key_file
. The information is loaded from the group named
group
within the keyfile. Therfore, if group
where "Sample Plugin" then the keyfile should
have a group header such as "[Sample Plugin]" within it.
Upon failure, error
is set and FALSE
is returned.
|
An EthosPluginInfo |
|
the name of the group to load |
|
A GKeyFile |
|
A location for a GError or NULL
|
Returns : |
TRUE on success |
EthosPluginInfo * ethos_plugin_info_new (void
);
Creates a new EthosPluginInfo instance.
Returns : |
The newly created EthosPluginInfo instance. |
void ethos_plugin_info_set_active (EthosPluginInfo *plugin_info
,gboolean active
);
Set the active status of the EthosPluginInfo. This is useful so that gui front-ends can keep track if the plugin is currently in use.
|
An EthosPluginInfo |
|
if the EthosPluginInfo is active |
void ethos_plugin_info_set_filename (EthosPluginInfo *plugin_info
,const gchar *filename
);
Sets the filename used to load the plugin-info.
|
An EthosPluginInfo |
|
The filename |
void ethos_plugin_info_set_id (EthosPluginInfo *plugin_info
,const gchar *id
);
Sets the id of the plugin. This is typically taking from the filename of the description file.
|
An EthosPluginInfo |
|
the id of the plugin |
"active"
property "active" gboolean : Read
Whether or not the plugin is currently loaded.
Default value: FALSE
"authors"
property "authors" GStrv : Read
The list of authors that have contributed to the plugin.
"copyright"
property "copyright" gchar* : Read
The copyright the plugin is released under such as "GPL-2".
Default value: NULL
"dependencies"
property "dependencies" gchar* : Read
Dependencies that must be loaded for the plugin to load. See
ethos_plugin_info_get_dependencies()
.
Default value: NULL
"description"
property "description" gchar* : Read
A short description of the plugin.
Default value: NULL
"filename"
property "filename" gchar* : Read / Write
The filename that was used to load the plugin.
Default value: NULL
"icon-name"
property "icon-name" gchar* : Read
The name of the icon to display in the manager widgets.
Default value: NULL
"loader"
property "loader" gchar* : Read
The name of the EthosPluginLoader that should be used to load the plugin.
Default value: NULL
"module"
property "module" gchar* : Read
The name of the module that should be used to load the plugin.
Default value: NULL
"version"
property "version" gchar* : Read
The version of the plugin. See ethos_plugin_info_get_version()
.
Default value: NULL
"loaded"
signalvoid user_function (EthosPluginInfo *plugin_info,
gpointer user_data) : Run First
Signal emitted when a new plugin is loaded.
|
An EthosPluginInfo |
|
user data set when the signal handler was connected. |
"unloaded"
signalvoid user_function (EthosPluginInfo *plugin_info,
gpointer user_data) : Run First
Signal emitted when the plugin is unloaded.
|
An EthosPluginInfo |
|
user data set when the signal handler was connected. |