Geany  dev
Data Structures | Macros | Typedefs | Enumerations
plugindata.h File Reference

This file defines the plugin API, the interface between Geany and its plugins. More...

Data Structures

struct  GeanyData
 This contains pointers to global variables owned by Geany for plugins to use. More...
 
struct  GeanyFunctions
 This contains pointers to functions owned by Geany for plugins to use. More...
 
struct  GeanyKeyGroupInfo
 
struct  GeanyPlugin
 Basic information for the plugin and identification. More...
 
struct  PluginCallback
 Callback array entry type used with the plugin_callbacks symbol. More...
 
struct  PluginFields
 
struct  PluginInfo
 Basic information about a plugin available to Geany without loading the plugin. More...
 
struct  SciFuncs
 Wrapper functions for Scintilla messages. More...
 
struct  ScintillaFuncs
 See http://scintilla.org for the full documentation. More...
 

Macros

#define DOC_IDX(doc_ptr)   (doc_ptr ? doc_ptr->index : -1)
 
#define geany   geany_data
 Simple macro for geany_data that reduces typing. More...
 
#define GEANY_ABI_VERSION   (69 << GEANY_ABI_SHIFT)
 The Application Binary Interface (ABI) version, incremented whenever existing fields in the plugin data types have to be changed or reordered. More...
 
#define GEANY_API_VERSION   218
 The Application Programming Interface (API) version, incremented whenever any plugin data types are modified or appended to. More...
 
#define PLUGIN_KEY_GROUP(group_name, key_count)
 
#define PLUGIN_SET_INFO(p_name, p_description, p_version, p_author)
 Sets the plugin name and some other basic information about a plugin. More...
 
#define PLUGIN_SET_TRANSLATABLE_INFO(localedir, package, p_name, p_description, p_version, p_author)
 Sets the plugin name and some other basic information about a plugin. More...
 
#define PLUGIN_VERSION_CHECK(api_required)
 Defines a function to check the plugin is safe to load. More...
 

Typedefs

typedef struct GeanyData GeanyData
 This contains pointers to global variables owned by Geany for plugins to use. More...
 
typedef struct GeanyFunctions GeanyFunctions
 This contains pointers to functions owned by Geany for plugins to use. More...
 
typedef struct GeanyKeyGroupInfo GeanyKeyGroupInfo
 
typedef struct GeanyPlugin GeanyPlugin
 Basic information for the plugin and identification. More...
 
typedef struct PluginCallback PluginCallback
 Callback array entry type used with the plugin_callbacks symbol. More...
 
typedef struct PluginFields PluginFields
 
typedef struct PluginInfo PluginInfo
 Basic information about a plugin available to Geany without loading the plugin. More...
 
typedef struct SciFuncs SciFuncs
 Wrapper functions for Scintilla messages. More...
 
typedef struct ScintillaFuncs ScintillaFuncs
 See http://scintilla.org for the full documentation. More...
 

Enumerations

enum  PluginFlags { PLUGIN_IS_DOCUMENT_SENSITIVE = 1 << 0 }
 

Detailed Description

This file defines the plugin API, the interface between Geany and its plugins.

For detailed documentation of the plugin system please read the plugin API documentation.

Macro Definition Documentation

#define DOC_IDX (   doc_ptr)    (doc_ptr ? doc_ptr->index : -1)
Deprecated:
  • copy into your plugin code if needed.

NULL-safe way to get the index of doc_ptr in the documents array.

#define geany   geany_data

Simple macro for geany_data that reduces typing.

#define GEANY_ABI_VERSION   (69 << GEANY_ABI_SHIFT)

The Application Binary Interface (ABI) version, incremented whenever existing fields in the plugin data types have to be changed or reordered.

Changing this forces all plugins to be recompiled before Geany can load them.

#define GEANY_API_VERSION   218

The Application Programming Interface (API) version, incremented whenever any plugin data types are modified or appended to.

You can protect code that needs a higher API than e.g. 200 with:

#if GEANY_API_VERSION >= 200
some_newer_function();
#endif
Warning
You should not test for values below 200 as previously GEANY_API_VERSION was defined as an enum value, not a macro.
#define PLUGIN_KEY_GROUP (   group_name,
  key_count 
)
Value:
/* We have to declare this as a single element array.
* Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \
GeanyKeyGroupInfo plugin_key_group_info[1] = \
{ \
{G_STRINGIFY(group_name), key_count} \
};\
struct GeanyKeyGroup GeanyKeyGroup
A collection of keybindings grouped together.
Definition: keybindings.h:60
struct GeanyKeyGroupInfo GeanyKeyGroupInfo
KeyBindingGroup * plugin_key_group
Plugins must use the PLUGIN_KEY_GROUP() macro to define it.
Definition: pluginsymbols.c:74
Deprecated:

Declare and initialise a keybinding group.

You must then set the plugin_key_group::keys[] entries for the group in plugin_init(), normally using keybindings_set_item(). The plugin_key_group::label field is set by Geany after plugin_init() is called, to the name of the plugin.

Parameters
group_nameA unique group name (without quotes) to be used in the configuration file, such as html_chars.
key_countThe number of keybindings the group will hold.
#define PLUGIN_SET_INFO (   p_name,
  p_description,
  p_version,
  p_author 
)
Value:
{ \
info->name = (p_name); \
info->description = (p_description); \
info->version = (p_version); \
info->author = (p_author); \
}
void plugin_set_info(PluginInfo *info)
Use the PLUGIN_SET_INFO() macro to define it.
Basic information about a plugin available to Geany without loading the plugin.
Definition: plugindata.h:97

Sets the plugin name and some other basic information about a plugin.

Note
If you want some of the arguments to be translated, see PLUGIN_SET_TRANSLATABLE_INFO()

Example:

PLUGIN_SET_INFO("Cool Feature", "Adds cool feature support.", "0.1", "Joe Author")
#define PLUGIN_SET_TRANSLATABLE_INFO (   localedir,
  package,
  p_name,
  p_description,
  p_version,
  p_author 
)
Value:
{ \
main_locale_init((localedir), (package)); \
info->name = (p_name); \
info->description = (p_description); \
info->version = (p_version); \
info->author = (p_author); \
}
void plugin_set_info(PluginInfo *info)
Use the PLUGIN_SET_INFO() macro to define it.
void main_locale_init(const gchar *locale_dir, const gchar *gettext_package)
Initialises the gettext translation system.
Definition: main.c:473
Basic information about a plugin available to Geany without loading the plugin.
Definition: plugindata.h:97

Sets the plugin name and some other basic information about a plugin.

This macro is like PLUGIN_SET_INFO() but allows the passed information to be translated by setting up the translation mechanism with main_locale_init(). You therefore don't need to call it manually in plugin_init().

Example:

PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Cool Feature"), _("Adds a cool feature."), "0.1", "John Doe")
Since
0.19
#define PLUGIN_VERSION_CHECK (   api_required)
Value:
gint plugin_version_check(gint abi_ver) \
{ \
if (abi_ver != GEANY_ABI_VERSION) \
return -1; \
return (api_required); \
}
gint plugin_version_check(gint)
Use the PLUGIN_VERSION_CHECK() macro instead.
#define GEANY_ABI_VERSION
The Application Binary Interface (ABI) version, incremented whenever existing fields in the plugin da...
Definition: plugindata.h:75

Defines a function to check the plugin is safe to load.

This performs runtime checks that try to ensure:

  • Geany ABI data types are compatible with this plugin.
  • Geany sources provide the required API for this plugin.
    Parameters
    api_requiredThe minimum API number your plugin requires. Look at the source for the value of GEANY_API_VERSION to use if you want your plugin to require the current Geany version on your machine. You should update this value when using any new API features.

Typedef Documentation

typedef struct GeanyData GeanyData

This contains pointers to global variables owned by Geany for plugins to use.

Core variable pointers can be appended when needed by plugin authors, if appropriate.

This contains pointers to functions owned by Geany for plugins to use.

Functions from the core can be appended when needed by plugin authors, but may require some changes.

typedef struct GeanyPlugin GeanyPlugin

Basic information for the plugin and identification.

See Also
geany_plugin.

Callback array entry type used with the plugin_callbacks symbol.

typedef struct PluginFields PluginFields
Deprecated:
Use ui_add_document_sensitive() instead.

Fields set and owned by the plugin.

typedef struct PluginInfo PluginInfo

Basic information about a plugin available to Geany without loading the plugin.

The fields are set in plugin_set_info(), usually with the PLUGIN_SET_INFO() macro.

typedef struct SciFuncs SciFuncs

Wrapper functions for Scintilla messages.

See sciwrappers.h for the list of functions.

See http://scintilla.org for the full documentation.

Enumeration Type Documentation

Deprecated:
Use ui_add_document_sensitive() instead.

Flags to be set by plugins in PluginFields struct.

Enumerator
PLUGIN_IS_DOCUMENT_SENSITIVE 

Whether a plugin's menu item should be disabled when there are no open documents.