plugin.h 2.25 KB
Newer Older
1
/* SPDX-License-Identifier: Zlib */
2 3 4 5 6

#ifndef PLUGIN_H
#define PLUGIN_H

#include <girara/types.h>
7
#include <gmodule.h>
8 9 10

#include "types.h"
#include "plugin-api.h"
11
#include "zathura-version.h"
12 13 14
#include "zathura.h"

/**
Moritz Lipp's avatar
Moritz Lipp committed
15
 * Creates a new instance of the plugin manager
16
 *
17
 * @return A plugin manager object or NULL if an error occurred
18
 */
Sebastian Ramacher's avatar
Sebastian Ramacher committed
19
zathura_plugin_manager_t* zathura_plugin_manager_new(void);
20

21 22 23 24 25 26 27
/**
 * Frees the plugin manager
 *
 * @param plugin_manager
 */
void zathura_plugin_manager_free(zathura_plugin_manager_t* plugin_manager);

28
/**
Moritz Lipp's avatar
Moritz Lipp committed
29
 * Adds a plugin directory to the plugin manager
30
 *
Moritz Lipp's avatar
Moritz Lipp committed
31 32
 * @param plugin_manager The plugin manager
 * @param dir Path to a directory with plugins
33
 */
Moritz Lipp's avatar
Moritz Lipp committed
34
void zathura_plugin_manager_add_dir(zathura_plugin_manager_t* plugin_manager, const char* dir);
35 36

/**
Moritz Lipp's avatar
Moritz Lipp committed
37
 * Loads all plugins available in the previously given directories
38
 *
Moritz Lipp's avatar
Moritz Lipp committed
39
 * @param plugin_manager The plugin manager
40
 */
Moritz Lipp's avatar
Moritz Lipp committed
41
void zathura_plugin_manager_load(zathura_plugin_manager_t* plugin_manager);
42 43

/**
Moritz Lipp's avatar
Moritz Lipp committed
44
 * Returns the (if available) associated plugin
45
 *
Moritz Lipp's avatar
Moritz Lipp committed
46 47 48
 * @param plugin_manager The plugin manager
 * @param type The document type
 * @return The plugin or NULL if no matching plugin is available
49
 */
Moritz Lipp's avatar
Moritz Lipp committed
50
zathura_plugin_t* zathura_plugin_manager_get_plugin(zathura_plugin_manager_t* plugin_manager, const char* type);
51 52

/**
53
 * Returns a list with the plugin objects
54
 *
55 56
 * @param plugin_manager The plugin manager
 * @return List of plugins or NULL
57
 */
58
girara_list_t* zathura_plugin_manager_get_plugins(zathura_plugin_manager_t* plugin_manager);
59 60

/**
61 62 63 64
 * Returns the plugin functions
 *
 * @param plugin The plugin
 * @return The plugin functions
65
 */
66
const zathura_plugin_functions_t* zathura_plugin_get_functions(zathura_plugin_t* plugin);
Moritz Lipp's avatar
Moritz Lipp committed
67 68

/**
69
 * Returns the name of the plugin
Moritz Lipp's avatar
Moritz Lipp committed
70
 *
71 72
 * @param plugin The plugin
 * @return The name of the plugin or NULL
Moritz Lipp's avatar
Moritz Lipp committed
73
 */
74
const char* zathura_plugin_get_name(zathura_plugin_t* plugin);
Moritz Lipp's avatar
Moritz Lipp committed
75 76

/**
77
 * Returns the path to the plugin
Moritz Lipp's avatar
Moritz Lipp committed
78
 *
79 80
 * @param plugin The plugin
 * @return The path of the plugin or NULL
Moritz Lipp's avatar
Moritz Lipp committed
81
 */
82
char* zathura_plugin_get_path(zathura_plugin_t* plugin);
83 84

/**
85
 * Returns the version information of the plugin
Moritz Lipp's avatar
Moritz Lipp committed
86
 *
87 88
 * @param plugin The plugin
 * @return The version information of the plugin
89
 */
90
zathura_plugin_version_t zathura_plugin_get_version(zathura_plugin_t* plugin);
91 92

#endif // PLUGIN_H