zathura/plugin.h

106 lines
2.8 KiB
C
Raw Permalink Normal View History

2012-03-27 13:30:04 +02:00
/* See LICENSE file for license and copyright information */
#ifndef PLUGIN_H
#define PLUGIN_H
#include <girara/types.h>
#include <gmodule.h>
2012-03-27 13:30:04 +02:00
#include "types.h"
#include "plugin-api.h"
#include "version.h"
#include "zathura.h"
2012-04-28 21:26:10 +02:00
#define PLUGIN_REGISTER_FUNCTION "zathura_plugin_register"
#define PLUGIN_API_VERSION_FUNCTION "zathura_plugin_api_version"
#define PLUGIN_ABI_VERSION_FUNCTION "zathura_plugin_abi_version"
#define PLUGIN_VERSION_MAJOR_FUNCTION "zathura_plugin_version_major"
#define PLUGIN_VERSION_MINOR_FUNCTION "zathura_plugin_version_minor"
#define PLUGIN_VERSION_REVISION_FUNCTION "zathura_plugin_version_revision"
2012-03-27 13:30:04 +02:00
typedef struct zathura_plugin_version_s {
unsigned int major; /**< Major */
unsigned int minor; /**< Minor */
unsigned int rev; /**< Revision */
} zathura_plugin_version_t;
2012-03-27 13:30:04 +02:00
/**
2012-04-01 18:32:16 +02:00
* Creates a new instance of the plugin manager
2012-03-27 13:30:04 +02:00
*
2012-04-01 18:32:16 +02:00
* @return A plugin manager object or NULL if an error occured
2012-03-27 13:30:04 +02:00
*/
2012-04-01 18:32:16 +02:00
zathura_plugin_manager_t* zathura_plugin_manager_new();
2012-03-27 13:30:04 +02:00
/**
* Frees the plugin manager
*
* @param plugin_manager
*/
void zathura_plugin_manager_free(zathura_plugin_manager_t* plugin_manager);
2012-03-27 13:30:04 +02:00
/**
2012-04-01 18:32:16 +02:00
* Adds a plugin directory to the plugin manager
2012-03-27 13:30:04 +02:00
*
2012-04-01 18:32:16 +02:00
* @param plugin_manager The plugin manager
* @param dir Path to a directory with plugins
2012-03-27 13:30:04 +02:00
*/
2012-04-01 18:32:16 +02:00
void zathura_plugin_manager_add_dir(zathura_plugin_manager_t* plugin_manager, const char* dir);
2012-03-27 13:30:04 +02:00
/**
2012-04-01 18:32:16 +02:00
* Loads all plugins available in the previously given directories
2012-03-27 13:30:04 +02:00
*
2012-04-01 18:32:16 +02:00
* @param plugin_manager The plugin manager
2012-03-27 13:30:04 +02:00
*/
2012-04-01 18:32:16 +02:00
void zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
2012-03-27 13:30:04 +02:00
/**
2012-04-01 18:32:16 +02:00
* Returns the (if available) associated plugin
2012-03-27 13:30:04 +02:00
*
2012-04-01 18:32:16 +02:00
* @param plugin_manager The plugin manager
* @param type The document type
* @return The plugin or NULL if no matching plugin is available
2012-03-27 13:30:04 +02:00
*/
2012-04-01 18:32:16 +02:00
zathura_plugin_t* zathura_plugin_manager_get_plugin(zathura_plugin_manager_t* plugin_manager, const char* type);
2012-03-27 13:30:04 +02:00
/**
* Returns a list with the plugin objects
2012-03-27 13:30:04 +02:00
*
* @param plugin_manager The plugin manager
* @return List of plugins or NULL
2012-03-27 13:30:04 +02:00
*/
girara_list_t* zathura_plugin_manager_get_plugins(zathura_plugin_manager_t* plugin_manager);
2012-03-27 13:30:04 +02:00
/**
* Returns the plugin functions
*
* @param plugin The plugin
* @return The plugin functions
2012-03-27 13:30:04 +02:00
*/
zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
2012-04-01 18:32:16 +02:00
/**
* Returns the name of the plugin
2012-04-01 18:32:16 +02:00
*
* @param plugin The plugin
* @return The name of the plugin or NULL
2012-04-01 18:32:16 +02:00
*/
char* zathura_plugin_get_name(zathura_plugin_t* plugin);
2012-04-01 18:32:16 +02:00
/**
* Returns the path to the plugin
2012-04-01 18:32:16 +02:00
*
* @param plugin The plugin
* @return The path of the plugin or NULL
2012-04-01 18:32:16 +02:00
*/
char* zathura_plugin_get_path(zathura_plugin_t* plugin);
2012-03-27 13:30:04 +02:00
/**
* Returns the version information of the plugin
2012-04-01 18:32:16 +02:00
*
* @param plugin The plugin
* @return The version information of the plugin
2012-03-27 13:30:04 +02:00
*/
zathura_plugin_version_t zathura_plugin_get_version(zathura_plugin_t* plugin);
2012-03-27 13:30:04 +02:00
#endif // PLUGIN_H